List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
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 ww.j av a 2 s . c om*/ 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.SearchForm.java
License:Open Source License
@Override protected void createFooterButtons(HorizontalLayout footerLayout) { footerLayout.setSpacing(true);// w w w . j a v a 2 s.co m footerLayout.setMargin(true); Button clearButton = new Button(uiMessageSource.getMessage("searchForm.clear"), this, "clear"); clearButton.setDescription(uiMessageSource.getToolTip("searchForm.clear.toolTip")); clearButton.setIcon(new ThemeResource("../expressui/icons/16/clear.png")); clearButton.addStyleName("small default"); footerLayout.addComponent(clearButton); Button searchButton = new Button(uiMessageSource.getMessage("searchForm.search"), this, "search"); searchButton.setDescription(uiMessageSource.getToolTip("searchForm.search.toolTip")); searchButton.setIcon(new ThemeResource("../expressui/icons/16/search.png")); searchButton.addStyleName("small default"); footerLayout.addComponent(searchButton); }
From source file:com.expressui.core.view.form.TypedForm.java
License:Open Source License
/** * Makes the component collapsible by wrapping it with a layout and button for toggling * the component's visibility. This allows the user to expand/collapse the given component in order * to free space for viewing other components. * * @param component component to show/hide * @param useVerticalLayout true if toggle button should be laid out vertically next to animated component * @return the newly created layout that contains the toggle button and animated component */// ww w . j a v a 2 s. c om protected Component makeCollapsible(String caption, Component component, boolean useVerticalLayout) { formAnimator = new Animator(component); formAnimator.setSizeUndefined(); AbstractOrderedLayout animatorLayout; if (useVerticalLayout) { animatorLayout = new VerticalLayout(); } else { animatorLayout = new HorizontalLayout(); } setDebugId(animatorLayout, "animatorLayout"); animatorLayout.setMargin(false, false, false, false); animatorLayout.setSpacing(false); toggleFormCollapseButton = new Button(null, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setFormVisible(!isFormVisible()); } }); toggleFormCollapseButton.setDescription(uiMessageSource.getToolTip("typedForm.toggleSearchForm.toolTip")); toggleFormCollapseButton.setIcon(new ThemeResource("../expressui/icons/collapse-icon.png")); toggleFormCollapseButton.addStyleName("borderless"); if (useVerticalLayout) { HorizontalLayout toggleFormButtonAndCaption = new HorizontalLayout(); setDebugId(toggleFormButtonAndCaption, "toggleFormButtonAndCaption"); toggleFormButtonAndCaption.setSizeUndefined(); toggleFormButtonAndCaption.addComponent(toggleFormCollapseButton); Label label = new Label(caption); label.setSizeUndefined(); toggleFormButtonAndCaption.addComponent(label); animatorLayout.addComponent(toggleFormButtonAndCaption); animatorLayout.addComponent(formAnimator); } else { animatorLayout.addComponent(toggleFormCollapseButton); animatorLayout.addComponent(formAnimator); } return animatorLayout; }
From source file:com.expressui.core.view.page.DashboardPage.java
License:Open Source License
/** * Adds a component to the dashboard.//from ww w. j av a 2s . c o m * * @param component component to add * @param caption caption to display above component * @param startRow start row coordinate in Dashboard grid * @param startColumn start column coordinate in Dashboard grid * @param endRow end row coordinate in Dashboard grid * @param endColumn end column coordinate in Dashboard grid */ public void addComponent(Component component, String caption, int startRow, int startColumn, int endRow, int endColumn) { if (component instanceof TypedComponent && !((TypedComponent) component).isViewAllowed()) return; Panel panel = new Panel(caption); panel.addStyleName(ChameleonTheme.PANEL_BUBBLE); HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeUndefined(); panel.setSizeUndefined(); setWidthAndHeightIfNotNull(component); panel.setContent(panelLayout); panelLayout.setMargin(true); panelLayout.setSpacing(true); panelLayout.addComponent(component); int rows = Math.max(rootLayout.getRows() - 1, endRow); int columns = Math.max(rootLayout.getColumns() - 1, endColumn); if (rootLayout.getRows() < rows) { rootLayout.setRows(rows); } if (rootLayout.getColumns() < columns) { rootLayout.setColumns(columns); } removeComponent(startRow, startColumn); rootLayout.addComponent(panel, startColumn - 1, startRow - 1, endColumn - 1, endRow - 1); }
From source file:com.expressui.core.view.results.CrudResults.java
License:Open Source License
@PostConstruct @Override/*from ww w . ja v a 2s. co m*/ public void postConstruct() { super.postConstruct(); getResultsTable().setMultiSelect(true); HorizontalLayout crudButtons = new HorizontalLayout(); setDebugId(crudButtons, "crudButtons"); crudButtons.setMargin(false); crudButtons.setSpacing(true); newButton = new Button(uiMessageSource.getMessage("crudResults.new"), this, "create"); newButton.setDescription(uiMessageSource.getToolTip("crudResults.new.toolTip")); newButton.setIcon(new ThemeResource("../expressui/icons/16/add.png")); newButton.addStyleName("small default"); crudButtons.addComponent(newButton); viewButton = new Button(uiMessageSource.getMessage("crudResults.view"), this, "view"); viewButton.setDescription(uiMessageSource.getToolTip("crudResults.view.toolTip")); viewButton.setIcon(new ThemeResource("../expressui/icons/16/view.png")); viewButton.addStyleName("small default"); crudButtons.addComponent(viewButton); editButton = new Button(uiMessageSource.getMessage("crudResults.edit"), this, "edit"); editButton.setDescription(uiMessageSource.getToolTip("crudResults.edit.toolTip")); editButton.setIcon(new ThemeResource("../expressui/icons/16/edit.png")); editButton.addStyleName("small default"); crudButtons.addComponent(editButton); deleteButton = new Button(uiMessageSource.getMessage("crudResults.delete"), this, "delete"); deleteButton.setDescription(uiMessageSource.getToolTip("crudResults.delete.toolTip")); deleteButton.setIcon(new ThemeResource("../expressui/icons/16/delete.png")); deleteButton.addStyleName("small default"); crudButtons.addComponent(deleteButton); actionContextMenu.addAction("crudResults.view", this, "view"); actionContextMenu.addAction("crudResults.edit", this, "edit"); actionContextMenu.addAction("crudResults.delete", this, "delete"); addSelectionChangedListener(this, "selectionChanged"); getCrudButtons().addComponent(crudButtons, 0); getCrudButtons().setComponentAlignment(crudButtons, Alignment.MIDDLE_LEFT); getResultsTable().addListener(new DoubleClickListener()); addCodePopupButtonIfEnabledForCrudResults(); }
From source file:com.expressui.core.view.results.Results.java
License:Open Source License
private HorizontalLayout createNavigationLine() { HorizontalLayout resultCountDisplay = new HorizontalLayout(); setDebugId(resultCountDisplay, "resultCountDisplay"); firstResultTextField = createFirstResultTextField(); firstResultTextField.addStyleName("small"); firstResultTextField.setSizeUndefined(); resultCountDisplay.addComponent(firstResultTextField); resultCountLabel = new Label("", Label.CONTENT_XHTML); resultCountLabel.setSizeUndefined(); resultCountLabel.addStyleName("small"); resultCountDisplay.addComponent(resultCountLabel); Label spaceLabel = new Label(" ", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined();//from ww w.j ava 2s . com resultCountDisplay.addComponent(spaceLabel); Button refreshButton = new Button(null, getResultsTable(), "refresh"); refreshButton.setDescription(uiMessageSource.getToolTip("results.refresh.toolTip")); refreshButton.setSizeUndefined(); refreshButton.addStyleName("borderless"); refreshButton.setIcon(new ThemeResource("../expressui/icons/16/refresh-blue.png")); resultCountDisplay.addComponent(refreshButton); HorizontalLayout navigationButtons = new HorizontalLayout(); setDebugId(navigationButtons, "navigationButtons"); navigationButtons.setMargin(false, true, false, false); navigationButtons.setSpacing(true); String perPageText = uiMessageSource.getMessage("results.pageSize"); pageSizeMenu = new Select(); pageSizeMenu.addStyleName("small"); List<Integer> pageSizeOptions = applicationProperties.getPageSizeOptions(); for (Integer pageSizeOption : pageSizeOptions) { pageSizeMenu.addItem(pageSizeOption); pageSizeMenu.setItemCaption(pageSizeOption, pageSizeOption + " " + perPageText); } pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF); pageSizeMenu.setNewItemsAllowed(false); pageSizeMenu.setNullSelectionAllowed(false); pageSizeMenu.setImmediate(true); pageSizeMenu.setWidth(8, UNITS_EM); navigationButtons.addComponent(pageSizeMenu); firstButton = new Button(null, getResultsTable(), "firstPage"); firstButton.setDescription(uiMessageSource.getToolTip("results.first.toolTip")); firstButton.setSizeUndefined(); firstButton.addStyleName("borderless"); firstButton.setIcon(new ThemeResource("../expressui/icons/16/first.png")); navigationButtons.addComponent(firstButton); previousButton = new Button(null, getResultsTable(), "previousPage"); previousButton.setDescription(uiMessageSource.getToolTip("results.previous.toolTip")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png")); navigationButtons.addComponent(previousButton); nextButton = new Button(null, getResultsTable(), "nextPage"); nextButton.setDescription(uiMessageSource.getToolTip("results.next.toolTip")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png")); navigationButtons.addComponent(nextButton); lastButton = new Button(null, getResultsTable(), "lastPage"); lastButton.setDescription(uiMessageSource.getToolTip("results.last.toolTip")); lastButton.setSizeUndefined(); lastButton.addStyleName("borderless"); lastButton.setIcon(new ThemeResource("../expressui/icons/16/last.png")); navigationButtons.addComponent(lastButton); excelButton = new Button(null, this, "openExportForm"); excelButton.setDescription(uiMessageSource.getToolTip("results.excel.toolTip")); excelButton.setSizeUndefined(); excelButton.addStyleName("borderless"); excelButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp")); navigationButtons.addComponent(excelButton); exportForm.setExportButtonListener(this, "exportToExcel"); HorizontalLayout navigationLine = new HorizontalLayout(); setDebugId(navigationLine, "navigationLine"); navigationLine.setSizeUndefined(); navigationLine.setMargin(true, false, true, false); navigationLine.addComponent(resultCountDisplay); navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT); spaceLabel = new Label("", Label.CONTENT_XHTML); spaceLabel.setWidth(2, Sizeable.UNITS_EM); navigationLine.addComponent(spaceLabel); navigationLine.addComponent(navigationButtons); navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT); return navigationLine; }
From source file:com.fnc.view.ui.AlphaListMainUI.java
public AlphaListMainUI() { setSizeFull();/*from w ww.j av a2 s .c om*/ setMargin(true); addComponent(buildForms()); HorizontalLayout h = new HorizontalLayout(); h.setWidthUndefined(); h.setSpacing(true); progress.setWidth("150px"); h.addComponent(progress); h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); status.setValue("0%"); h.addComponent(status); addComponent(h); addComponent(grid); }
From source file:com.fnc.view.ui.AlphaListMainUI.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("50%"); corporation.setCaption("Corporation: "); corporation.addStyleName(ValoTheme.COMBOBOX_SMALL); trade.setCaption("Trade: "); trade.addStyleName(ValoTheme.COMBOBOX_SMALL); branch.setCaption("Branch: "); branch.addStyleName(ValoTheme.COMBOBOX_SMALL); corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption())); form.addComponent(corporation);//from ww w. j av a 2 s .com trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption())); form.addComponent(trade); branch.addValueChangeListener(branchPropertyChangeListener); form.addComponent(branch); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Year: "); h.setWidth("100%"); h.setSpacing(true); h.addComponent(selectYear()); h.addComponent(alphaListButton()); form.addComponent(h); return form; }
From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java
public ThirteenthMonthUI() { setSizeFull();// ww w . jav a 2 s . com setMargin(true); addComponent(buildForms()); HorizontalLayout h = new HorizontalLayout(); h.setWidthUndefined(); h.setSpacing(true); progress.setWidth("150px"); h.addComponent(progress); h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); status.setValue("0%"); h.addComponent(status); addComponent(h); }
From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("50%"); corporation.setCaption("Corporation: "); corporation.addStyleName(ValoTheme.COMBOBOX_SMALL); trade.setCaption("Trade: "); trade.addStyleName(ValoTheme.COMBOBOX_SMALL); branch.setCaption("Branch: "); branch.addStyleName(ValoTheme.COMBOBOX_SMALL); corporation.addValueChangeListener(new CorporateComboBoxPropertyListener(trade, trade.getCaption())); form.addComponent(corporation);// w w w . java2 s . c om trade.addValueChangeListener(new CorporateComboBoxPropertyListener(branch, branch.getCaption())); form.addComponent(trade); branch.addValueChangeListener(branchPropertyChangeListener); form.addComponent(branch); HorizontalLayout h = new HorizontalLayout(); h.setCaption("Year: "); h.setWidth("100%"); h.setSpacing(true); h.addComponent(selectYear()); h.addComponent(button()); form.addComponent(h); return form; }