List of usage examples for com.vaadin.ui TabSheet setSizeFull
@Override public void setSizeFull()
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; }//from w w w . j a v a2 s . c om 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.expressui.core.view.util.CodePopup.java
License:Open Source License
/** * Opens popup for given classes.// w w w .ja v a 2s .c om * * @param classes classes for displaying related source code and Javadoc. If * class is within com.expressui.core or com.expressui.domain, * then Javadoc is displayed, otherwise source code. */ public void open(Class... classes) { Window codeWindow = new Window(); codeWindow.addStyleName("code-popup"); codeWindow.setPositionX(20); codeWindow.setPositionY(40); codeWindow.setWidth("90%"); codeWindow.setHeight("90%"); TabSheet codePopupTabSheet = new TabSheet(); String id = StringUtil.generateDebugId("e", this, codePopupTabSheet, "codePopupTabSheet"); codePopupTabSheet.setDebugId(id); codePopupTabSheet.setSizeFull(); codeWindow.addComponent(codePopupTabSheet); String windowCaption = ""; Set<String> shownUrls = new HashSet<String>(); for (Class clazz : classes) { String tabCaption; String url; if (clazz.getName().startsWith("com.expressui.core") || clazz.getName().startsWith("com.expressui.domain")) { url = applicationProperties.getDocUrl(clazz); if (shownUrls.contains(url)) continue; tabCaption = clazz.getSimpleName() + " API"; Embedded embedded = getEmbeddedDoc(url); codePopupTabSheet.addTab(embedded, tabCaption); } else { url = applicationProperties.getCodeUrl(clazz); if (shownUrls.contains(url)) continue; tabCaption = clazz.getSimpleName() + ".java"; String code = getCodeContents(url); Label label = new CodeLabel(code); codePopupTabSheet.addTab(label, tabCaption); } shownUrls.add(url); if (windowCaption.length() > 0) windowCaption += ", "; windowCaption += tabCaption; } codeWindow.setCaption(windowCaption); MainApplication.getInstance().getMainWindow().addWindow(codeWindow); }
From source file:com.github.mjvesa.herd.HerdIDE.java
License:Apache License
private TabSheet constructFilesAndStatus() { TabSheet tabs = new TabSheet(); tabs.setSizeFull(); tabs.addTab(constructFilesTab(), "Files", null); tabs.addTab(constructStatusTab(), "Status", null); return tabs;// w w w . j a v a2 s . c om }
From source file:com.github.mjvesa.herd.HerdIDE.java
License:Apache License
private Component constructEditorAndLayout() { TabSheet ts = new TabSheet(); ts.setSizeFull(); ts.addTab(constructEditorTab(), "Editor", null); ts.addTab(constructOutputTab(), "Output", null); return ts;//w w w . ja v a2s. c o m }
From source file:com.hris.payroll.PayrollUI.java
private void getPayrollTab() { TabSheet tab = new TabSheet(); tab.setSizeFull(); VerticalLayout v = new VerticalLayout(); v.setSizeFull();/*from w ww . j ava 2 s.c o m*/ v.addComponent(ledger); tab.addTab(v, "Payroll Ledger"); v = new VerticalLayout(); v.setSizeFull(); tab.addTab(v, "Payroll Register"); v = new VerticalLayout(); v.setSizeFull(); v.addComponent(tm); tab.addTab(v, "13th Month"); v = new VerticalLayout(); v.setSizeFull(); v.addComponent(al); tab.addTab(v, "Alpha List"); v = new VerticalLayout(); v.setSizeFull(); v.addComponent(reportUI); tab.addTab(v, "Reports"); addComponent(tab); }
From source file:com.lst.deploymentautomation.vaadin.popup.TodoDetails.java
License:Open Source License
@Override public void attach() { super.attach(); LspsUI ui = (LspsUI) getUI();/*from w w w .j a va 2 s . c om*/ setCaption(ui.getMessage("todo.detailsTitle")); TabSheet tabs = new TabSheet(); tabs.setSizeFull(); tabs.addTab(createTodoInfo(ui), ui.getMessage("todo.header")); tabs.addTab(createProcessInfo(ui), ui.getMessage("process.header")); setContent(tabs); // Button close = new Button("Close", new Button.ClickListener() { // // inline click-listener // public void buttonClick(ClickEvent event) { // // close the window by removing it from the parent window // (subwindow.getParent()).removeWindow(subwindow); // } // }); // // The components added to the window are actually added to the window's // // layout; you can use either. Alignments are set using the layout // layout.addComponent(close); // layout.setComponentAlignment(close, Alignment.TOP_RIGHT); }
From source file:com.openhris.employee.EmployeeInformationUI.java
public ComponentContainer employeeInformationWindow() { TabSheet ts = new TabSheet(); ts.setSizeFull(); ts.addStyleName("bar"); VerticalLayout vlayout = new VerticalLayout(); vlayout.setCaption("Personal Information"); vlayout.addComponent(employeePersonalInformation); vlayout.setComponentAlignment(employeePersonalInformation, Alignment.MIDDLE_LEFT); ts.addComponent(vlayout);/*from w w w . j a va 2s .c om*/ vlayout = new VerticalLayout(); vlayout.setCaption("Address"); vlayout.addComponent(employeeAddress); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Character Reference"); vlayout.addComponent(characterReference); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Dependent(s)"); // vlayout.addComponent(employeePersonalInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Educational Background"); // vlayout.addComponent(employeePersonalInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Post Employment Info"); vlayout.addComponent(postEmploymentInfomation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Work History"); // vlayout.addComponent(employeePersonalInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Salary Information"); vlayout.addComponent(employeeSalaryInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Allowance Information"); vlayout.addComponent(employeeAllowanceInformation); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setCaption("Other Information"); vlayout.addComponent(otherInformation); ts.addComponent(vlayout); return ts; }
From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleView.java
License:Open Source License
@PostConstruct public void createView() { setMargin(true);/*www . j a v a 2 s . c om*/ setSpacing(true); /* Page.Styles styles = Page.getCurrent().getStyles(); styles.add(".no-padding {padding: 0em 0em 0em 0em !important; }"); */ HorizontalLayout header = new HorizontalLayout(); // header.setWidth("100%"); header.setSpacing(true); header.setMargin(true); Label title = new Label("OSGi Bundles"); title.addStyleName("h1"); // title.setSizeUndefined(); header.addComponent(title); header.setComponentAlignment(title, Alignment.MIDDLE_LEFT); final TextField filter = new TextField(); filter.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(final FieldEvents.TextChangeEvent event) { data.removeAllContainerFilters(); String trimmed = event.getText().trim(); Container.Filter or = new Or(new SimpleStringFilter(BUNDLE_ID_COLUMN, trimmed, true, false), new SimpleStringFilter(BUNDLE_NAME_COLUMN, trimmed, true, false), new SimpleStringFilter(BUNDLE_SYMBOLICNAME_COLUMN, trimmed, true, false), new SimpleStringFilter(VERSION_COLUMN, trimmed, true, false), new SimpleStringFilter(PRETTY_STATE_COLUMN, trimmed, true, false)); data.addContainerFilter(or); } }); filter.setInputPrompt("Filter"); filter.addShortcutListener(new ShortcutListener("Clear", ShortcutAction.KeyCode.ESCAPE, null) { @Override public void handleAction(Object sender, Object target) { filter.setValue(""); data.removeAllContainerFilters(); } }); header.addComponent(filter); header.setExpandRatio(filter, 1); header.setComponentAlignment(filter, Alignment.MIDDLE_LEFT); // Store the header in the vertical layout (this) addComponent(header); addComponent(tabSheet); table = new Table(); table.setContainerDataSource(data); table.setSizeFull(); table.setSortContainerPropertyId(BUNDLE_ID_COLUMN); table.setSortAscending(true); table.setImmediate(true); table.setColumnHeader(BUNDLE_ID_COLUMN, "Bundle ID"); table.setColumnHeader(PRETTY_NAME_COLUMN, "Bundle Name"); table.setColumnHeader(VERSION_COLUMN, "Version"); table.setColumnHeader(PRETTY_STATE_COLUMN, "State"); table.setColumnHeader("actions", "Actions"); table.setColumnWidth(BUNDLE_ID_COLUMN, 100); table.setColumnAlignment(BUNDLE_ID_COLUMN, Table.Align.CENTER); table.setColumnAlignment(PRETTY_STATE_COLUMN, Table.Align.CENTER); table.setColumnAlignment(VERSION_COLUMN, Table.Align.CENTER); table.addGeneratedColumn("actions", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { HorizontalLayout layout = new HorizontalLayout(); BeanItem<BundleItem> item = (BeanItem<BundleItem>) source.getContainerDataSource().getItem(itemId); Bundle bundle = item.getBean().getBundle(); if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) { Button changeState = new Button(); changeState.addClickListener(new StartBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Start"); //changeState.setIcon(new ClassResource(BundleViewer.class, "/images/go-next.png")); if (!securityManager.isUserInRole("admin")) { changeState.setDisableOnClick(true); } layout.addComponent(changeState); } if (BundleHelper.isState(bundle, Bundle.ACTIVE)) { Button changeState = new Button(); changeState.addClickListener(new StopBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Stop"); if (!securityManager.isUserInRole("admin")) { changeState.setDisableOnClick(true); } //changeState.setIcon(new ClassResource(BundleViewer.class, "/images/media-record.png")); layout.addComponent(changeState); } // Update Button update = new Button(); update.addClickListener(new UpdateBundleClickListener(bundle, notifierService)); //update.addStyleName("no-padding"); update.setCaption("Update"); if (!securityManager.isUserInRole("admin")) { update.setDisableOnClick(true); } //update.setIcon(new ClassResource(BundleViewer.class, "/images/view-refresh.png")); layout.addComponent(update); // Trash Button trash = new Button(); trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService)); //trash.addStyleName("no-padding"); trash.setCaption("Delete"); if (!securityManager.isUserInRole("admin")) { trash.setDisableOnClick(true); } //trash.setIcon(new ClassResource(BundleViewer.class, "/images/user-trash-full.png")); layout.addComponent(trash); return layout; } }); table.setVisibleColumns(BUNDLE_ID_COLUMN, PRETTY_NAME_COLUMN, VERSION_COLUMN, PRETTY_STATE_COLUMN, "actions"); table.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(final ItemClickEvent event) { if (event.isDoubleClick()) { BeanItem<BundleItem> item = (BeanItem<BundleItem>) table.getContainerDataSource() .getItem(event.getItemId()); Bundle bundle = item.getBean().getBundle(); showBundle(bundle); } } }); createBundleTracker(); tabSheet.setSizeFull(); selectedTabListener = new SelectedTabListener(uiContext.getViewNavigator()); selectedTabListener.addLocation(table, uiContext.getViewNavigator().getLocation(this.getClass().getName())); tabSheet.addSelectedTabChangeListener(selectedTabListener); tabSheet.addTab(table, "Bundles", new ClassResource(BundleView.class, "/images/22x22/user-home.png")); setExpandRatio(tabSheet, 1.5f); tabSheet.setCloseHandler(new TabSheet.CloseHandler() { @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { for (Map.Entry<Long, Component> tab : openTabs.entrySet()) { if (tabContent.equals(tab.getValue())) { openTabs.remove(tab.getKey()); } } tabsheet.removeComponent(tabContent); selectedTabListener.removeLocation(tabContent); } }); }
From source file:com.pms.component.ganttchart.DemoUI.java
License:Apache License
public Component init() { ganttListener = null;/* w w w . j av a 2s . com*/ createGantt(); MenuBar menu = controlsMenuBar(); Panel controls = createControls(); TabSheet tabsheet = new TabSheet(); tabsheet.setSizeFull(); Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(), gantt); if (wrapper instanceof GanttListener) { ganttListener = (GanttListener) wrapper; } final VerticalLayout layout = new VerticalLayout(); layout.setStyleName("demoContentLayout"); layout.setSizeFull(); layout.addComponent(menu); layout.addComponent(controls); layout.addComponent(wrapper); layout.setExpandRatio(wrapper, 1); return layout; }
From source file:com.pms.component.ganttchart.GanttChart.java
License:Apache License
public Component init(Project project) { ganttListener = null;/*w w w. j a v a2 s . c o m*/ createGantt(project); MenuBar menu = controlsMenuBar(); Panel controls = createControls(); TabSheet tabsheet = new TabSheet(); tabsheet.setSizeFull(); Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(), gantt); if (wrapper instanceof GanttListener) { ganttListener = (GanttListener) wrapper; } final VerticalLayout layout = new VerticalLayout(); layout.setStyleName("demoContentLayout"); layout.setSizeFull(); //layout.addComponent(menu); layout.addComponent(controls); layout.addComponent(wrapper); layout.setExpandRatio(wrapper, 1); return layout; }