List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private void createUI() { //create main layout mainLayout = new VerticalLayout(); mainLayout.setWidth("720px"); mainLayout.setSpacing(true);/* w w w . j a v a2s . c om*/ setContent(mainLayout); //create Setting layout settingsPanel = new Panel("Settings"); settingsLayout = new FormLayout(); settingsPanel.setContent(settingsLayout); versionUpgradeProgressIndicator = createProgressIndicator(); changeVersionButton = createChangeVersionButton(); updateVaadinVersionButton = createUpdateVaadinVersionButton(); Version vaadinNewestVersion = newestDownloadInfo.getVersion(); //add details detailsButton = createDetailsButton(); vaadinVersionLayout = createVaadinVersionLayout(vaadinNewestVersion.toString(), changeVersionButton, updateVaadinVersionButton, versionUpgradeProgressIndicator, detailsButton); settingsLayout.addComponent(vaadinVersionLayout); activeWidgetsetLabel = createActiveWidgetsetLabel(); settingsLayout.addComponent(activeWidgetsetLabel); // Add-on selection HorizontalLayout addonDirectoryLayout = createAddonDirectoryLayout(); settingsLayout.addComponent(addonDirectoryLayout); //Add-on included includeAddonsOptionGroup = createIncludeAddonsList(); addonsListHolder = createIncludeAddonsListLayout(includeAddonsOptionGroup); settingsLayout.addComponent(addonsListHolder); //addition dependencies additionalDependenciesLabel = createAdditionalDependenciesLabel(); settingsLayout.addComponent(additionalDependenciesLabel); mainLayout.addComponent(settingsPanel); additionalDependenciesButton = createAdditionalDependenciesButton(); mainLayout.addComponent(additionalDependenciesButton); //Compilation layout HorizontalLayout compilationlayout = new HorizontalLayout(); compileWidgetsetButton = createCompileWidgetsetButton(); compilationlayout.addComponent(compileWidgetsetButton); terminateCompilationButton = createTerminateCompilationButton(); compilationlayout.addComponent(terminateCompilationButton); compilationProgressIndicator = createProgressIndicator(); compilationlayout.addComponent(compilationProgressIndicator); compilationlayout.setComponentAlignment(compilationProgressIndicator, Alignment.MIDDLE_LEFT); settingsLayout.addComponent(compilationlayout); //Output console outputConsole = createOutputConsole(); mainLayout.addComponent(outputConsole); addonsNotFoundLabel = createAddonsNotFoundLabel(); }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private HorizontalLayout createVaadinVersionLayout(String newestVersion, Button changeVersionButton, Button updateVaadinVersionButton, ProgressIndicator versionUpgradeProgressIndicator, Button detailsButton) {/*from w w w . j av a 2 s. c o m*/ HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.setCaption("Vaadin Jar Version"); Label vaadinVersionLabel = new Label(); vaadinVersionLabel.setSizeUndefined(); String version = null; try { version = ControlPanelPortletUtil.getPortalVaadinServerVersion(); } catch (FileNotFoundException e) { log.warn("vaadin-server.jar couldn't be read. file not found."); } catch (IOException e) { log.warn("vaadin-server.jar couldn't be read. ", e); } if (version == null) { try { version = ControlPanelPortletUtil.getPortalVaadin6Version(); } catch (IOException e) { log.warn("vaadin.jar couldn't be read."); } } if (version == null) { version = "could not be determined"; } vaadinVersionLabel.setValue(version); layout.addComponent(vaadinVersionLabel); if (version.startsWith("7")) { layout.addComponent(detailsButton); } layout.addComponent(changeVersionButton); Label newestVaadinVersionLabel = new Label(); newestVaadinVersionLabel.setSizeUndefined(); newestVaadinVersionLabel.setValue("(newest stable version: " + newestVersion + ")"); layout.addComponent(newestVaadinVersionLabel); if (!version.equals(newestVersion)) { layout.addComponent(updateVaadinVersionButton); } layout.addComponent(versionUpgradeProgressIndicator); return layout; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private HorizontalLayout createAddonDirectoryLayout() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/* w w w . jav a 2 s.co m*/ layout.setCaption("Add-on Directory"); addonLibDirLabel = createAddonLibDirLabel(); layout.addComponent(addonLibDirLabel); refreshButton = createRefreshButton(); layout.addComponent(refreshButton); layout.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT); return layout; }
From source file:com.arcusys.liferay.vaadinplugin.ui.ChangeVersionWindow.java
License:Apache License
public ChangeVersionWindow() { super("Change Vaadin version"); setModal(true);/*from w w w . j av a 2s .co m*/ setSizeUndefined(); layout.setMargin(true); layout.setSizeUndefined(); layout.setSpacing(true); setContent(layout); progressIndicator.setCaption("Fetching version list"); includeVersions.setItemCaptionMode(ComboBox.ItemCaptionMode.ID); includeVersions.setMultiSelect(true); includeVersions.setValue(Collections.singleton(DownloadInfo.VaadinReleaseType.release)); includeVersions.setImmediate(true); includeVersions.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { updateFilter(); } }); versionSelection.setItemCaptionPropertyId(VERSION_PROPERTY); versionSelection.setNullSelectionAllowed(false); versionSelection.setRequired(true); //versionFetch.start(); layout.addComponent(includeVersions); layout.addComponent(versionSelection); HorizontalLayout buttonRow = new HorizontalLayout(); buttonRow.setSpacing(true); buttonRow.addComponent(changeVersionButton); buttonRow.addComponent(cancelButton); layout.addComponent(buttonRow); updateState(false); updateFilter(); }
From source file:com.cavisson.gui.dashboard.components.controls.Accordions.java
License:Apache License
public Accordions() { setMargin(true);/* w ww.ja va 2 s . c o m*/ Label h1 = new Label("Accordions"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.setSpacing(true); row.setWidth("100%"); addComponent(row); row.addComponent(getAccordion("Normal")); Accordion ac = getAccordion("Borderless"); ac.addStyleName("borderless"); row.addComponent(ac); }
From source file:com.cavisson.gui.dashboard.components.controls.ButtonsAndLinks.java
License:Apache License
/** * *///from w w w . j av a2 s .c om public ButtonsAndLinks() { setMargin(true); Label h1 = new Label("Buttons"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Button button = new Button("Normal"); row.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); row.addComponent(button); button = new Button("Primary"); button.addStyleName("primary"); row.addComponent(button); button = new Button("Friendly"); button.addStyleName("friendly"); row.addComponent(button); button = new Button("Danger"); button.addStyleName("danger"); row.addComponent(button); TestIcon testIcon = new TestIcon(10); button = new Button("Small"); button.addStyleName("small"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Large"); button.addStyleName("large"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Top"); button.addStyleName("icon-align-top"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Image icon"); button.setIcon(testIcon.get(true, 16)); row.addComponent(button); button = new Button("Image icon"); button.addStyleName("icon-align-right"); button.setIcon(testIcon.get(true)); row.addComponent(button); button = new Button("Photos"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button(); button.setIcon(testIcon.get()); button.addStyleName("icon-only"); row.addComponent(button); button = new Button("Borderless"); button.setIcon(testIcon.get()); button.addStyleName("borderless"); row.addComponent(button); button = new Button("Borderless, colored"); button.setIcon(testIcon.get()); button.addStyleName("borderless-colored"); row.addComponent(button); button = new Button("Quiet"); button.setIcon(testIcon.get()); button.addStyleName("quiet"); row.addComponent(button); button = new Button("Link style"); button.setIcon(testIcon.get()); button.addStyleName("link"); row.addComponent(button); button = new Button("Icon on right"); button.setIcon(testIcon.get()); button.addStyleName("icon-align-right"); row.addComponent(button); CssLayout group = new CssLayout(); group.addStyleName("v-component-group"); row.addComponent(group); button = new Button("One"); group.addComponent(button); button = new Button("Two"); group.addComponent(button); button = new Button("Three"); group.addComponent(button); button = new Button("Tiny"); button.addStyleName("tiny"); row.addComponent(button); button = new Button("Huge"); button.addStyleName("huge"); row.addComponent(button); NativeButton nbutton = new NativeButton("Native"); row.addComponent(nbutton); h1 = new Label("Links"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Link link = new Link("vaadin.com", new ExternalResource("https://vaadin.com")); row.addComponent(link); link = new Link("Link with icon", new ExternalResource("https://vaadin.com")); link.addStyleName("color3"); link.setIcon(testIcon.get()); row.addComponent(link); link = new Link("Small", new ExternalResource("https://vaadin.com")); link.addStyleName("small"); row.addComponent(link); link = new Link("Large", new ExternalResource("https://vaadin.com")); link.addStyleName("large"); row.addComponent(link); link = new Link(null, new ExternalResource("https://vaadin.com")); link.setIcon(testIcon.get()); link.addStyleName("large"); row.addComponent(link); }
From source file:com.cavisson.gui.dashboard.components.controls.CheckBoxes.java
License:Apache License
public CheckBoxes() { setMargin(true);//w w w . j a va2 s . c om Label h1 = new Label("Check Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); CheckBox check = new CheckBox("Checked", true); row.addComponent(check); check = new CheckBox("Checked, explicit width, so that the caption should wrap", true); row.addComponent(check); check.setWidth("150px"); check = new CheckBox("Not checked"); row.addComponent(check); check = new CheckBox(null, true); check.setDescription("No caption"); row.addComponent(check); check = new CheckBox("Custom color", true); check.addStyleName("color1"); row.addComponent(check); TestIcon testIcon = new TestIcon(30); check = new CheckBox("Custom color", true); check.addStyleName("color2"); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox("With Icon", true); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox(); check.setIcon(testIcon.get(true)); row.addComponent(check); check = new CheckBox("Small", true); check.addStyleName("small"); row.addComponent(check); check = new CheckBox("Large", true); check.addStyleName("large"); row.addComponent(check); h1 = new Label("Option Groups"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); OptionGroup options = new OptionGroup("Choose one, explicit width"); options.setWidth("200px"); options.addItem("Option One"); Item two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, explicit width"); options.setMultiSelect(true); options.setWidth("200px"); options.addItem("Option One"); two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, small"); options.addStyleName("small"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, small"); options.addStyleName("small"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, large"); options.addStyleName("large"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, large"); options.addStyleName("large"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Horizontal items"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); options = new OptionGroup("Horizontal items, explicit width"); options.setMultiSelect(true); options.setWidth("500px"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); }
From source file:com.cavisson.gui.dashboard.components.controls.ColorPickers.java
License:Apache License
public ColorPickers() { setMargin(true);// w ww. j a v a 2s .c o m Label h1 = new Label("Color Pickers"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(40); ColorPicker cp = new ColorPicker(); cp.setDefaultCaptionEnabled(true); cp.setIcon(testIcon.get()); cp.setColor(new Color(138, 73, 115)); row.addComponent(cp); cp = new ColorPicker(); cp.setPopupStyle(PopupStyle.POPUP_SIMPLE); cp.setTextfieldVisibility(true); row.addComponent(cp); }
From source file:com.cavisson.gui.dashboard.components.controls.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);/* w w w .ja v a2 s.c om*/ Label h1 = new Label("Combo Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); ComboBox combo = new ComboBox("Normal"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png")); row.addComponent(combo); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); combo = new ComboBox(); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setWidth("240px"); group.addComponent(combo); Button today = new Button("Do It"); group.addComponent(today); combo = new ComboBox("Explicit size"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setWidth("260px"); combo.setHeight("60px"); row.addComponent(combo); combo = new ComboBox("No text input allowed"); combo.setInputPrompt("You can click here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setTextInputAllowed(false); combo.setNullSelectionAllowed(false); combo.select("Option One"); row.addComponent(combo); combo = new ComboBox("Error"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); row.addComponent(combo); combo = new ComboBox("Error, borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Disabled"); combo.setInputPrompt("You can't type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setEnabled(false); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("large"); row.addComponent(combo); combo = new ComboBox("Borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Tiny"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
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 w w. ja v a 2 s. c o 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; }