List of usage examples for com.vaadin.ui GridLayout setWidth
@Override public void setWidth(float width, Unit unit)
From source file:dhbw.clippinggorilla.userinterface.windows.RegisterWindow.java
public RegisterWindow() { setModal(true);/*from ww w. j av a 2s .c o m*/ setResizable(false); setDraggable(false); setCaption(Language.get(Word.REGISTER)); addCloseShortcut(KeyCode.ENTER, null); Button save = new Button(Language.get(Word.REGISTER)); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.setMargin(false); windowLayout.setSizeUndefined(); FormLayout forms = new FormLayout(); forms.setMargin(true); forms.setSizeUndefined(); TextField firstName = new TextField(Language.get(Word.FIRST_NAME)); firstName.focus(); firstName.setMaxLength(20); firstName.addValueChangeListener(event -> { String firstNameError = UserUtils.checkName(event.getValue()); if (!firstNameError.isEmpty()) { firstName.setComponentError(new UserError(firstNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(firstNameError); save.setEnabled(setError(firstName, true)); } else { firstName.setComponentError(null); boolean enabled = setError(firstName, false); save.setEnabled(enabled); } }); forms.addComponent(firstName); TextField lastName = new TextField(Language.get(Word.LAST_NAME)); lastName.setMaxLength(20); lastName.addValueChangeListener(event -> { String lastNameError = UserUtils.checkName(event.getValue()); if (!lastNameError.isEmpty()) { lastName.setComponentError(new UserError(lastNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(lastNameError); save.setEnabled(setError(lastName, true)); } else { lastName.setComponentError(null); save.setEnabled(setError(lastName, false)); } }); forms.addComponent(lastName); TextField userName = new TextField(Language.get(Word.USERNAME)); userName.setMaxLength(20); userName.addValueChangeListener(event -> { String userNameError = UserUtils.checkUsername(event.getValue()); if (!userNameError.isEmpty()) { userName.setComponentError(new UserError(userNameError, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(userNameError); save.setEnabled(setError(userName, true)); } else { userName.setComponentError(null); save.setEnabled(setError(userName, false)); } }); forms.addComponent(userName); TextField email1 = new TextField(Language.get(Word.EMAIL)); email1.setMaxLength(256); email1.addValueChangeListener(event -> { String email1Error = UserUtils.checkEmail(event.getValue().toLowerCase()); if (!email1Error.isEmpty()) { email1.setComponentError(new UserError(email1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email1Error); save.setEnabled(setError(email1, true)); } else { email1.setComponentError(null); save.setEnabled(setError(email1, false)); } }); forms.addComponent(email1); TextField email2 = new TextField(Language.get(Word.EMAIL_AGAIN)); email2.setMaxLength(256); email2.addValueChangeListener(event -> { String email2Error = UserUtils.checkEmail(event.getValue().toLowerCase()) + UserUtils.checkSecondEmail(email1.getValue().toLowerCase(), event.getValue().toLowerCase()); if (!email2Error.isEmpty()) { email2.setComponentError(new UserError(email2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(email2Error); save.setEnabled(setError(email2, true)); } else { email2.setComponentError(null); save.setEnabled(setError(email2, false)); } }); forms.addComponent(email2); ProgressBar strength = new ProgressBar(); PasswordField password1 = new PasswordField(Language.get(Word.PASSWORD)); password1.setMaxLength(51); password1.addValueChangeListener(event -> { String password1Error = UserUtils.checkPassword(event.getValue()); strength.setValue(UserUtils.calculatePasswordStrength(event.getValue())); if (!password1Error.isEmpty()) { password1.setComponentError(new UserError(password1Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password1Error); save.setEnabled(setError(password1, true)); } else { password1.setComponentError(null); save.setEnabled(setError(password1, false)); } }); forms.addComponent(password1); strength.setWidth("184px"); strength.setHeight("1px"); forms.addComponent(strength); PasswordField password2 = new PasswordField(Language.get(Word.PASSWORD_AGAIN)); password2.setMaxLength(51); password2.addValueChangeListener(event -> { String password2Error = UserUtils.checkPassword(event.getValue()) + UserUtils.checkSecondPassword(password1.getValue(), event.getValue()); if (!password2Error.isEmpty()) { password2.setComponentError(new UserError(password2Error, AbstractErrorMessage.ContentMode.HTML, ErrorMessage.ErrorLevel.INFORMATION)); VaadinUtils.infoNotification(password2Error); save.setEnabled(setError(password2, true)); } else { password2.setComponentError(null); save.setEnabled(setError(password2, false)); } }); forms.addComponent(password2); GridLayout footer = new GridLayout(3, 1); footer.setSpacing(true); footer.setSizeUndefined(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Unit.PERCENTAGE); Label placeholder = new Label(); Button cancel = new Button(Language.get(Word.CANCEL)); cancel.setIcon(VaadinIcons.CLOSE); cancel.addClickListener(ce -> { close(); }); cancel.setClickShortcut(KeyCode.ESCAPE, null); save.setEnabled(false); save.setIcon(VaadinIcons.CHECK); save.addStyleName(ValoTheme.BUTTON_PRIMARY); save.addClickListener(ce -> { try { User user = UserUtils.registerUser(userName.getValue(), password1.getValue(), password2.getValue(), email1.getValue().toLowerCase(), email2.getValue().toLowerCase(), firstName.getValue(), lastName.getValue()); UserUtils.setCurrentUser(user); close(); UI.getCurrent().addWindow(ActivateWindow.get()); } catch (UserCreationException ex) { Log.error("Registration failed", ex); VaadinUtils.errorNotification(Language.get(Word.REG_FAILED)); } }); save.setClickShortcut(KeyCode.ENTER, null); footer.addComponents(placeholder, cancel, save); footer.setColumnExpandRatio(0, 1);//ExpandRatio(placeholder, 1); footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); footer.setComponentAlignment(save, Alignment.MIDDLE_CENTER); windowLayout.addComponent(forms); windowLayout.addComponent(footer); setContent(windowLayout); }
From source file:org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);//from w w w .j av a 2 s. c o m details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.PROCESS_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(modelData.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Version String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, modelData.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION); propertiesLayout.addComponent(versionLabel); }
From source file:org.activiti.explorer.ui.flow.ProcessDefinitionDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(4, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);/*from w w w . j a v a 2s .co m*/ taskDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.FLOW_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(processDefinition.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 3, 0); // Add version String versionString = i18nManager.getMessage(Messages.FLOW_VERSION, processDefinition.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_VERSION); taskDetails.addComponent(versionLabel, 1, 1); // Add deploy time PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_DEPLOY_TIME), deployment.getDeploymentTime(), null); deployTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_DEPLOY_TIME); taskDetails.addComponent(deployTimeLabel, 2, 1); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); taskDetails.setColumnExpandRatio(3, 1.0f); verticalLayout.addComponent(taskDetails); }
From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java
License:Apache License
protected void addName() { GridLayout header = new GridLayout(3, 2); header.setWidth(100, UNITS_PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); header.setSpacing(true);//from ww w .j a va 2 s . c o m header.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.FLOW_50); header.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(processDefinition.getName() + " (" + processInstance.getId() + ")"); nameLabel.addStyleName(Reindeer.LABEL_H2); header.addComponent(nameLabel, 1, 0, 2, 0); // Add start time PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_START_TIME), historicProcessInstance.getStartTime(), null); startTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_START_TIME); header.addComponent(startTimeLabel, 1, 1); header.setColumnExpandRatio(1, 1.0f); header.setColumnExpandRatio(2, 1.0f); verticalLayout.addComponent(header); }
From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java
License:Apache License
protected void addDeploymentName() { GridLayout taskDetails = new GridLayout(3, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);/* w w w. j av a2 s . c o m*/ taskDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.DEPLOYMENT_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add deployment name Label nameLabel = new Label(); if (deployment.getName() != null) { nameLabel.setValue(deployment.getName()); } else { nameLabel.setValue(i18nManager.getMessage(Messages.DEPLOYMENT_NO_NAME)); } nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 2, 0); // Add deploy time PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel( i18nManager.getMessage(Messages.DEPLOYMENT_DEPLOY_TIME), deployment.getDeploymentTime(), null, true); deployTimeLabel.addStyleName(ExplorerLayout.STYLE_DEPLOYMENT_HEADER_DEPLOY_TIME); taskDetails.addComponent(deployTimeLabel, 1, 1); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); addDetailComponent(taskDetails); }
From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java
License:Apache License
protected void addHeader() { GridLayout jobDetails = new GridLayout(3, 2); jobDetails.setWidth(100, UNITS_PERCENTAGE); jobDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); jobDetails.setSpacing(true);/*from ww w . j a va 2s . c o m*/ jobDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.JOB_50); jobDetails.addComponent(image, 0, 0, 0, 1); // Add job name Label nameLabel = new Label(getJobLabel(job)); nameLabel.addStyleName(Reindeer.LABEL_H2); jobDetails.addComponent(nameLabel, 1, 0, 2, 0); // Add due date PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.JOB_DUEDATE), job.getDuedate(), i18nManager.getMessage(Messages.JOB_NO_DUEDATE), false); dueDateLabel.addStyleName(ExplorerLayout.STYLE_JOB_HEADER_DUE_DATE); jobDetails.addComponent(dueDateLabel, 1, 1); jobDetails.setColumnExpandRatio(1, 1.0f); jobDetails.setColumnExpandRatio(2, 1.0f); addDetailComponent(jobDetails); }
From source file:org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel.java
License:Apache License
protected void addHeader() { GridLayout header = new GridLayout(3, 2); header.setWidth(100, UNITS_PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); header.setSpacing(true);/*from ww w . j a v a2 s . c o m*/ header.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.PROCESS_50); header.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance)); nameLabel.addStyleName(Reindeer.LABEL_H2); header.addComponent(nameLabel, 1, 0, 2, 0); // Add start time PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_START_TIME), historicProcessInstance.getStartTime(), null, true); startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME); header.addComponent(startTimeLabel, 1, 1); header.setColumnExpandRatio(1, 1.0f); header.setColumnExpandRatio(2, 1.0f); panelLayout.addComponent(header); }
From source file:org.activiti.explorer.ui.process.AbstractProcessDefinitionDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);/*from w w w.j a va2 s .c o m*/ details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.PROCESS_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(getProcessDisplayName(processDefinition)); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Version String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION); propertiesLayout.addComponent(versionLabel); // Add deploy time PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_DEPLOY_TIME), deployment.getDeploymentTime(), null, true); deployTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_DEPLOY_TIME); propertiesLayout.addComponent(deployTimeLabel); }
From source file:org.activiti.explorer.ui.profile.ProfilePanel.java
License:Apache License
protected GridLayout createInfoSectionLayout(int columns, int rows) { GridLayout layout = new GridLayout(columns, rows); layout.setSpacing(true);/* w w w . j a v a 2s. co m*/ layout.setWidth(100, UNITS_PERCENTAGE); layout.setMargin(true, false, true, false); infoPanelLayout.addComponent(layout); return layout; }
From source file:org.activiti.explorer.ui.reports.ReportDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);/*from w ww . j a v a2 s .c om*/ details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.REPORT_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(getReportDisplayName()); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Version String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION); propertiesLayout.addComponent(versionLabel); }