List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.expressui.core.view.form.layout.TopLabelGridLayout.java
License:Open Source License
private void addFieldImpl(FormField formField) { VerticalLayout fieldLayout = new VerticalLayout(); fieldLayout.setWidth(SIZE_UNDEFINED, Sizeable.UNITS_PERCENTAGE); String id = StringUtil.generateDebugId("e", this, fieldLayout, "fieldLayout"); fieldLayout.setDebugId(id);/*from w w w.j a v a2 s . c o m*/ fieldLayout.addComponent(formField.getFieldLabel()); fieldLayout.addComponent(formField.getField()); if (formField.getColumnEnd() != null && formField.getRowEnd() != null) { addComponent(fieldLayout, formField.getColumnStart() - 1, formField.getRowStart() - 1, formField.getColumnEnd() - 1, formField.getRowEnd() - 1); } else { addComponent(fieldLayout, formField.getColumnStart() - 1, formField.getRowStart() - 1); } }
From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java
License:Open Source License
private HorizontalLayout createNavigationFormLayout() { HorizontalLayout navigationFormLayout = new HorizontalLayout(); String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout"); navigationFormLayout.setDebugId(id); navigationFormLayout.setSizeUndefined(); VerticalLayout previousButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout"); previousButtonLayout.setDebugId(id); previousButtonLayout.setSizeUndefined(); previousButtonLayout.setMargin(false); previousButtonLayout.setSpacing(false); Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined();//from w w w. ja v a 2 s . com previousButtonLayout.addComponent(spaceLabel); Button previousButton = new Button(null, this, "previousItem"); previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png")); if (entityForm.getViewableToManyRelationships().size() == 0) { HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout, "previousButtonHorizontalLayout"); previousButtonHorizontalLayout.setDebugId(id); previousButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label(" ", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); previousButtonHorizontalLayout.addComponent(previousButton); previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel); previousButtonLayout.addComponent(previousButtonHorizontalLayout); } else { previousButtonLayout.addComponent(previousButton); } navigationFormLayout.addComponent(previousButtonLayout); navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT); navigationFormLayout.addComponent(entityForm); VerticalLayout nextButtonLayout = new VerticalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout"); nextButtonLayout.setDebugId(id); nextButtonLayout.setSizeUndefined(); nextButtonLayout.setMargin(false); nextButtonLayout.setSpacing(false); spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); previousButtonLayout.addComponent(spaceLabel); nextButtonLayout.addComponent(spaceLabel); Button nextButton = new Button(null, this, "nextItem"); nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png")); HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout(); id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout"); nextButtonHorizontalLayout.setDebugId(id); nextButtonHorizontalLayout.setSizeUndefined(); Label horizontalSpaceLabel = new Label(" ", Label.CONTENT_XHTML); horizontalSpaceLabel.setSizeUndefined(); nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel); nextButtonHorizontalLayout.addComponent(nextButton); nextButtonLayout.addComponent(nextButtonHorizontalLayout); navigationFormLayout.addComponent(nextButtonLayout); navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT); navigationFormLayout.setSpacing(false); navigationFormLayout.setMargin(false); return navigationFormLayout; }
From source file:com.expressui.core.view.form.TypedForm.java
License:Open Source License
@PostConstruct @Override/*from w w w.jav a2 s.c o m*/ public void postConstruct() { super.postConstruct(); form = new ConfigurableForm(); form.setSizeUndefined(); form.setWriteThrough(true); form.setInvalidCommitted(true); form.setImmediate(true); form.setValidationVisibleOnCommit(true); formFieldSet.setForm(this); init(formFieldSet); formFieldSet.assertValid(); form.setFormFieldFactory(new TypedFormFieldFactory(getFormFieldSet())); final Layout gridLayout = getFormFieldSet().createGridLayout(); form.setLayout(gridLayout); form.getFooter().addStyleName("e-typed-form-footer"); createFooterButtons((HorizontalLayout) form.getFooter()); VerticalLayout tabsAndForm = new VerticalLayout(); setDebugId(tabsAndForm, "tabsAndForm"); tabsAndForm.setSizeUndefined(); if (getFormFieldSet().hasTabs()) { initializeTabs(tabsAndForm); if (getFormFieldSet().hasOptionalTabs()) { initializeOptionalTabs(tabsAndForm); } } tabsAndForm.addComponent(form); Label spaceLabel = new Label("</br>", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); tabsAndForm.addComponent(spaceLabel); addComponent(makeCollapsible(getTypeCaption(), tabsAndForm)); labelRegistry.registerLabels(getFormFieldSet()); }
From source file:com.expressui.core.view.form.TypedForm.java
License:Open Source License
private void initializeTabs(VerticalLayout layout) { final Set<String> tabNames = getFormFieldSet().getTabNames(); formTabSheet = new TabSheet(); setDebugId(formTabSheet, "formTabSheet"); formTabSheet.addStyleName("borderless"); formTabSheet.setSizeUndefined();//from w w w.j ava 2 s. c om int tabPosition = 0; for (String tabName : tabNames) { Assert.PROGRAMMING.isTrue(!tabName.isEmpty(), "Tab name may not be empty string"); Label emptyLabel = new Label(); emptyLabel.setSizeUndefined(); formTabSheet.addTab(emptyLabel, tabName, null); tabPositions.put(tabName, tabPosition++); } layout.addComponent(formTabSheet); formTabSheet.addListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { String tabName = getCurrentlySelectedTabName(); form.getLayout().removeAllComponents(); FormGridLayout gridLayout = (FormGridLayout) form.getLayout(); gridLayout.setFormColumns(getFormFieldSet().getColumns(tabName)); gridLayout.setRows(getFormFieldSet().getRows(tabName)); Set<FormField> formFields = getFormFieldSet().getFormFields(tabName); for (FormField formField : formFields) { String propertyId = formField.getPropertyId(); Field field = formField.getField(); form.attachField(propertyId, field); } gridLayout.requestRepaint(); } }); }
From source file:com.foc.helpBook.HelpUI.java
License:Apache License
@Override public FocCentralPanel newWindow() { FocCentralPanel focCentralPanel = new FocCentralPanel(); focCentralPanel.fill();/*from w w w . jav a 2 s. c o m*/ Label labelHelpContent = new Label(); labelHelpContent.setContentMode(ContentMode.HTML); String htmlContent = (String) FocWebApplication.getFocWebSession_Static().getParameter("HELP_CONTENT"); labelHelpContent.setValue(htmlContent); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); HorizontalLayout navigationLayout = new HorizontalLayout(); navigationLayout.setWidth("95%"); navigationLayout.addComponent(getPreviousPageButton()); navigationLayout.setComponentAlignment(getPreviousPageButton(), Alignment.BOTTOM_LEFT); navigationLayout.addComponent(getNextPageButton()); navigationLayout.setComponentAlignment(getNextPageButton(), Alignment.BOTTOM_RIGHT); mainLayout.addComponent(labelHelpContent); mainLayout.addComponent(navigationLayout); mainLayout.setComponentAlignment(navigationLayout, Alignment.BOTTOM_CENTER); focCentralPanel.addComponent(mainLayout); return focCentralPanel; }
From source file:com.foc.vaadin.FocWebApplication.java
License:Apache License
protected void init2(VaadinRequest request) { // Create the footer Layout with a simple Label VerticalLayout footerLayout = new VerticalLayout(); {/*from w ww . j ava2 s . com*/ footerLayout.addComponent(new Label("This is the footer always visible")); footerLayout.setHeight("-1px"); } // Create the Body Panel that contains a VerticalLayout itself Panel panel = new Panel(); { panel.setSizeFull();// Panel size is undefined final VerticalLayout panelLayout = new VerticalLayout(); panelLayout.setSizeUndefined();// Panel Layout size is undefined panel.setContent(panelLayout); // Fill the panel layout with lots of labels to exceed the window height for (int i = 0; i < 200; i++) { panelLayout.addComponent(new Label("Thank you for clicking")); } } // Put all in the the MainVerticalLayout final VerticalLayout mainVerticalLayout = new VerticalLayout(); mainVerticalLayout.setSizeFull();// Main Layout is set to size Full so that it fills all the height mainVerticalLayout.addComponent(panel); mainVerticalLayout.addComponent(footerLayout); mainVerticalLayout.setExpandRatio(panel, 1); setContent(mainVerticalLayout); }
From source file:com.foc.vaadin.FocWebApplication.java
License:Apache License
public void initializeGUI(VaadinRequest vaadinRequest, ServletContext servletContext, HttpSession httpSession) { String path = vaadinRequest != null ? vaadinRequest.getPathInfo() : null; navigationWindow = newWindow();//ww w. j a v a 2 s . co m if (Utils.isStringEmpty(Globals.getApp().getURL())) { if (Page.getCurrent() != null) { URI url = Page.getCurrent().getLocation(); Globals.getApp().setURL(url.toString()); } } applyUserThemeSelection(); if (Globals.isValo() && !isPrintUI()) { navigationWindow.setHeightUndefined(); navigationWindow.setHeight("100%"); FocXMLGuiComponentStatic.setCaptionMargin_Zero(navigationWindow); //PANEL // Panel bodyPanel = new Panel(); // bodyPanel.setSizeFull(); // bodyPanel.setContent(navigationWindow); //----- footerLayout = new VerticalLayout(); footerLayout.setHeight("-1px"); //footerLayout.addComponent(new Label("")); VerticalLayout mainVerticalLayout = new VerticalLayout(); mainVerticalLayout.setSizeFull();// Main Layout is set to size Full so that it fills all the height //PANEL // mainVerticalLayout.addComponent(bodyPanel); // mainVerticalLayout.setExpandRatio(bodyPanel, 1); //----- mainVerticalLayout.addComponent(navigationWindow); mainVerticalLayout.setExpandRatio(navigationWindow, 1); mainVerticalLayout.addComponent(footerLayout); setContent(mainVerticalLayout); } else { setContent(navigationWindow); footerLayout = null; } initAccountFromDataBase(); if (getNavigationWindow() != null) { INavigationWindow window = getNavigationWindow(); URI uri = Page.getCurrent().getLocation(); //Make sure the environment allows unit testing if (ConfigInfo.isUnitAllowed() && uri.getHost().equals("localhost")) { //If there are no test indexes already then we need to check the URL for test request if (!FocUnitDictionary.getInstance().hasNextTest()) { String suiteName = null; String testName = null; if (path != null && path.toLowerCase().startsWith(URL_PARAMETER_KEY_UNIT_SUITE + ":")) { suiteName = path.substring((URL_PARAMETER_KEY_UNIT_SUITE + ":").length()); if (!Utils.isStringEmpty(suiteName)) { int indexOfSuperior = suiteName.indexOf("."); if (indexOfSuperior > 0) { testName = suiteName.substring(indexOfSuperior + 1, suiteName.length()); suiteName = suiteName.substring(0, indexOfSuperior); } FocUnitDictionary.getInstance().initializeCurrentSuiteAndTest(suiteName, testName); } } } if (FocUnitDictionary.getInstance().hasNextTest()) { try { Globals.getApp().setIsUnitTest(true); FocUnitDictionary.getInstance().runSequence(); } catch (Exception e) { Globals.logException(e); } finally { // if( !FocUnitDictionary.getInstance().isPause() // && !FocUnitDictionary.getInstance().isNextTestExist() // ){ // FocUnitDictionary.getInstance().popupLogger(window); // } Globals.getApp().setIsUnitTest(false); } } } } //-------------------------------------------- }
From source file:com.foc.vaadin.gui.components.FVObjectSelector.java
License:Apache License
@Override public void fillMenu(VerticalLayout root) { addButton = new PopupLinkButton("Add", new ClickListener() { @Override/*from w w w. java2 s. c om*/ public void buttonClick(ClickEvent event) { if (getComboBox() != null) { getComboBox().addNewObject(); } } }); root.addComponent(addButton); openButton = new PopupLinkButton("Open", new ClickListener() { @Override public void buttonClick(ClickEvent event) { FocObject focObjToOpen = getComboBox() != null ? getComboBox().getFocObject_FromGuiCombo() : null; if (focObjToOpen == null) { Globals.showNotification("Field is empty", "a selection must be made to open object", IFocEnvironment.TYPE_WARNING_MESSAGE); } else { getComboBox().openObjectDetailsPanel(focObjToOpen, true); } } }); root.addComponent(openButton); reloadButton = new PopupLinkButton("Reload", new ClickListener() { @Override public void buttonClick(ClickEvent event) { FVObjectComboBox objectComboBox = getComboBox(); if (objectComboBox != null) { objectComboBox.reloadList(); } } }); root.addComponent(reloadButton); }
From source file:com.foc.vaadin.gui.components.objectSelectorPopupView.FVObjectSelectorWindow.java
License:Apache License
private void init() { setModal(true);//ww w .ja v a2s. co m setResizable(false); setWidth("400px"); setHeight("200px"); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeFull(); verticalLayout.addComponent(getMainHorizontalLayout()); verticalLayout.setComponentAlignment(getMainHorizontalLayout(), Alignment.MIDDLE_CENTER); setContent(verticalLayout); }
From source file:com.foc.vaadin.gui.layouts.FVHTMLLayout.java
License:Apache License
@Override public void addComponent(Component comp) { Component component = getCompositionRoot(); if (component instanceof VerticalLayout) { VerticalLayout verticalLayout = (VerticalLayout) component; verticalLayout.addComponent(comp); }//from w w w.j av a 2 s .c o m }