List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:org.sensorhub.ui.AdminUI.java
License:Mozilla Public License
@Override protected void init(VaadinRequest request) { String configClass = null;//from ww w .jav a2 s . co m moduleConfigLists.clear(); // retrieve module config try { Properties initParams = request.getService().getDeploymentConfiguration().getInitParameters(); String moduleID = initParams.getProperty(AdminUIModule.SERVLET_PARAM_MODULE_ID); uiConfig = (AdminUIConfig) SensorHub.getInstance().getModuleRegistry().getModuleById(moduleID) .getConfiguration(); } catch (Exception e) { throw new RuntimeException("Cannot get UI module configuration", e); } try { // load default form builders customForms.put(HttpServerConfig.class.getCanonicalName(), HttpServerConfigForm.class); customForms.put(StreamStorageConfig.class.getCanonicalName(), GenericStorageConfigForm.class); customForms.put(CommConfig.class.getCanonicalName(), CommConfigForm.class); customForms.put(SOSConfigForm.SOS_PACKAGE + "SOSServiceConfig", SOSConfigForm.class); customForms.put(SOSConfigForm.SOS_PACKAGE + "SOSProviderConfig", SOSConfigForm.class); // load custom form builders defined in config for (CustomUIConfig customForm : uiConfig.customForms) { configClass = customForm.configClass; Class<?> clazz = Class.forName(customForm.uiClass); customForms.put(configClass, (Class<IModuleConfigForm>) clazz); log.debug("Loaded custom form for " + configClass); } } catch (Exception e) { log.error("Error while instantiating form builder for config class " + configClass, e); } try { // load default panel builders customPanels.put(SensorConfig.class.getCanonicalName(), SensorAdminPanel.class); customPanels.put(StorageConfig.class.getCanonicalName(), StorageAdminPanel.class); // load custom panel builders defined in config for (CustomUIConfig customPanel : uiConfig.customPanels) { configClass = customPanel.configClass; Class<?> clazz = Class.forName(customPanel.uiClass); customPanels.put(configClass, (Class<IModuleAdminPanel<?>>) clazz); log.debug("Loaded custom panel for " + configClass); } } catch (Exception e) { log.error("Error while instantiating panel builder for config class " + configClass, e); } // register new field converter for interger numbers @SuppressWarnings("serial") ConverterFactory converterFactory = new DefaultConverterFactory() { @Override protected <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> findConverter( Class<PRESENTATION> presentationType, Class<MODEL> modelType) { // Handle String <-> Integer/Short/Long if (presentationType == String.class && (modelType == Long.class || modelType == Integer.class || modelType == Short.class)) { return (Converter<PRESENTATION, MODEL>) new StringToIntegerConverter() { @Override protected NumberFormat getFormat(Locale locale) { NumberFormat format = super.getFormat(Locale.US); format.setGroupingUsed(false); return format; } }; } // Let default factory handle the rest return super.findConverter(presentationType, modelType); } }; VaadinSession.getCurrent().setConverterFactory(converterFactory); // init main panels HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setMinSplitPosition(300.0f, Unit.PIXELS); splitPanel.setMaxSplitPosition(30.0f, Unit.PERCENTAGE); splitPanel.setSplitPosition(350.0f, Unit.PIXELS); setContent(splitPanel); // build left pane VerticalLayout leftPane = new VerticalLayout(); leftPane.setSizeFull(); // header image and title Component header = buildHeader(); leftPane.addComponent(header); leftPane.setExpandRatio(header, 0); // toolbar Component toolbar = buildToolbar(); leftPane.addComponent(toolbar); leftPane.setExpandRatio(toolbar, 0); // accordion with several sections Accordion stack = new Accordion(); stack.setSizeFull(); VerticalLayout layout; Tab tab; layout = new VerticalLayout(); tab = stack.addTab(layout, "Sensors"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, SensorConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Storage"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, StorageConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Processing"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, ProcessConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Services"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, ServiceConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Clients"); tab.setIcon(ACC_TAB_ICON); buildModuleList(layout, ClientConfig.class); layout = new VerticalLayout(); tab = stack.addTab(layout, "Network"); tab.setIcon(ACC_TAB_ICON); buildNetworkConfig(layout); leftPane.addComponent(stack); leftPane.setExpandRatio(stack, 1); splitPanel.addComponent(leftPane); // init config area configArea = new VerticalLayout(); configArea.setMargin(true); splitPanel.addComponent(configArea); }
From source file:org.sensorhub.ui.AdminUI.java
License:Mozilla Public License
@SuppressWarnings("serial") protected void displayModuleList(VerticalLayout layout, final MyBeanItemContainer<ModuleConfig> container, final Class<?> configType) { // create table to display module list final Table table = new Table(); table.setSizeFull();/*from ww w . ja va 2 s. c o m*/ table.setSelectable(true); table.setImmediate(true); table.setColumnReorderingAllowed(false); table.setContainerDataSource(container); table.setVisibleColumns(new Object[] { UIConstants.PROP_NAME, UIConstants.PROP_ENABLED }); table.setColumnWidth(UIConstants.PROP_ENABLED, 100); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); // value converter for enabled field table.setConverter(UIConstants.PROP_ENABLED, new Converter<String, Boolean>() { @Override public Boolean convertToModel(String value, Class<? extends Boolean> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { return (value != null && value.equals("enabled")); } @Override public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException { return value ? "enabled" : "disabled"; } @Override public Class<Boolean> getModelType() { return boolean.class; } @Override public Class<String> getPresentationType() { return String.class; } }); table.setCellStyleGenerator(new CellStyleGenerator() { @Override public String getStyle(Table source, Object itemId, Object propertyId) { if (propertyId != null && propertyId.equals(UIConstants.PROP_ENABLED)) { boolean val = (boolean) table.getItem(itemId).getItemProperty(propertyId).getValue(); if (val == true) return "green"; else return "red"; } return null; } }); // item click listener to display selected module settings table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { openModuleInfo((MyBeanItem<ModuleConfig>) event.getItem()); } }); layout.addComponent(table); // context menu table.addActionHandler(new Handler() { @Override public Action[] getActions(Object target, Object sender) { List<Action> actions = new ArrayList<Action>(10); if (target != null) { boolean enabled = ((MyBeanItem<ModuleConfig>) table.getItem(target)).getBean().enabled; if (enabled) actions.add(DISABLE_MODULE_ACTION); else actions.add(ENABLE_MODULE_ACTION); actions.add(REMOVE_MODULE_ACTION); } else { if (configType != null) actions.add(ADD_MODULE_ACTION); } return actions.toArray(new Action[0]); } @Override public void handleAction(Action action, Object sender, Object target) { final Object selectedId = table.getValue(); if (action == ADD_MODULE_ACTION) { // show popup to select among available module types ModuleTypeSelectionPopup popup = new ModuleTypeSelectionPopup(configType, new ModuleTypeSelectionCallback() { public void configSelected(Class<?> moduleType, ModuleConfig config) { try { // add to main config ModuleRegistry reg = SensorHub.getInstance().getModuleRegistry(); reg.loadModule(config); } catch (Exception e) { String msg = "The module could not be initialized"; Notification.show("Error", msg + '\n' + e.getMessage(), Notification.Type.ERROR_MESSAGE); } MyBeanItem<ModuleConfig> newBeanItem = container.addBean(config); openModuleInfo(newBeanItem); } }); popup.setModal(true); addWindow(popup); } else if (selectedId != null) { // possible actions when a module is selected final Item item = table.getItem(selectedId); final String moduleId = (String) item.getItemProperty(UIConstants.PROP_ID).getValue(); final String moduleName = (String) item.getItemProperty(UIConstants.PROP_NAME).getValue(); if (action == REMOVE_MODULE_ACTION) { final ConfirmDialog popup = new ConfirmDialog("Are you sure you want to remove module " + moduleName + "?</br>All settings will be lost."); popup.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { if (popup.isConfirmed()) { try { SensorHub.getInstance().getModuleRegistry().destroyModule(moduleId); container.removeItem(selectedId); } catch (SensorHubException ex) { String msg = "The module could not be removed"; Notification.show("Error", msg + '\n' + ex.getMessage(), Notification.Type.ERROR_MESSAGE); AdminUI.log.debug(msg, e); } } } }); addWindow(popup); } else if (action == ENABLE_MODULE_ACTION) { final ConfirmDialog popup = new ConfirmDialog( "Are you sure you want to enable module " + moduleName + "?"); popup.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { if (popup.isConfirmed()) { try { SensorHub.getInstance().getModuleRegistry().enableModule(moduleId); item.getItemProperty(UIConstants.PROP_ENABLED).setValue(true); openModuleInfo((MyBeanItem<ModuleConfig>) item); } catch (SensorHubException ex) { String msg = "The module could not be enabled"; Notification.show("Error", msg + '\n' + ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } } }); addWindow(popup); } else if (action == DISABLE_MODULE_ACTION) { final ConfirmDialog popup = new ConfirmDialog( "Are you sure you want to disable module " + moduleName + "?"); popup.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { if (popup.isConfirmed()) { try { SensorHub.getInstance().getModuleRegistry().disableModule(moduleId); item.getItemProperty(UIConstants.PROP_ENABLED).setValue(false); } catch (SensorHubException ex) { String msg = "The module could not be disabled"; Notification.show("Error", msg + '\n' + ex.getMessage(), Notification.Type.ERROR_MESSAGE); } } } }); addWindow(popup); } } } }); layout.setSizeFull(); }
From source file:org.sensorhub.ui.SensorAdminPanel.java
License:Mozilla Public License
protected Panel newPanel(String title) { Panel panel = new Panel(title); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true);// ww w. j a v a 2s . c om layout.setSpacing(true); layout.setDefaultComponentAlignment(Alignment.TOP_LEFT); panel.setContent(layout); return panel; }
From source file:org.tltv.gantt.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { ganttListener = null;//from w w w. java 2 s. c o m 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); setContent(layout); }
From source file:org.universAAL.ucc.controller.desktop.ToolController.java
public void buttonClick(ClickEvent event) { if (event.getButton() == toolWin.getuStoreButton()) { Embedded em = new Embedded("", new ExternalResource(createLink())); em.setType(Embedded.TYPE_BROWSER); em.setWidth("100%"); em.setHeight("850px"); Window w = new Window("uStore"); w.setWidth("1250px"); w.setHeight("800px"); VerticalLayout v = new VerticalLayout(); w.center();/*from www . ja v a 2 s. c om*/ v.addComponent(em); w.setContent(v); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(w); } if (event.getButton() == toolWin.getOpenAAL()) { // Embedded em = new Embedded("", new ExternalResource( // "http://wiki.openaal.org")); // em.setType(Embedded.TYPE_BROWSER); // em.setWidth("100%"); // em.setHeight("800px"); // Window w = new Window("openAAL"); // w.setWidth("1250px"); // w.setHeight("800px"); // VerticalLayout v = new VerticalLayout(); // w.center(); // v.addComponent(em); // w.setContent(v); BrowseServicesWindow pw = new BrowseServicesWindow(app); PurchasedServicesController pc = new PurchasedServicesController(pw, app); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(pw); } if (event.getButton() == toolWin.getInstallButton()) { // Later uncomment again only for testing commented out! Upload up = new Upload("", new AALServiceReceiver()); up.setButtonCaption(res.getString("install.button")); up.addListener((Upload.FinishedListener) this); up.addListener((Upload.FailedListener) this); installWindow = new Window(res.getString("install.win.caption")); installWindow.setResizable(false); installWindow.center(); installWindow.setWidth("400px"); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.setSpacing(true); v.setMargin(true); v.addComponent(up); installWindow.setContent(v); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(installWindow); } if (event.getButton() == toolWin.getLogoutButton()) { DesktopController.setCurrentPassword(""); DesktopController.setCurrentUser(""); // if(!DesktopController.web.getSocket().isClosed()) { // try { // DesktopController.web.getSocket().close(); // } catch (IOException e) { // e.printStackTrace(); // } // } app.close(); } if (event.getButton() == toolWin.getUninstallButton()) { app.getMainWindow().removeWindow(toolWin); List<RegisteredService> ids = new ArrayList<RegisteredService>(); Document doc = Model.getSrvDocument(); NodeList nodeList = doc.getElementsByTagName("service"); for (int i = 0; i < nodeList.getLength(); i++) { RegisteredService srv = new RegisteredService(); Element element = (Element) nodeList.item(i); System.err.println(element.getAttribute("serviceId")); srv.setServiceId(element.getAttribute("serviceId")); NodeList srvChilds = element.getChildNodes(); for (int j = 0; j < srvChilds.getLength(); j++) { Node n = srvChilds.item(j); if (n.getNodeName().equals("application")) { Element e = (Element) n; srv.getAppId().add(e.getAttribute("appId")); } if (n.getNodeName().equals("bundle")) { Element b = (Element) n; srv.getBundleId().add(b.getAttribute("id")); srv.setBundleVersion(b.getAttribute("version")); } if (n.getNodeName().equals("menuEntry")) { Element e = (Element) n; srv.setMenuName(e.getAttribute("entryName")); srv.setIconURL(e.getAttribute("iconURL")); srv.setProvider(e.getAttribute("vendor")); srv.setServiceClass(e.getAttribute("serviceClass")); srv.setUserID(e.getAttribute("userID")); } } ids.add(srv); } DeinstallWindow dw = new DeinstallWindow(ids); app.getMainWindow().addWindow(dw); DeinstallController dc = new DeinstallController(dw, app); // frontend.uninstallService(Activator.getSessionKey(), "28002"); // frontend.getInstalledUnitsForService(Activator.getSessionKey(), "28002"); } if (event.getButton() == toolWin.getPersonButton()) { AddNewPersonWindow apw = null; try { apw = new AddNewPersonWindow(null, null, app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(apw); } if (event.getButton() == toolWin.getConfigButton()) { AddNewHardwareWindow anhw = null; try { anhw = new AddNewHardwareWindow(null, null, app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(anhw); } if (event.getButton() == toolWin.getEditHW()) { RoomsWindow hardWare = null; try { hardWare = new RoomsWindow(app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(hardWare); } if (event.getButton() == toolWin.getEditPerson()) { HumansWindow hw = null; try { hw = new HumansWindow(app); } catch (JAXBException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(hw); } if (event.getButton() == toolWin.getEditUC()) { WhichBundleShouldBeConfiguredWindow uc = new WhichBundleShouldBeConfiguredWindow("Use Cases"); app.getMainWindow().removeWindow(toolWin); app.getMainWindow().addWindow(uc); } }
From source file:org.vaadin.addonhelpers.TListUi.java
License:Apache License
private void loadTestClasses(TListUi aThis) { if (testClassess != null) { return;/*from ww w . j a v a 2 s . co m*/ } testClassess = listTestClasses(); Table table = new Table("Test cases", testClassess); table.setVisibleColumns("name", "description"); table.addGeneratedColumn("name", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); Class clazz = (Class) source.getItem(itemId).getItemProperty("clazz").getValue(); Link link = new Link(); link.setResource(new ExternalResource("/" + clazz.getName())); link.setCaption(name); link.setTargetName("_new"); return link; } }); table.addGeneratedColumn("description", new Table.ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue(); return new Label(description); } }); table.setSizeFull(); table.setColumnExpandRatio("description", 1); VerticalLayout verticalLayout = new VerticalLayout(); TextField filter = new TextField(); filter.setInputPrompt("Filter list"); filter.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { String text = event.getText(); testClassess.removeAllContainerFilters(); testClassess.addContainerFilter("name", text, true, false); } }); verticalLayout.addComponent(filter); filter.focus(); verticalLayout.addComponent(table); verticalLayout.setSizeFull(); verticalLayout.setExpandRatio(table, 1); verticalLayout.setMargin(true); setContent(verticalLayout); }
From source file:org.vaadin.addons.criteriacontainersample.AbstractEntityApplication.java
License:Apache License
@Override public void init() { Window mainWindow = new Window("Lazycontainer Application"); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setMargin(true);/*from w ww . j a v a 2s . c om*/ mainLayout.setSpacing(true); createFilterPanel(mainLayout); entityManager = ENTITY_MANAGER_FACTORY.createEntityManager(); criteriaContainer = createTaskContainer(); int size = criteriaContainer.size(); if (size == 0 && TESTING) { createEntities(); criteriaContainer.refresh(); size = criteriaContainer.size(); } createTable(criteriaContainer); table.setPageLength(0); table.setSizeUndefined(); table.setHeight("100%"); mainLayout.addComponent(table); mainLayout.setExpandRatio(table, 100.0F); mainWindow.setContent(mainLayout); setMainWindow(mainWindow); }
From source file:org.vaadin.addons.filterbuilder.FilterBuilderUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("FilterBuilder demo"); HorizontalSplitPanel content = new HorizontalSplitPanel(); content.setSizeFull();/*www . j a va 2s. c o m*/ // Left pane leftPane = new VerticalLayout(); { leftPane.setSizeFull(); leftPane.setMargin(true); leftPane.setSpacing(true); filterField = new TextField(); filterField.setInputPrompt("Write your filter here"); filterField.setIcon(FontAwesome.SEARCH); filterField.addStyleName("filter-field inline-icon"); filterField.setWidth(100, Unit.PERCENTAGE); filterField.setTextChangeEventMode(TextField.TextChangeEventMode.LAZY); filterField.setTextChangeTimeout(1000); filterField.addTextChangeListener(this); leftPane.addComponent(filterField); filterLabel = new Label(); filterLabel.setWidth(100, Unit.PERCENTAGE); try { dataSource = new BeanItemContainer<>(TestCaseBean.class, TestCaseBean.loadMockData()); dataSource.removeContainerProperty("address"); dataSource.addNestedContainerProperty("address.country"); dataSource.addNestedContainerProperty("address.city"); dataSource.addNestedContainerProperty("address.street"); dataSource.addNestedContainerProperty("address.address"); } catch (Exception e) { logger.error("Could not load mock data"); } table = new Table(null, dataSource); table.setSizeFull(); table.setVisibleColumns("id", "firstName", "lastName", "jobTitle", "dob", "salary", "address.country", "address.city", "address.street", "address.address", "unemployed"); table.setSelectable(true); leftPane.addComponent(table); leftPane.setExpandRatio(table, 1); } content.setFirstComponent(leftPane); // Right pane rightPane = new TabSheet(); { rightPane.setSizeFull(); VerticalLayout lastUsedFiltersPane = new VerticalLayout(); lastUsedFiltersPane.setSizeFull(); lastUsedFiltersPane.setMargin(true); lastUsedFiltersPane.setSpacing(true); lastUsedFilters = new IndexedContainer(); lastUsedFilters.addContainerProperty("filter", String.class, null); lastUsedFiltersTable = new Table(); lastUsedFiltersTable.setSizeFull(); lastUsedFiltersTable.setContainerDataSource(lastUsedFilters); lastUsedFiltersTable.setSortEnabled(false); lastUsedFiltersTable.setSelectable(true); lastUsedFiltersTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); lastUsedFiltersTable.addItemClickListener(this); final Button removeFilterButton = new Button("Remove", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (lastUsedFiltersTable.getValue() != null) { lastUsedFilters.removeItem(lastUsedFiltersTable.getValue()); lastUsedFiltersTable.setValue(null); } } }); removeFilterButton.setEnabled(false); lastUsedFiltersTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { removeFilterButton.setEnabled(lastUsedFiltersTable.getValue() != null); } }); lastUsedFiltersPane.addComponents(lastUsedFiltersTable, removeFilterButton); lastUsedFiltersPane.setExpandRatio(lastUsedFiltersTable, 1); rightPane.addTab(lastUsedFiltersPane).setCaption("Last used filters"); VerticalLayout dateFormatsPane = new VerticalLayout(); dateFormatsPane.setMargin(true); dateFormats = new IndexedContainer(); dateFormats.addContainerProperty("format", String.class, null); for (SimpleDateFormat dateFormat : FilterBuilder.DATE_FORMATS) { final Item item = dateFormats.addItem(dateFormat.toPattern()); item.getItemProperty("format").setValue(dateFormat.toPattern()); } dateFormatsTable = new Table(); dateFormatsTable.setWidth(100, Unit.PERCENTAGE); dateFormatsTable.setContainerDataSource(dateFormats); dateFormatsTable.setSortEnabled(false); dateFormatsTable.setSelectable(true); dateFormatsTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); dateFormatsPane.addComponent(dateFormatsTable); rightPane.addTab(dateFormatsPane).setCaption("Known date formats"); } VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); content.setSecondComponent(rightPane); content.setSplitPosition(80, Unit.PERCENTAGE); setContent(content); logger.debug("UI initialized"); }
From source file:org.vaadin.addons.serverpush.samples.chat.ManualPushChatApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Chat Application"); setMainWindow(mainWindow);//from w ww. j av a 2s.c om VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(this.header); this.comboBox.setWidth("400px"); this.comboBox.addListener(new Container.ItemSetChangeListener() { public void containerItemSetChange(Container.ItemSetChangeEvent event) { push(); } }); this.comboBox.addListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { fireNewTab((User) event.getProperty().getValue(), (User) getUser()); } }); this.comboBox.setItemCaptionPropertyId("username"); this.comboBox.setImmediate(true); vl.addComponent(this.comboBox); this.tabSheet.setSizeFull(); vl.addComponent(this.tabSheet); vl.setExpandRatio(this.tabSheet, 1); mainWindow.setContent(vl); mainWindow.addComponent(this.pusher); mainWindow.addListener(new Window.CloseListener() { public void windowClose(Window.CloseEvent e) { OnlineUsersManager.getInstance().deregisterUser((User) getUser()); } }); fireLoginWindow(); }
From source file:org.vaadin.addons.serverpush.samples.sales.SalesApplication.java
License:Apache License
public void init() { Window mainWindow = new Window("Sales Application"); setMainWindow(mainWindow);// ww w.j av a 2 s . c o m VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); final Label label = new Label("<h1>Sales Application</h1><hr/>", Label.CONTENT_XHTML); hl.addComponent(label); hl.addComponent(this.header); hl.setComponentAlignment(this.header, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(label, 1); vl.addComponent(hl); this.table.setSizeFull(); vl.addComponent(this.table); vl.setExpandRatio(this.table, 1); mainWindow.setContent(vl); fireLoginWindow(); }