List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);/*from w w w. j av a2s . com*/ content.setSpacing(true); content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for"); group.addStyleName("v-component-group"); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(800); } catch (InterruptedException e) { } } }); group.addComponent(loading); Button delay = new Button("3"); delay.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(3000); } catch (InterruptedException e) { } } }); group.addComponent(delay); Button wait = new Button("15"); wait.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(15000); } catch (InterruptedException e) { } } }); wait.addStyleName("last"); group.addComponent(wait); Label label = new Label(" seconds", ContentMode.HTML); label.setSizeUndefined(); group.addComponent(label); Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added."); spinnerDesc.addStyleName("small"); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!ValoThemeUI.isTestMode()) { final Label spinner = new Label(); spinner.addStyleName("spinner"); Button showSpinnerButton = new Button("Show spinner", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { content.replaceComponent(event.getComponent(), spinner); } }); content.addComponent(showSpinnerButton); } return p; }
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel windows() { Panel p = new Panel("Dialogs"); VerticalLayout content = new VerticalLayout() { final Window win = new Window("Window Caption"); String prevHeight = "300px"; boolean footerVisible = true; boolean autoHeight = false; boolean tabsVisible = false; boolean toolbarVisible = false; boolean footerToolbar = false; boolean toolbarLayout = false; String toolbarStyle = null; VerticalLayout windowContent() { VerticalLayout root = new VerticalLayout(); if (toolbarVisible) { MenuBar menuBar = MenuBars.getToolBar(); menuBar.setSizeUndefined(); menuBar.setStyleName(toolbarStyle); Component toolbar = menuBar; if (toolbarLayout) { menuBar.setWidth(null); HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setWidth("100%"); toolbarLayout.setSpacing(true); Label label = new Label("Tools"); label.setSizeUndefined(); toolbarLayout.addComponents(label, menuBar); toolbarLayout.setExpandRatio(menuBar, 1); toolbarLayout.setComponentAlignment(menuBar, Alignment.TOP_RIGHT); toolbar = toolbarLayout; }/* w ww .ja va 2 s . co m*/ toolbar.addStyleName("v-window-top-toolbar"); root.addComponent(toolbar); } Component content = null; if (tabsVisible) { TabSheet tabs = new TabSheet(); tabs.setSizeFull(); VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML)); l.setMargin(true); tabs.addTab(l, "Selected"); tabs.addTab(new Label(" ", ContentMode.HTML), "Another"); tabs.addTab(new Label(" ", ContentMode.HTML), "One more"); tabs.addStyleName("padded-tabbar"); tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) { try { Thread.sleep(600); } catch (InterruptedException e) { e.printStackTrace(); } } }); content = tabs; } else if (!autoHeight) { Panel p = new Panel(); p.setSizeFull(); p.addStyleName("borderless"); if (!toolbarVisible || !toolbarLayout) { p.addStyleName("scroll-divider"); } VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML)); l.setMargin(true); p.setContent(l); content = p; } else { content = new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML); root.setMargin(true); } root.addComponent(content); if (footerVisible) { HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName("v-window-bottom-toolbar"); Label footerText = new Label("Footer text"); footerText.setSizeUndefined(); Button ok = new Button("OK"); ok.addStyleName("primary"); Button cancel = new Button("Cancel"); footer.addComponents(footerText, ok, cancel); footer.setExpandRatio(footerText, 1); if (footerToolbar) { MenuBar menuBar = MenuBars.getToolBar(); menuBar.setStyleName(toolbarStyle); menuBar.setWidth(null); footer.removeAllComponents(); footer.addComponent(menuBar); } root.addComponent(footer); } if (!autoHeight) { root.setSizeFull(); root.setExpandRatio(content, 1); } return root; } { setSpacing(true); setMargin(true); win.setWidth("380px"); win.setHeight(prevHeight); win.setClosable(false); win.setResizable(false); win.setContent(windowContent()); win.setCloseShortcut(KeyCode.ESCAPE, null); Command optionsCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Footer")) { footerVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Auto Height")) { autoHeight = selectedItem.isChecked(); if (!autoHeight) { win.setHeight(prevHeight); } else { prevHeight = win.getHeight() + win.getHeightUnits().toString(); win.setHeight(null); } } if (selectedItem.getText().equals("Tabs")) { tabsVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Top")) { toolbarVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Footer")) { footerToolbar = selectedItem.isChecked(); } if (selectedItem.getText().equals("Top layout")) { toolbarLayout = selectedItem.isChecked(); } if (selectedItem.getText().equals("Borderless")) { toolbarStyle = selectedItem.isChecked() ? "borderless" : null; } win.setContent(windowContent()); } }; MenuBar options = new MenuBar(); options.setCaption("Content"); options.addItem("Auto Height", optionsCommand).setCheckable(true); options.addItem("Tabs", optionsCommand).setCheckable(true); MenuItem option = options.addItem("Footer", optionsCommand); option.setCheckable(true); option.setChecked(true); options.addStyleName("small"); addComponent(options); options = new MenuBar(); options.setCaption("Toolbars"); options.addItem("Footer", optionsCommand).setCheckable(true); options.addItem("Top", optionsCommand).setCheckable(true); options.addItem("Top layout", optionsCommand).setCheckable(true); options.addItem("Borderless", optionsCommand).setCheckable(true); options.addStyleName("small"); addComponent(options); Command optionsCommand2 = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Caption")) { win.setCaption(selectedItem.isChecked() ? "Window Caption" : null); } else if (selectedItem.getText().equals("Closable")) { win.setClosable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Resizable")) { win.setResizable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Modal")) { win.setModal(selectedItem.isChecked()); } } }; options = new MenuBar(); options.setCaption("Options"); MenuItem caption = options.addItem("Caption", optionsCommand2); caption.setCheckable(true); caption.setChecked(true); options.addItem("Closable", optionsCommand2).setCheckable(true); options.addItem("Resizable", optionsCommand2).setCheckable(true); options.addItem("Modal", optionsCommand2).setCheckable(true); options.addStyleName("small"); addComponent(options); final Button show = new Button("Open Window", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getUI().addWindow(win); win.center(); win.focus(); event.getButton().setEnabled(false); } }); show.addStyleName("primary"); addComponent(show); final CheckBox hidden = new CheckBox("Hidden"); hidden.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { win.setVisible(!hidden.getValue()); } }); addComponent(hidden); win.addCloseListener(new CloseListener() { @Override public void windowClose(final CloseEvent e) { show.setEnabled(true); } }); } }; p.setContent(content); return p; }
From source file:com.cavisson.gui.dashboard.components.controls.Dragging.java
License:Apache License
private List<Component> createComponents() { final List<Component> components = new ArrayList<Component>(); final Label label = new Label("This is a long text block that will wrap."); label.setWidth("120px"); components.add(label);/*from www . j a va2 s . c om*/ final Embedded image = new Embedded("", new ThemeResource("../runo/icons/64/document.png")); components.add(image); final CssLayout documentLayout = new CssLayout(); documentLayout.setWidth("19px"); for (int i = 0; i < 5; ++i) { final Embedded e = new Embedded(null, new ThemeResource("../runo/icons/16/document.png")); e.setHeight("16px"); e.setWidth("16px"); documentLayout.addComponent(e); } components.add(documentLayout); final VerticalLayout buttonLayout = new VerticalLayout(); final Button button = new Button("Button"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { Notification.show("Button clicked"); } }); buttonLayout.addComponent(button); buttonLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER); components.add(buttonLayout); return components; }
From source file:com.cavisson.gui.dashboard.components.controls.Labels.java
License:Apache License
public Labels() { setMargin(true);/* w w w .j ava2 s.com*/ addStyleName("content-labels"); Label h1 = new Label("Labels"); h1.addStyleName("h1"); addComponent(h1); VerticalLayout left = new VerticalLayout(); left.setMargin(new MarginInfo(false, true, false, false)); addComponent(left); Label huge = new Label("Huge type for display text."); huge.addStyleName("huge"); left.addComponent(huge); Label large = new Label( "Large type for introductory text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); large.addStyleName("large"); left.addComponent(large); Label h2 = new Label("Subtitle"); h2.addStyleName("h2"); left.addComponent(h2); Label normal = new Label( "Normal type for plain text, with a <a href=\"https://vaadin.com\">regular link</a>. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu.", ContentMode.HTML); left.addComponent(normal); Label h3 = new Label("Small Title"); h3.addStyleName("h3"); left.addComponent(h3); Label small = new Label( "Small type for additional text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); small.addStyleName("small"); left.addComponent(small); Label tiny = new Label("Tiny type for minor text."); tiny.addStyleName("tiny"); left.addComponent(tiny); Label h4 = new Label("Section Title"); h4.addStyleName("h4"); left.addComponent(h4); normal = new Label( "Normal type for plain text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); left.addComponent(normal); Panel p = new Panel("Additional Label Styles"); addComponent(p); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setMargin(true); p.setContent(right); Label label = new Label( "Bold type for prominent text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName("bold"); right.addComponent(label); label = new Label( "Light type for subtle text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName("light"); right.addComponent(label); label = new Label( "Colored type for highlighted text. Etiam at risus et justo dignissim congue. Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu."); label.addStyleName("colored"); right.addComponent(label); label = new Label("A label for success"); label.addStyleName("success"); right.addComponent(label); label = new Label("A label for failure"); label.addStyleName("failure"); right.addComponent(label); }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
Component panelContent() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from www. ja va2 s .c o m layout.setMargin(true); layout.setSpacing(true); Label content = new Label( "Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio."); content.setWidth("10em"); layout.addComponent(content); Button button = new Button("Button"); button.setSizeFull(); layout.addComponent(button); return layout; }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
Component panelContentScroll() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from ww w . ja va2s .c om*/ layout.setSpacing(true); Label content = new Label( "Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio. Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio."); content.setWidth("10em"); layout.addComponent(content); Button button = new Button("Button"); layout.addComponent(button); return layout; }
From source file:com.cavisson.gui.dashboard.components.controls.Tabsheets.java
License:Apache License
static TabSheet getTabSheet(boolean caption, String style, boolean closable, boolean scrolling, boolean icon, boolean disable) { TestIcon testIcon = new TestIcon(60); TabSheet ts = new TabSheet(); ts.addStyleName(style);// w w w . j a v a 2 s.c om StringGenerator sg = new StringGenerator(); for (int i = 1; i <= (scrolling ? 10 : 3); i++) { String tabcaption = caption ? sg.nextString(true) + " " + sg.nextString(false) : null; VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.addComponent(new Label("Content for tab " + i)); if (i == 2) { content.addComponent(new Label( "Excepteur sint obcaecat cupiditat non proident culpa. Magna pars studiorum, prodita quaerimus.")); } Tab t = ts.addTab(content, tabcaption); t.setClosable(closable); t.setEnabled(!disable); // First tab is always enabled if (i == 1) { t.setEnabled(true); } if (icon) { t.setIcon(testIcon.get(false)); } } ts.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }); return ts; }
From source file:com.cms.component.CommonFunctionTableFilter.java
public static void initTable(final CommonTableFilterPanel tblPn, LinkedHashMap<String, CustomTable.Align> headerData, final BeanItemContainer container, String caption, int tblSize, String lang, boolean viewSearchBar, boolean isShowBtnAdd, boolean isShowBtnSave, boolean isShowBtnDelete, boolean isActionDelele) { //INIT INSIDE COMPONENT VerticalLayout verTbl; final CustomPageTableFilter<IndexedContainer> tbl = tblPn.getMainTable(); tbl.setSortEnabled(true);// w w w. j a v a2 s .c o m verTbl = tblPn.getVerTBLListGoodInfomation(); // tblPn.getGridTBLInfomation().removeAllComponents(); // tblPn.getVerTBLListGoodInfomation().setCaption(caption); tblPn.getVerTBLListGoodInfomation().setCaption(MakeURL.makeURLForTable(caption)); tblPn.getVerTBLListGoodInfomation().setCaptionAsHtml(true); // tblPn.getVerTBLListGoodInfomation().setCaption("aaaa"); //Set nicer header names tbl.addGeneratedColumn(Constants.STT, new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, Object itemId, Object columnId) { List lstObj = (List) source.getItemIds(); int i = lstObj.indexOf(itemId); return i + 1; } }); tbl.setColumnAlignment(Constants.STT, CustomTable.Align.CENTER); tbl.setColumnWidth(Constants.STT, 45); for (String headerStr : headerData.keySet()) { if (!Constants.CHECKBOX_COLUMN.equalsIgnoreCase(headerStr)) { tbl.setColumnHeader(headerStr.trim(), BundleUtils.getString(lang + "." + headerStr)); } if ("delete".equalsIgnoreCase(headerStr) || "edit".equalsIgnoreCase(headerStr)) { tbl.setColumnHeader(headerStr.trim(), BundleUtils.getString(headerStr)); } tbl.setColumnAlignment(headerStr.trim(), headerData.get(headerStr)); } //QuyenDM set tooltip ShortcutUtils.setTooltipForFields(tbl, StringUtils.convertSetToArray(headerData.keySet())); //SET DATASOURCE tbl.setContainerDataSource(container); tbl.setWidth("100%"); tbl.setHeight("-1px"); tbl.setFilterDecorator(new DefaultFilterDecorator()); tbl.setFilterGenerator(new DefaultFilterGenerator()); tbl.setSortEnabled(true); tbl.setFilterBarVisible(viewSearchBar); tbl.setSelectable(true); tbl.setImmediate(true); tbl.setMultiSelect(true); tbl.setColumnCollapsingAllowed(true); tbl.setColumnReorderingAllowed(true); pagedFilterControlConfigDefaul defaultConfig = new pagedFilterControlConfigDefaul(); switch (tblSize) { case 0: tbl.setPageLength(Integer.valueOf(Constants.PAGE_SIZE_DEFAULT_5)); break; case -1: tbl.createControls(1); break; default: verTbl.addComponent(tbl.createControls(defaultConfig, String.valueOf(tblSize))); break; } tbl.setVisibleColumns((Object[]) StringUtils.convertSetToArray(headerData.keySet())); tblPn.getHorizoltalLayout().setVisible(isShowBtnSave || isShowBtnAdd || isShowBtnDelete); tblPn.getBtnAdd().setVisible(false); tblPn.getBtnSave().setVisible(false); tblPn.getBtnDelelete().setVisible(false); container.setItemSorter(new ItemSorter() { String propertyID = ""; boolean sort = false; @Override public void setSortProperties(Container.Sortable container, Object[] propertyId, boolean[] ascending) { propertyID = (String) propertyId[0]; sort = ascending[0]; } @Override public int compare(Object itemId1, Object itemId2) { Class<?> c = itemId1.getClass(); if (propertyID.contains("Date") || propertyID.contains("Time")) { try { Method methodId = c.getMethod(DataUtil.getGetterOfColumn(propertyID)); Date date1 = DateTimeUtils.dateTimeCompare((String) methodId.invoke(itemId1)); Date date2 = DateTimeUtils.dateTimeCompare((String) methodId.invoke(itemId2)); if (date1 == null) { return sort ? -1 : 1; } if (date2 == null) { return sort ? 1 : -1; } return sort ? date1.compareTo(date2) : date2.compareTo(date1); } catch (NoSuchMethodException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } } else { try { Method mt = c.getMethod(DataUtil.getGetterOfColumn(propertyID)); String value1 = (String) mt.invoke(itemId1); if (value1 == null) { value1 = ""; } String value2 = (String) mt.invoke(itemId2); if (value2 == null) { value2 = ""; } return sort ? value1.compareTo(value2) : value2.compareTo(value1); } catch (NoSuchMethodException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } } return 1; } }); if (tblPn.getDeleteButton().isVisible() && isActionDelele) { tblPn.getDeleteButton().addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { final List<Object> lstId = new ArrayList<>(); if (tbl.getValue() != null) { if (tbl.isMultiSelect()) { lstId.addAll((Collection<? extends Object>) tbl.getValue()); } else { lstId.add(tbl.getValue()); } } if (lstId != null && lstId.size() > 0) { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getString("delete.item.title"), BundleUtils.getString("delete.item.body"), BundleUtils.getString("yes"), BundleUtils.getString("no"), new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { // lstId.add(DataUtil.getValueIdFromObject(obj)); String className = container.getBeanType().toString(); String returnValue = DataUtil.deleteObject(lstId, className); if (returnValue.equalsIgnoreCase(Constants.SUCCESS)) { for (Object item : lstId) { tbl.removeItem(item); } tbl.resetPage(); Notification.show(BundleUtils.getString("actionSuccess"), Notification.Type.HUMANIZED_MESSAGE); } else { Notification.show(BundleUtils.getString("actionFail"), Notification.Type.ERROR_MESSAGE); } } } }); } else { Notification.show(BundleUtils.getString("chooseOneRecord"), Notification.Type.WARNING_MESSAGE); } tblPn.getDeleteButton().setEnabled(true); } }); } }
From source file:com.cms.utils.CommonUtils.java
public static Panel addOg2Panel(OptionGroup og, String caption, String height) { og.setWidth("100%"); og.setHeight("-1px"); og.setImmediate(true);/*from w ww . ja va 2 s. co m*/ og.setMultiSelect(true); VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined(); layout.setImmediate(true); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(og); layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT); Panel panel = new Panel(); if (!DataUtil.isStringNullOrEmpty(caption)) { panel.setCaption(caption); } panel.setWidth("100%"); panel.setImmediate(true); if (!DataUtil.isStringNullOrEmpty(height)) { panel.setHeight(height); } else { panel.setHeight("200px"); } panel.addStyleName(Runo.PANEL_LIGHT); panel.setContent(layout); return panel; }
From source file:com.coatl.pruebas.MyUI.java
@Override protected void init(VaadinRequest vaadinRequest) { final VerticalLayout layout = new VerticalLayout(); final TextField name = new TextField(); name.setCaption("Escribe algo aqu:"); Button button = new Button("Dime que escrib"); button.addClickListener(new Button.ClickListener() { @Override//from ww w .ja v a 2 s. co m public void buttonClick(Button.ClickEvent event) { System.out.println("Click!"); layout.addComponent(new Label("Usted escribi> " + name.getValue())); } }); layout.addComponents(name, button); layout.setMargin(true); layout.setSpacing(true); setContent(layout); }