List of usage examples for com.vaadin.ui TextField setValue
@Override public void setValue(String value)
From source file:info.magnolia.security.app.dialog.field.WorkspaceAccessFieldFactory.java
License:Open Source License
protected void openChooseDialog(final TextField textField) { final ConfiguredChooseDialogDefinition def = new ConfiguredChooseDialogDefinition(); final ConfiguredJcrContentConnectorDefinition contentConnectorDefinition = new ConfiguredJcrContentConnectorDefinition(); contentConnectorDefinition.setWorkspace(getFieldDefinition().getWorkspace()); contentConnectorDefinition.setRootPath("/"); contentConnectorDefinition.setDefaultOrder(ModelConstants.JCR_NAME); // node types contentConnectorDefinition.setNodeTypes(resolveNodeTypes()); def.setContentConnector(contentConnectorDefinition); final WorkbenchDefinition wbDef = resolveWorkbenchDefinition(); final WorkbenchFieldDefinition fieldDef = new WorkbenchFieldDefinition(); fieldDef.setWorkbench(wbDef);/*from w w w .j av a 2 s . c om*/ def.setField(fieldDef); // create chooseDialogComponentProvider and get new instance of presenter from there ComponentProvider chooseDialogComponentProvider = ChooseDialogComponentProviderUtil .createChooseDialogComponentProvider(def, componentProvider); workbenchChooseDialogPresenter = chooseDialogComponentProvider.newInstance(def.getPresenterClass(), chooseDialogComponentProvider); // Define selected ItemId ChooseDialogView chooseDialogView = workbenchChooseDialogPresenter.start(new ChooseDialogCallback() { @Override public void onItemChosen(String actionName, Object value) { try { if (value instanceof JcrItemId) { JcrItemId jcrItemId = (JcrItemId) value; textField.setValue(JcrItemUtil.getJcrItem(jcrItemId).getPath()); } else { textField.setValue("/"); } } catch (RepositoryException e) { log.error("Failed to read chosen node", e); } } @Override public void onCancel() { } }, def, uiContext, textField.getValue()); chooseDialogView.setCaption(StringUtils.capitalize(getFieldDefinition().getWorkspace())); }
From source file:info.magnolia.ui.form.field.factory.HiddenFieldFactory.java
License:Open Source License
@Override protected Field<String> createFieldComponent() { TextField field = new TextField(); field.setValue(definition.getDefaultValue()); field.setVisible(false);//from w w w .ja v a2s .c om return field; }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * abre el dilogo para editar el perfil/*from w w w. j a va 2 s . c o m*/ * */ private void editProfile() { // Create a sub-window and set the content Window subWindow = new Window("My profile"); subWindow.setWidth("375px"); FormLayout f = new FormLayout(); f.setMargin(true); TextField l; f.addComponent(l = new TextField("Name")); l.setValue(getApp().getUserData().getName()); TextField p; f.addComponent(p = new TextField("Email")); p.setValue(getApp().getUserData().getEmail()); Label e; f.addComponent(e = new Label()); VerticalLayout v = new VerticalLayout(); v.addComponent(f); HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); Label footerText = new Label(""); footerText.setSizeUndefined(); Button ok = new Button("Update it!", new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { e.setValue("Authenticating..."); io.mateu.ui.core.client.app.MateuUI.getBaseService().updateProfile( getApp().getUserData().getLogin(), l.getValue(), p.getValue(), null, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { e.setValue("" + caught.getClass().getName() + ": " + caught.getMessage()); } @Override public void onSuccess(Void result) { e.setValue("OK!"); getApp().getUserData().setName(l.getValue()); getApp().getUserData().setEmail(p.getValue()); subWindow.close(); refreshSettings(); } }); } }); ok.addStyleName(ValoTheme.BUTTON_PRIMARY); ok.setClickShortcut(ShortcutAction.KeyCode.ENTER); Button cancel = new Button("Cancel"); footer.addComponents(footerText, ok); //, cancel); footer.setExpandRatio(footerText, 1); v.addComponent(footer); subWindow.setContent(v); // Center it in the browser window subWindow.center(); subWindow.setModal(true); // Open it in the UI UI.getCurrent().addWindow(subWindow); l.focus(); }
From source file:io.subutai.plugin.accumulo.ui.wizard.ConfigurationStep.java
public ConfigurationStep(final Accumulo accumulo, final Hadoop hadoop, final Zookeeper zookeeper, final EnvironmentManager environmentManager, final Wizard wizard) { this.environmentManager = environmentManager; this.wizard = wizard; this.hadoop = hadoop; this.zookeeper = zookeeper; this.accumulo = accumulo; if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) { //hadoop combo final ComboBox hadoopClustersCombo = getCombo("Hadoop cluster"); hadoopClustersCombo.setId("hadoopClusterscb"); //zookeeper combo final ComboBox zkClustersCombo = getCombo("Zookeeper cluster"); zkClustersCombo.setId("zkClustersCombo"); //master nodes final ComboBox masterNodeCombo = getCombo("Master node"); masterNodeCombo.setId("masterNodeCombo"); final ComboBox gcNodeCombo = getCombo("GC node"); gcNodeCombo.setId("gcNodeCombo"); final ComboBox monitorNodeCombo = getCombo("Monitor node"); monitorNodeCombo.setId("monitorNodeCombo"); //accumulo init controls TextField clusterNameTxtFld = getTextField("Cluster name", "Cluster name", 20); clusterNameTxtFld.setId("clusterNameTxtFld"); TextField instanceNameTxtFld = getTextField("Instance name", "Instance name", 20); instanceNameTxtFld.setId("instanceNameTxtFld"); TextField passwordTxtFld = getTextField("Password", "Password", 20); passwordTxtFld.setId("passwordTxtFld"); //tracers final TwinColSelect tracersSelect = getTwinSelect("Tracers", "hostname", "Available Nodes", "Selected Nodes", 4); tracersSelect.setId("TracersSelect"); //slave nodes final TwinColSelect slavesSelect = getTwinSelect("Slaves", "hostname", "Available Nodes", "Selected Nodes", 4); slavesSelect.setId("SlavesSelect"); //get existing hadoop clusters List<HadoopClusterConfig> hadoopClusters = hadoop.getClusters(); //fill hadoopClustersCombo with hadoop cluster infos for (HadoopClusterConfig hadoopClusterInfo : hadoopClusters) { hadoopClustersCombo.addItem(hadoopClusterInfo); hadoopClustersCombo.setItemCaption(hadoopClusterInfo, hadoopClusterInfo.getClusterName()); }/*from w w w.j ava 2 s . c om*/ //try to find hadoop cluster info based on one saved in the configuration if (wizard.getConfig().getHadoopClusterName() != null) { hadoop.getCluster(wizard.getConfig().getHadoopClusterName()); } //select if saved found if (!hadoopClusters.isEmpty()) { //select first one if saved not found hadoopClustersCombo.setValue(hadoopClusters.iterator().next()); fillZookeeperComboBox(zkClustersCombo, zookeeper, hadoopClusters.iterator().next().getEnvironmentId()); } // fill selection controls with hadoop nodes if (hadoopClustersCombo.getValue() != null) { HadoopClusterConfig hadoopInfo = (HadoopClusterConfig) hadoopClustersCombo.getValue(); wizard.getConfig().setHadoopClusterName(hadoopInfo.getClusterName()); setComboDS(masterNodeCombo, hadoopInfo.getAllNodes(), new HashSet<String>()); setComboDS(gcNodeCombo, hadoopInfo.getAllNodes(), new HashSet<String>()); setComboDS(monitorNodeCombo, hadoopInfo.getAllNodes(), new HashSet<String>()); setTwinSelectDS(tracersSelect, getSlaveContainerHosts(Sets.newHashSet(hadoopInfo.getAllNodes()))); setTwinSelectDS(slavesSelect, getSlaveContainerHosts(Sets.newHashSet(hadoopInfo.getAllNodes()))); } //on hadoop cluster change reset all controls and config hadoopClustersCombo.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { HadoopClusterConfig hadoopInfo = (HadoopClusterConfig) event.getProperty().getValue(); //reset relevant controls setComboDS(masterNodeCombo, hadoopInfo.getAllNodes(), new HashSet<String>()); setComboDS(gcNodeCombo, hadoopInfo.getAllNodes(), new HashSet<String>()); setComboDS(monitorNodeCombo, hadoopInfo.getAllNodes(), new HashSet<String>()); setTwinSelectDS(tracersSelect, getSlaveContainerHosts(Sets.newHashSet(hadoopInfo.getAllNodes()))); setTwinSelectDS(slavesSelect, getSlaveContainerHosts(Sets.newHashSet(hadoopInfo.getAllNodes()))); //reset relevant properties wizard.getConfig().setMasterNode(null); wizard.getConfig().setGcNode(null); wizard.getConfig().setMonitor(null); wizard.getConfig().setTracers(null); wizard.getConfig().setSlaves(null); wizard.getConfig().setHadoopClusterName(hadoopInfo.getClusterName()); fillZookeeperComboBox(zkClustersCombo, zookeeper, hadoopInfo.getEnvironmentId()); } } }); //restore master node if back button is pressed if (wizard.getConfig().getMasterNode() != null) { masterNodeCombo.setValue(wizard.getConfig().getMasterNode()); } //restore gc node if back button is pressed if (wizard.getConfig().getGcNode() != null) { gcNodeCombo.setValue(wizard.getConfig().getGcNode()); } //restore monitor node if back button is pressed if (wizard.getConfig().getMonitor() != null) { monitorNodeCombo.setValue(wizard.getConfig().getMonitor()); } //add value change handler masterNodeCombo.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { String masterNode = (String) event.getProperty().getValue(); wizard.getConfig().setMasterNode(masterNode); } } }); //add value change handler gcNodeCombo.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { String gcNode = (String) event.getProperty().getValue(); wizard.getConfig().setGcNode(gcNode); } } }); //add value change handler monitorNodeCombo.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { String monitor = (String) event.getProperty().getValue(); wizard.getConfig().setMonitor(monitor); } } }); //restore tracers if back button is pressed if (!CollectionUtil.isCollectionEmpty(wizard.getConfig().getTracers())) { tracersSelect.setValue(wizard.getConfig().getTracers()); } //restore slaves if back button is pressed if (!CollectionUtil.isCollectionEmpty(wizard.getConfig().getSlaves())) { slavesSelect.setValue(wizard.getConfig().getSlaves()); } clusterNameTxtFld.setValue(wizard.getConfig().getInstanceName()); clusterNameTxtFld.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { wizard.getConfig().setClusterName(event.getProperty().getValue().toString().trim()); } }); instanceNameTxtFld.setValue(wizard.getConfig().getInstanceName()); instanceNameTxtFld.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { wizard.getConfig().setInstanceName(event.getProperty().getValue().toString().trim()); } }); passwordTxtFld.setValue(wizard.getConfig().getPassword()); passwordTxtFld.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { wizard.getConfig().setPassword(event.getProperty().getValue().toString().trim()); } }); //add value change handler tracersSelect.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { Set<String> nodes = new HashSet<>(); Set<EnvironmentContainerHost> nodeList = (Set<EnvironmentContainerHost>) event.getProperty() .getValue(); for (EnvironmentContainerHost host : nodeList) { nodes.add(host.getId()); } wizard.getConfig().setTracers(nodes); } } }); //add value change handler slavesSelect.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { Set<String> nodes = new HashSet<>(); Set<EnvironmentContainerHost> nodeList = (Set<EnvironmentContainerHost>) event.getProperty() .getValue(); for (EnvironmentContainerHost host : nodeList) { nodes.add(host.getId()); } wizard.getConfig().setSlaves(nodes); } } }); Button next = new Button("Next"); next.setId("confNext2"); next.addStyleName("default"); //check valid configuration next.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (Strings.isNullOrEmpty(wizard.getConfig().getClusterName())) { show("Please, enter cluster name"); } else if (Strings.isNullOrEmpty(wizard.getConfig().getZookeeperClusterName())) { show("Please, select Zookeeper cluster"); } else if (Strings.isNullOrEmpty(wizard.getConfig().getHadoopClusterName())) { show("Please, select Hadoop cluster"); } else if (wizard.getConfig().getMasterNode() == null) { show("Please, select master node"); } else if (Strings.isNullOrEmpty(wizard.getConfig().getInstanceName())) { show("Please, specify instance name"); } else if (Strings.isNullOrEmpty(wizard.getConfig().getPassword())) { show("Please, specify password"); } else if (wizard.getConfig().getGcNode() == null) { show("Please, select gc node"); } else if (wizard.getConfig().getMonitor() == null) { show("Please, select monitor"); } else if (CollectionUtil.isCollectionEmpty(wizard.getConfig().getTracers())) { show("Please, select tracer(s)"); } else if (CollectionUtil.isCollectionEmpty(wizard.getConfig().getSlaves())) { show("Please, select slave(s)"); } else { wizard.next(); } } }); Button back = new Button("Back"); back.setId("confBack2"); back.addStyleName("default"); back.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { wizard.back(); } }); setSizeFull(); VerticalLayout content = new VerticalLayout(); content.setSizeFull(); content.setSpacing(true); content.setMargin(true); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.addComponent(new Label("Please, specify installation settings")); layout.addComponent(content); HorizontalLayout masters = new HorizontalLayout(); masters.setMargin(new MarginInfo(true, false, false, false)); masters.setSpacing(true); masters.addComponent(hadoopClustersCombo); masters.addComponent(zkClustersCombo); masters.addComponent(masterNodeCombo); masters.addComponent(gcNodeCombo); masters.addComponent(monitorNodeCombo); HorizontalLayout credentials = new HorizontalLayout(); credentials.setMargin(new MarginInfo(true, false, false, false)); credentials.setSpacing(true); credentials.addComponent(clusterNameTxtFld); credentials.addComponent(instanceNameTxtFld); credentials.addComponent(passwordTxtFld); HorizontalLayout buttons = new HorizontalLayout(); buttons.setMargin(new MarginInfo(true, false, false, false)); buttons.setSpacing(true); buttons.addComponent(back); buttons.addComponent(next); content.addComponent(masters); content.addComponent(credentials); content.addComponent(tracersSelect); content.addComponent(slavesSelect); content.addComponent(buttons); setContent(layout); } }
From source file:it.vige.greenarea.bpm.custom.ui.form.DateSimulazioniViewFormPropertyRenderer.java
License:Apache License
@Override public Field getPropertyField(FormProperty formProperty) { // Writable string String value = formProperty.getValue(); TextField dateField = new TextField(); // Use the datePattern specified in the form property type dateField.setValue(getPropertyLabel(formProperty) + " " + value); dateField.setReadOnly(!formProperty.isWritable()); dateField.setStyleName(STYLE_DATE_VIEW); return dateField; }
From source file:it.vige.greenarea.bpm.custom.ui.form.DoubleFormPropertyRenderer.java
License:Apache License
@Override public Field getPropertyField(FormProperty formProperty) { final TextField textField = new TextField(getPropertyLabel(formProperty)); textField.setRequired(formProperty.isRequired()); textField.setEnabled(formProperty.isWritable()); textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); if (formProperty.getValue() != null) { textField.setValue(formProperty.getValue()); }/* w w w .j a v a 2 s . com*/ // Add validation of numeric value textField.addValidator(new DoubleValidator("Value must be a double")); textField.setImmediate(true); return textField; }
From source file:it.vige.greenarea.bpm.custom.ui.form.GreenareaPagedTable.java
License:Apache License
@Override public HorizontalLayout createControls() { I18nManager I18nManager = get().getI18nManager(); final PagedTableContainer container = (PagedTableContainer) getContainerDataSource(); Label itemsPerPageLabel = new Label(I18nManager.getMessage(PAGINAZIONE_PER_PAGINA)); final ComboBox itemsPerPageSelect = new ComboBox(); itemsPerPageSelect.addItem("3"); itemsPerPageSelect.addItem("10"); itemsPerPageSelect.addItem("25"); itemsPerPageSelect.addItem("50"); itemsPerPageSelect.setImmediate(true); itemsPerPageSelect.setNullSelectionAllowed(false); itemsPerPageSelect.setWidth("50px"); itemsPerPageSelect.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue()))); }/*from w ww . j av a 2s.com*/ }); itemsPerPageSelect.select(maxRecords + ""); Label pageLabel = new Label(I18nManager.getMessage(PAGINAZIONE_PAG) + " ", Label.CONTENT_XHTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.addValidator(new IntegerValidator(null)); Label separatorLabel = new Label(" / ", Label.CONTENT_XHTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) { int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page); } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("20px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); HorizontalLayout controlBar = new HorizontalLayout(); HorizontalLayout pageSize = new HorizontalLayout(); HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(ClickEvent event) { setCurrentPage(0); if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) { Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()]; GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm .getComponent(1); FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0); FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent .getRenderer(formProperty); greenareaFormPropertiesComponent.getForm() .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId()) .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " " + selectable.getValue()); } } }); final Button previous = new Button("<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(ClickEvent event) { previousPage(); if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) { Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()]; GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm .getComponent(1); FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0); FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent .getRenderer(formProperty); greenareaFormPropertiesComponent.getForm() .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId()) .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " " + selectable.getValue()); } } }); final Button next = new Button(">", new ClickListener() { private static final long serialVersionUID = -1927138212640638452L; public void buttonClick(ClickEvent event) { nextPage(); if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) { Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()]; GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm .getComponent(1); FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0); FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent .getRenderer(formProperty); greenareaFormPropertiesComponent.getForm() .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId()) .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " " + selectable.getValue()); } } }); final Button last = new Button(">>", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) { Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()]; GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm .getComponent(1); FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0); FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent .getRenderer(formProperty); greenareaFormPropertiesComponent.getForm() .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId()) .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " " + selectable.getValue()); } } }); first.setStyleName(Reindeer.BUTTON_LINK); previous.setStyleName(Reindeer.BUTTON_LINK); next.setStyleName(Reindeer.BUTTON_LINK); last.setStyleName(Reindeer.BUTTON_LINK); itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption"); itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox"); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); itemsPerPageLabel.addStyleName("pagedtable-label"); itemsPerPageSelect.addStyleName("pagedtable-combobox"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.addComponent(itemsPerPageLabel); pageSize.addComponent(itemsPerPageSelect); pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { public void pageChanged(PagedTableChangeEvent event) { first.setEnabled(container.getStartIndex() > 0); previous.setEnabled(container.getStartIndex() > 0); next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(getTotalAmountOfPages()); itemsPerPageSelect.setValue(String.valueOf(getPageLength())); } }); controlBar.setStyleName("pagination"); return controlBar; }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java
License:Open Source License
public AdminAuthView() { setSizeFull();//from w w w.j a va 2 s . c o m VerticalLayout header = new VerticalLayout(); header.setSizeFull(); HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); addComponents(header, content); setExpandRatio(header, 1); setExpandRatio(content, 6); welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>"); welcomeText.setContentMode(ContentMode.HTML); welcomeText.setSizeUndefined(); header.addComponent(welcomeText); header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); Panel controlPanel = new Panel("Administrator control panel"); controlPanel.setSizeUndefined(); Panel addCoordPanel = new Panel("Create a new coordinator"); addCoordPanel.setSizeUndefined(); Panel messagesPanel = new Panel("Administrator messages"); messagesPanel.setWidth("580px"); Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setColumnWidth("inputEvent", 180); adminMessagesTable.setSizeFull(); VerticalLayout controlLayout = new VerticalLayout(controlPanel); controlLayout.setSizeFull(); controlLayout.setMargin(false); controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER); VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel); coordOperationsLayout.setSizeFull(); coordOperationsLayout.setMargin(false); coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER); /******************************************/ coordOperationsLayout.setVisible(true); // main layout in the middle addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator" /******************************************/ HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel); VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable); messagesExternalLayout.setSizeFull(); messagesExternalLayout.setMargin(false); messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER); messagesInternalLayout.setMargin(false); messagesInternalLayout.setSizeFull(); messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER); messagesPanel.setContent(messagesInternalLayout); TextField idCoordAdd = new TextField(); TextField loginCoord = new TextField(); PasswordField pwdCoord = new PasswordField(); Label idCaptionAdd = new Label("ID"); Label loginCaption = new Label("Login"); Label pwdCaption = new Label("Password"); idCaptionAdd.setSizeUndefined(); idCoordAdd.setSizeUndefined(); loginCaption.setSizeUndefined(); loginCoord.setSizeUndefined(); pwdCaption.setSizeUndefined(); pwdCoord.setSizeUndefined(); Button validateNewCoord = new Button("Validate"); validateNewCoord.setClickShortcut(KeyCode.ENTER); validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY); GridLayout addCoordinatorLayout = new GridLayout(2, 4); addCoordinatorLayout.setSpacing(true); addCoordinatorLayout.setMargin(true); addCoordinatorLayout.setSizeFull(); addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption, pwdCoord); addCoordinatorLayout.addComponent(validateNewCoord, 1, 3); addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT); addCoordPanel.setContent(addCoordinatorLayout); content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setExpandRatio(controlLayout, 20); content.setExpandRatio(coordOperationsLayout, 10); content.setExpandRatio(messagesExternalLayout, 28); Button addCoordinator = new Button("Add coordinator"); Button deleteCoordinator = new Button("Delete coordinator"); addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE); VerticalLayout buttons = new VerticalLayout(); buttons.setMargin(true); buttons.setSpacing(true); buttons.setSizeFull(); buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); controlPanel.setContent(buttons); buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn); /******* DELETE COORDINATOR PANEL BEGIN *********/ Label idCaptionDel = new Label("ID"); TextField idCoordDel = new TextField(); Panel delCoordPanel = new Panel("Delete a coordinator"); coordOperationsLayout.addComponent(delCoordPanel); delCoordPanel.setVisible(false); coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER); delCoordPanel.setSizeUndefined(); GridLayout delCoordinatorLayout = new GridLayout(2, 2); delCoordinatorLayout.setSpacing(true); delCoordinatorLayout.setMargin(true); delCoordinatorLayout.setSizeFull(); Button deleteCoordBtn = new Button("Delete"); deleteCoordBtn.setClickShortcut(KeyCode.ENTER); deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY); delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel); delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1); delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT); delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT); delCoordPanel.setContent(delCoordinatorLayout); /******* DELETE COORDINATOR PANEL END *********/ /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/ addCoordinator.addClickListener(event -> { if (!addCoordPanel.isVisible()) { delCoordPanel.setVisible(false); addCoordPanel.setVisible(true); idCoordAdd.focus(); } else addCoordPanel.setVisible(false); }); deleteCoordinator.addClickListener(event -> { if (!delCoordPanel.isVisible()) { addCoordPanel.setVisible(false); delCoordPanel.setVisible(true); idCoordDel.focus(); } else delCoordPanel.setVisible(false); }); /************************************************* MAIN BUTTONS LOGIC END *************************************************/ /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/ validateNewCoord.addClickListener(event -> { String currentURL = Page.getCurrent().getLocation().toString(); int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName); String iCrashURL = currentURL.substring(0, strIndexCreator); String googleShebang = "#!"; String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang; try { sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())), new DtLogin(new PtString(loginCoord.getValue())), new DtPassword(new PtString(pwdCoord.getValue()))); // open new browser tab with the newly created coordinator console... // "_blank" instructs the browser to open a new tab instead of a new window... // unhappily not all browsers interpret it correctly, // some versions of some browsers might still open a new window instead (notably Firefox)! Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank"); } catch (Exception e) { e.printStackTrace(); } idCoordAdd.setValue(""); loginCoord.setValue(""); pwdCoord.setValue(""); idCoordAdd.focus(); }); /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/ /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/ deleteCoordBtn.addClickListener(event -> { IcrashSystem sys = IcrashSystem.getInstance(); try { sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue()))); } catch (Exception e) { e.printStackTrace(); } idCoordDel.setValue(""); idCoordDel.focus(); }); /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/ }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileAuthView.java
License:Open Source License
public CoordMobileAuthView(String CoordID) { CtCoordinator ctCoordinator = (CtCoordinator) sys .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID))); ActCoordinator actCoordinator = sys.getActCoordinator(ctCoordinator); actCoordinator.setActorUI(UI.getCurrent()); env.setActCoordinator(actCoordinator.getName(), actCoordinator); IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator); IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator); thisCoordID = CoordID;/* w w w . j a va2 s .c o m*/ setResponsive(true); setWidth("100%"); NavigationBar alertsBar = new NavigationBar(); VerticalComponentGroup alertsContent = new VerticalComponentGroup(); alertsContent.setWidth("100%"); alertsContent.setResponsive(true); HorizontalLayout alertButtons1 = new HorizontalLayout(); HorizontalLayout alertButtons2 = new HorizontalLayout(); //alertButtons.setMargin(true); //alertButtons.setSpacing(true); alertsBar.setCaption("Coordinator " + ctCoordinator.login.toString()); // NavigationButton logoutBtn1 = new NavigationButton("Logout"); Button logoutBtn1 = new Button("Logout"); alertsBar.setRightComponent(logoutBtn1); alertsTable = new Grid(); alertsTable.setContainerDataSource(actCoordinator.getAlertsContainer()); alertsTable.setColumnOrder("ID", "date", "time", "longitude", "latitude", "comment", "status"); alertsTable.setSelectionMode(SelectionMode.SINGLE); alertsTable.setWidth("100%"); alertsTable.setResponsive(true); //alertsTable.setSizeUndefined(); alertsTable.setImmediate(true); Grid inputEventsTable1 = new Grid(); inputEventsTable1.setContainerDataSource(actCoordinator.getMessagesDataSource()); inputEventsTable1.setWidth("100%"); inputEventsTable1.setResponsive(true); alertsContent.addComponents(alertsBar, alertButtons1, alertButtons2, alertsTable, inputEventsTable1); Tab alertsTab = this.addTab(alertsContent); alertsTab.setCaption("Alerts"); alertStatus = new NativeSelect(); alertStatus.setNullSelectionAllowed(false); alertStatus.addItems("Pending", "Valid", "Invalid"); alertStatus.setImmediate(true); alertStatus.select("Pending"); Button validateAlertBtn = new Button("Validate"); Button invalidateAlertBtn = new Button("Invalidate"); Button getAlertsSetBtn = new Button("Get alerts set"); validateAlertBtn.setImmediate(true); invalidateAlertBtn.setImmediate(true); validateAlertBtn.addClickListener(event -> { AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow(); Integer thisAlertID = new Integer(selectedAlertBean.getID()); PtBoolean res; res = sys.oeValidateAlert(new DtAlertID(new PtString(thisAlertID.toString()))); }); invalidateAlertBtn.addClickListener(event -> { AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow(); Integer thisAlertID = new Integer(selectedAlertBean.getID()); PtBoolean res; res = sys.oeInvalidateAlert(new DtAlertID(new PtString(thisAlertID.toString()))); }); getAlertsSetBtn.addClickListener(event -> { if (alertStatus.getValue().toString().equals("Pending")) actCoordinator.oeGetAlertsSet(EtAlertStatus.pending); else if (alertStatus.getValue().toString().equals("Valid")) actCoordinator.oeGetAlertsSet(EtAlertStatus.valid); else if (alertStatus.getValue().toString().equals("Invalid")) actCoordinator.oeGetAlertsSet(EtAlertStatus.invalid); }); alertButtons1.addComponents(validateAlertBtn, invalidateAlertBtn); alertButtons2.addComponents(getAlertsSetBtn, alertStatus); ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// NavigationBar crisesBar = new NavigationBar(); VerticalComponentGroup crisesContent = new VerticalComponentGroup(); crisesContent.setWidth("100%"); crisesContent.setResponsive(true); HorizontalLayout crisesButtons1 = new HorizontalLayout(); HorizontalLayout crisesButtons2 = new HorizontalLayout(); crisesBar.setCaption("Coordinator " + ctCoordinator.login.toString()); //NavigationButton logoutBtn2 = new NavigationButton("Logout"); Button logoutBtn2 = new Button("Logout"); crisesBar.setRightComponent(logoutBtn2); crisesTable = new Grid(); crisesTable.setContainerDataSource(actCoordinator.getCrisesContainer()); crisesTable.setColumnOrder("ID", "date", "time", "type", "longitude", "latitude", "comment", "status"); crisesTable.setSelectionMode(SelectionMode.SINGLE); crisesTable.setWidth("100%"); //crisesTable.setSizeUndefined(); crisesTable.setImmediate(true); crisesTable.setResponsive(true); Grid inputEventsTable2 = new Grid(); inputEventsTable2.setContainerDataSource(actCoordinator.getMessagesDataSource()); inputEventsTable2.setWidth("100%"); inputEventsTable2.setResponsive(true); crisesContent.addComponents(crisesBar, crisesButtons1, crisesButtons2, crisesTable, inputEventsTable2); Tab crisesTab = this.addTab(crisesContent); crisesTab.setCaption("Crises"); Button handleCrisesBtn = new Button("Handle"); Button reportOnCrisisBtn = new Button("Report"); Button changeCrisisStatusBtn = new Button("Status"); Button closeCrisisBtn = new Button("Close"); Button getCrisesSetBtn = new Button("Get crises set"); crisesStatus = new NativeSelect(); handleCrisesBtn.setImmediate(true); reportOnCrisisBtn.setImmediate(true); changeCrisisStatusBtn.setImmediate(true); closeCrisisBtn.setImmediate(true); getCrisesSetBtn.setImmediate(true); crisesStatus.setImmediate(true); crisesStatus.addItems("Pending", "Handled", "Solved", "Closed"); crisesStatus.setNullSelectionAllowed(false); crisesStatus.select("Pending"); crisesButtons1.addComponents(handleCrisesBtn, reportOnCrisisBtn, changeCrisisStatusBtn); crisesButtons2.addComponents(closeCrisisBtn, getCrisesSetBtn, crisesStatus); //////////////////////////////////////// Window reportCrisisSubWindow = new Window(); reportCrisisSubWindow.setClosable(false); reportCrisisSubWindow.setResizable(false); reportCrisisSubWindow.setResponsive(true); VerticalLayout reportLayout = new VerticalLayout(); reportLayout.setMargin(true); reportLayout.setSpacing(true); reportCrisisSubWindow.setContent(reportLayout); TextField crisisID = new TextField(); TextField reportText = new TextField(); HorizontalLayout buttonsLayout = new HorizontalLayout(); Button reportCrisisBtn = new Button("Report"); reportCrisisBtn.setClickShortcut(KeyCode.ENTER); reportCrisisBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancelBtn = new Button("Cancel"); buttonsLayout.addComponents(reportCrisisBtn, cancelBtn); buttonsLayout.setSpacing(true); reportLayout.addComponents(crisisID, reportText, buttonsLayout); cancelBtn.addClickListener(event -> { reportCrisisSubWindow.close(); reportText.clear(); }); reportCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); actCoordinator.oeReportOnCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())), new DtComment(new PtString(reportText.getValue()))); reportCrisisSubWindow.close(); reportText.clear(); }); //////////////////////////////////////// Window changeCrisisStatusSubWindow = new Window(); changeCrisisStatusSubWindow.setClosable(false); changeCrisisStatusSubWindow.setResizable(false); changeCrisisStatusSubWindow.setResponsive(true); VerticalLayout statusLayout = new VerticalLayout(); statusLayout.setMargin(true); statusLayout.setSpacing(true); changeCrisisStatusSubWindow.setContent(statusLayout); TextField crisisID1 = new TextField(); NativeSelect crisisStatus = new NativeSelect("crisis status"); crisisStatus.addItems("Pending", "Handled", "Solved", "Closed"); crisisStatus.setNullSelectionAllowed(false); crisisStatus.select("Pending"); HorizontalLayout buttonsLayout1 = new HorizontalLayout(); Button changeCrisisStatusBtn1 = new Button("Change status"); changeCrisisStatusBtn1.setClickShortcut(KeyCode.ENTER); changeCrisisStatusBtn1.addStyleName(ValoTheme.BUTTON_PRIMARY); Button cancelBtn1 = new Button("Cancel"); buttonsLayout1.addComponents(changeCrisisStatusBtn1, cancelBtn1); buttonsLayout1.setSpacing(true); statusLayout.addComponents(crisisID1, crisisStatus, buttonsLayout1); cancelBtn1.addClickListener(event -> changeCrisisStatusSubWindow.close()); changeCrisisStatusBtn1.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); EtCrisisStatus statusToPut = null; if (crisisStatus.getValue().toString().equals("Pending")) statusToPut = EtCrisisStatus.pending; if (crisisStatus.getValue().toString().equals("Handled")) statusToPut = EtCrisisStatus.handled; if (crisisStatus.getValue().toString().equals("Solved")) statusToPut = EtCrisisStatus.solved; if (crisisStatus.getValue().toString().equals("Closed")) statusToPut = EtCrisisStatus.closed; PtBoolean res = actCoordinator.oeSetCrisisStatus(new DtCrisisID(new PtString(thisCrisisID.toString())), statusToPut); changeCrisisStatusSubWindow.close(); }); //////////////////////////////////////// handleCrisesBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); PtBoolean res = actCoordinator .oeSetCrisisHandler(new DtCrisisID(new PtString(thisCrisisID.toString()))); }); reportOnCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); reportCrisisSubWindow.center(); crisisID.setValue(thisCrisisID.toString()); crisisID.setEnabled(false); reportText.focus(); UI.getCurrent().addWindow(reportCrisisSubWindow); }); changeCrisisStatusBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); changeCrisisStatusSubWindow.center(); crisisID1.setValue(thisCrisisID.toString()); crisisID1.setEnabled(false); crisisStatus.focus(); UI.getCurrent().addWindow(changeCrisisStatusSubWindow); }); closeCrisisBtn.addClickListener(event -> { CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow(); Integer thisCrisisID = new Integer(selectedCrisisBean.getID()); PtBoolean res = actCoordinator.oeCloseCrisis(new DtCrisisID(new PtString(thisCrisisID.toString()))); }); getCrisesSetBtn.addClickListener(event -> { if (crisesStatus.getValue().toString().equals("Closed")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.closed); if (crisesStatus.getValue().toString().equals("Handled")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.handled); if (crisesStatus.getValue().toString().equals("Solved")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.solved); if (crisesStatus.getValue().toString().equals("Pending")) actCoordinator.oeGetCrisisSet(EtCrisisStatus.pending); }); ClickListener logoutAction = event -> { PtBoolean res; try { res = actCoordinator.oeLogout(); if (res.getValue()) { } } catch (Exception e) { e.printStackTrace(); } Page.getCurrent().reload(); }; logoutBtn1.addClickListener(logoutAction); logoutBtn2.addClickListener(logoutAction); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private void initView() { setCompositionRoot(root);/* w ww. ja va2 s .c o m*/ root.setSizeFull(); root.setSplitPosition(15); root.setStyleName("small previews"); previewArea.setWidth("100%"); previewTabs = new VerticalLayout(); previewTabs.setSizeFull(); previewTabs.setHeight(null); compoundTabs = new VerticalLayout(); compoundTabs.setSizeFull(); compoundTabs.setHeight(null); bennuStylesTabs = new VerticalLayout(); bennuStylesTabs.setSizeFull(); bennuStylesTabs.setHeight(null); VerticalLayout menu = new VerticalLayout(); menu.setSizeFull(); menu.setStyleName("sidebar-menu"); Button syncThemes = new Button("Sync Themes", new ClickListener() { @Override public void buttonClick(ClickEvent event) { syncThemes(); } }); menu.addComponent(syncThemes); menu.addComponent(new Label("Single Components")); menu.addComponent(previewTabs); menu.addComponent(new Label("Compound Styles")); menu.addComponent(compoundTabs); menu.addComponent(new Label("Bennu Styles")); menu.addComponent(bennuStylesTabs); root.setFirstComponent(menu); CssLayout toolbar = new CssLayout(); toolbar.setWidth("100%"); toolbar.setStyleName("toolbar"); toolbar.addComponent(editorToggle); final Window downloadWindow = new Window("Download Theme"); GridLayout l = new GridLayout(3, 2); l.setSizeUndefined(); l.setMargin(true); l.setSpacing(true); downloadWindow.setContent(l); downloadWindow.setModal(true); downloadWindow.setResizable(false); downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null); downloadWindow.addStyleName("opaque"); Label caption = new Label("Theme Name"); l.addComponent(caption); l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER); final TextField name = new TextField(); name.setValue("my-chameleon"); name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed")); name.setRequired(true); name.setRequiredError("Please give a name for the theme"); downloadWindow.addComponent(name); Label info = new Label( "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.", Label.CONTENT_XHTML); info.addStyleName("tiny"); info.setWidth("200px"); l.addComponent(info, 1, 1, 2, 1); Button download = new Button(null, new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { getApplication().getMainWindow().addWindow(downloadWindow); name.focus(); } }); download.setDescription("Donwload the current theme"); download.setIcon(new ThemeResource("download.png")); download.setStyleName("icon-only"); toolbar.addComponent(download); menu.addComponent(toolbar); menu.setExpandRatio(toolbar, 1); menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER); }