List of usage examples for com.vaadin.ui FormLayout FormLayout
public FormLayout()
From source file:pl.exsio.frameset.vaadin.ui.support.component.data.form.TabbedForm.java
License:Open Source License
private void initTabs() { int tabIndex = 0; for (String tabName : this.config.keySet()) { VerticalLayout outerLayout = new VerticalLayout() { {// w w w. j a va 2 s .c om FormLayout tabLayout = new FormLayout(); tabLayout.setMargin(true); tabLayout.setSizeFull(); addComponent(tabLayout); } }; outerLayout.setMargin(true); outerLayout.setSizeFull(); Tab tab = this.tabs.addTab(outerLayout, tabName); tab.setCaption(t(tabName)); this.tabsMap.put(tabName, tabIndex); tabIndex++; for (String property : this.config.get(tabName)) { this.propertiesMap.put(property, tabName); } } }
From source file:qbic.vaadincomponents.GroupSpecificParameterComponent.java
License:Open Source License
public Component init() { // Group specific parameters FormLayout groupSpecificParameters = new FormLayout(); // does not need to be initialized more than once. if (groupSelection == null) { groupSelection = new NativeSelect("Group:"); groupSelection.setNullSelectionAllowed(false); groupSpecificParameters.addComponent(groupSelection); groupSelection.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = -2948673674040494963L; @Override//from w w w . ja v a 2 s .com public void valueChange(ValueChangeEvent event) { if (event.getProperty() != null && event.getProperty().getValue() != null) { updateParameters((Integer) event.getProperty().getValue()); } } }); } parameterlayout = initParameters(); groupSpecificParameters.addComponent(parameterlayout); parameterlayout.setVisible(false); return groupSpecificParameters; }
From source file:qbic.vaadincomponents.GroupSpecificParameterComponent.java
License:Open Source License
private FormLayout initParameters() { // select the type FormLayout parameterLayout = new FormLayout(); labelfreequant = new CheckBox(); labelfreequant.setCaption("Label-Free Quantification"); parameterLayout.addComponent(labelfreequant); typeSelect = new NativeSelect(); typeSelect.setCaption("Type"); typeSelect.addItem("Standard"); typeSelect.addItem("Reporter Ion"); // add it/*from w w w .jav a2 s.c o m*/ parameterLayout.addComponent(typeSelect); // select multiplicity. multiplicitySelect = new NativeSelect(); multiplicitySelect.setCaption("Multiplicity"); multiplicitySelect.addItem("1 - label-free quantification"); multiplicitySelect.addItem("2 - light and heavy labels"); multiplicitySelect.addItem("3 - light, medium, and heavy lables"); multiplicitySelect.setNullSelectionAllowed(false); parameterLayout.addComponent(multiplicitySelect); // add labels labels = new QuantificationLabelComponent(); parameterLayout.addComponent(labels); multiplicitySelect.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 2788813707970284834L; @Override public void valueChange(ValueChangeEvent event) { String multiplicity = (String) event.getProperty().getValue(); if (multiplicity.startsWith("1")) { labels.noLables(); } else if (multiplicity.startsWith("2")) { labels.lightAndHeavyLabels(); } else if (multiplicity.startsWith("3")) { labels.lightMediumAndHeavyLabels(); } } }); parameterLayout.addComponent(labels); // variable modifications variableModifications = new TwinColSelect("Variable Modifications"); variableModifications.addItems("Acetyl (Protein N-term)", "Acetyl (K)", "Oxidation (M)", "Ala->Arg"); parameterLayout.addComponent(variableModifications); // digestion mode digestionMode = new NativeSelect("Digestion mode"); digestionMode.addItem("Specific"); parameterLayout.addComponent(digestionMode); // enzyme enzyme = new TwinColSelect("Enzyme"); enzyme.addItems("Trypsin/P", "ArgC", "Trypsin", "GluN"); parameterLayout.addComponent(enzyme); // missed cleavage missedcleavage = new TextField("Max Missed Cleavage"); parameterLayout.addComponent(missedcleavage); matchType = new NativeSelect("Match type"); matchType.addItem("MatchFromAndTo"); parameterLayout.addComponent(matchType); return parameterLayout; }
From source file:qbic.vaadincomponents.MaxQuantComponent.java
License:Open Source License
/** * creates the global parameter component * /*from w w w .j a v a 2 s . co m*/ * @return */ private Component globalParameters() { FormLayout globalparameters = new FormLayout(); globalparameters.setCaption("Global parameters"); fastaFiles = new SelectFileComponent("", FASTA_FILES_INFO, AVAILABLE_FASTAS_CAPTION, SELECTED_FASTAS_CAPTION, model.getFastaBeans(), model.getSelectedFastaBeans()); globalparameters.addComponent(fastaFiles); // fixed modifications // fixedModifications = new TwinColSelect("fixed modifications"); fixedModifications = new TwinColSelect(); Label fixedInfo = new Label("Fixed Modifications"); fixedInfo.addStyleName(ValoTheme.LABEL_COLORED); globalparameters.addComponent(fixedInfo); fixedModifications.addItems("Acetyl (Protein N-term)", "Acetyl (K)", "Oxidation (M)", "Ala->Arg", "Carbamidomethyl (C)"); globalparameters.addComponent(fixedModifications); reQuantify = new CheckBox("Requantify"); globalparameters.addComponent(reQuantify); matchBetweenRuns = new CheckBox("Match Between Runs"); globalparameters.addComponent(matchBetweenRuns); return globalparameters; }
From source file:ru.bormoshka.tstocks.view.FormGenerator.java
public static AbstractLayout getAddLocationFormBean(Table table) { FormLayout form = new FormLayout(); BeanItem<Location> beanItem = new BeanItem<>(new Location()); BeanFieldGroup beanBinder = new BeanFieldGroup(Location.class); beanItem.addNestedProperty("type.name"); beanBinder.setItemDataSource(beanItem); StockManager stockManager = (StockManager) MainScreen.getSpringHelper().getBean("stockManager"); ComboBox nSelect = new ComboBox(L.get("bean_field_location_type"), getHbnContainer(LocationType.class)); nSelect.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); nSelect.setItemCaptionPropertyId("name"); beanBinder.bind(nSelect, "type"); form.addComponent(beanBinder.buildAndBind(L.get("bean_field_location_name"), "name")); form.addComponent(beanBinder.buildAndBind(L.get("bean_field_location_room"), "room")); form.addComponent(nSelect);//from w w w . ja va2 s .c o m form.setImmediate(false); Button submit = new Button(L.get("form_save")); submit.addClickListener(new SaveBeanListener<StockManager, Location>(beanBinder, table)); form.addComponent(submit); return form; }
From source file:ru.bormoshka.tstocks.view.FormGenerator.java
public static AbstractLayout getAddLocationTypeFormBean(Table table) { FormLayout form = new FormLayout(); BeanItem<LocationType> beanItem = new BeanItem<>(new LocationType()); BeanFieldGroup beanBinder = new BeanFieldGroup(LocationType.class); beanBinder.setItemDataSource(beanItem); form.addComponent(beanBinder.buildAndBind(L.get("table_bean_location_type_name"), "name")); form.addComponent(beanBinder.buildAndBind(L.get("table_bean_location_type_description"), "description")); form.setImmediate(false);/*from w w w .j a v a2s . c o m*/ Button submit = new Button(L.get("form_save")); submit.addClickListener(new SaveBeanListener<StockManager, LocationType>(beanBinder, table)); form.addComponent(submit); return form; }
From source file:ru.bormoshka.tstocks.view.FormGenerator.java
public static AbstractLayout getAddAddressFormBean(Table table) { FormLayout form = new FormLayout(); BeanItem<Address> beanItem = new BeanItem<>(new Address()); BeanFieldGroup beanBinder = new BeanFieldGroup(Address.class); beanBinder.setItemDataSource(beanItem); form.addComponent(beanBinder.buildAndBind(L.get("table_bean_address_city"), "city")); form.addComponent(beanBinder.buildAndBind(L.get("table_bean_address_district"), "district")); form.addComponent(beanBinder.buildAndBind(L.get("table_bean_address_street"), "street")); form.setImmediate(false);/* www . j av a 2 s. c o m*/ Button submit = new Button(L.get("form_save")); submit.addClickListener(new SaveBeanListener<StockManager, Address>(beanBinder, table)); form.addComponent(submit); return form; }
From source file:ru.bormoshka.tstocks.view.FormGenerator.java
public static AbstractLayout getAddCategoryFormBean(Table table) { FormLayout form = new FormLayout(); VerticalLayout holder = new VerticalLayout(); BeanItem<Category> beanItem = new BeanItem<>(new Category(new String(), new String())); BeanFieldGroup beanBinder = new BeanFieldGroup(Category.class); beanBinder.setItemDataSource(beanItem); Label formName = new Label(L.get("new_list_form_label_category")); formName.setStyleName("form-name-label"); holder.addComponent(formName);/*from w w w.j ava2 s . c o m*/ holder.addComponent(form); form.addComponent(beanBinder.buildAndBind(L.get("bean_field_category_name"), "name")); form.addComponent(beanBinder.buildAndBind(L.get("bean_field_category_description"), "description")); form.setImmediate(false); Button submit = new Button(L.get("form_save")); if (table == null) { submit.addClickListener(new SaveBeanListener<StockManager, Category>(beanBinder)); } else { submit.addClickListener(new SaveBeanListener<StockManager, Category>(beanBinder, table)); } form.addComponent(submit); form.setImmediate(false); return holder; }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
private Panel createEmailDatesPanel() { VerticalLayout emailDates = new VerticalLayout(); emailDates.setSpacing(true);/*from w w w .j av a 2s . co m*/ emailDates.setMargin(true); emailDates.setSizeFull(); Panel panel2 = new Panel(" ? ??", emailDates); panel2.setSizeFull(); final TextField emailToField = new TextField("e-mail ?:"); emailToField.setValue(get(API.EMAIL_TO)); emailToField.setRequired(true); emailToField.setReadOnly(true); emailToField.addValidator(new EmailValidator(" e-mail ?")); final TextField receiverNameField = new TextField("? ?:"); receiverNameField.setValue(get(API.RECEIVER_NAME)); receiverNameField.setRequired(true); receiverNameField.setReadOnly(true); final TextField emailFromField = new TextField("e-mail ?:"); emailFromField.setValue(get(API.EMAIL_FROM)); emailFromField.setRequired(true); emailFromField.setReadOnly(true); emailFromField.addValidator(new EmailValidator(" e-mail ?")); final TextField senderLoginField = new TextField(" ?:"); senderLoginField.setValue(get(API.SENDER_LOGIN)); senderLoginField.setRequired(true); senderLoginField.setReadOnly(true); final TextField senderNameField = new TextField("? ?:"); senderNameField.setValue(get(API.SENDER_NAME)); senderNameField.setRequired(true); senderNameField.setReadOnly(true); final PasswordField passwordField = new PasswordField(":"); passwordField.setValue(API.PASSWORD); passwordField.setRequired(true); passwordField.setReadOnly(true); final TextField hostField = new TextField("SMTP ?:"); String host = get(API.HOST); hostField.setValue(host == null ? "" : host); hostField.setRequired(true); hostField.setReadOnly(true); final TextField portField = new TextField(":"); String port = get(API.PORT); portField.setValue(port == null ? "" : port); portField.setRequired(true); portField.setReadOnly(true); portField.addValidator(new IntegerValidator(" ")); final CheckBox tls = new CheckBox("? TLS", AdminServiceProvider.getBoolProperty(API.TLS)); tls.setReadOnly(true); final Button save = new Button(""); save.setVisible(false); final Button cancel = new Button(""); cancel.setVisible(false); final Button change = new Button(""); final Button check = new Button(""); check.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String emailTo = get(API.EMAIL_TO); String receiverName = get(API.RECEIVER_NAME); String hostName = get(API.HOST); String port = get(API.PORT); String senderLogin = get(API.SENDER_LOGIN); String password = get(API.PASSWORD); String emailFrom = get(API.EMAIL_FROM); String senderName = get(API.SENDER_NAME); if (emailTo.isEmpty() || receiverName.isEmpty() || hostName.isEmpty() || port.isEmpty() || senderLogin.isEmpty() || password.isEmpty() || emailFrom.isEmpty() || senderName.isEmpty()) { check.getWindow().showNotification("? ? "); return; } Email email = new SimpleEmail(); try { email.setSubject("? ?"); email.setMsg("? ?"); email.addTo(emailTo, receiverName); email.setHostName(hostName); email.setSmtpPort(Integer.parseInt(port)); email.setTLS(AdminServiceProvider.getBoolProperty(API.TLS)); email.setAuthentication(senderLogin, password); email.setFrom(emailFrom, senderName); email.setCharset("utf-8"); email.send(); } catch (EmailException e) { check.getWindow().showNotification(e.getMessage()); e.printStackTrace(); return; } check.getWindow().showNotification("? ? "); } }); change.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { emailToField.setReadOnly(false); receiverNameField.setReadOnly(false); emailFromField.setReadOnly(false); senderLoginField.setReadOnly(false); senderNameField.setReadOnly(false); passwordField.setReadOnly(false); hostField.setReadOnly(false); portField.setReadOnly(false); tls.setReadOnly(false); change.setVisible(false); check.setVisible(false); save.setVisible(true); cancel.setVisible(true); } }); save.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (StringUtils.isEmpty((String) emailToField.getValue()) || StringUtils.isEmpty((String) receiverNameField.getValue()) || StringUtils.isEmpty((String) emailFromField.getValue()) || StringUtils.isEmpty((String) senderNameField.getValue()) || StringUtils.isEmpty((String) senderLoginField.getValue()) || StringUtils.isEmpty((String) passwordField.getValue()) || StringUtils.isEmpty((String) hostField.getValue()) || portField.getValue() == null) { emailToField.getWindow().showNotification(" ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); return; } boolean errors = false; try { emailToField.validate(); } catch (Validator.InvalidValueException ignore) { errors = true; } try { emailFromField.validate(); } catch (Validator.InvalidValueException ignore) { errors = true; } try { portField.validate(); } catch (Validator.InvalidValueException ignore) { errors = true; } if (errors) { return; } set(API.EMAIL_TO, emailToField.getValue()); set(API.RECEIVER_NAME, receiverNameField.getValue()); set(API.EMAIL_FROM, emailFromField.getValue()); set(API.SENDER_LOGIN, senderLoginField.getValue()); set(API.SENDER_NAME, senderNameField.getValue()); set(API.PASSWORD, passwordField.getValue()); set(API.HOST, hostField.getValue()); set(API.PORT, portField.getValue()); set(API.TLS, tls.getValue()); emailToField.setReadOnly(true); receiverNameField.setReadOnly(true); emailFromField.setReadOnly(true); senderLoginField.setReadOnly(true); senderNameField.setReadOnly(true); passwordField.setReadOnly(true); hostField.setReadOnly(true); portField.setReadOnly(true); tls.setReadOnly(true); save.setVisible(false); cancel.setVisible(false); change.setVisible(true); check.setVisible(true); emailToField.getWindow().showNotification("?? ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); } }); cancel.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { emailToField.setValue(get(API.EMAIL_TO)); receiverNameField.setValue(get(API.RECEIVER_NAME)); emailFromField.setValue(get(API.EMAIL_FROM)); senderLoginField.setValue(get(API.SENDER_LOGIN)); senderNameField.setValue(get(API.SENDER_NAME)); passwordField.setValue(get(API.PASSWORD)); hostField.setValue(get(API.HOST)); portField.setValue(get(API.PORT)); tls.setValue(AdminServiceProvider.getBoolProperty(API.TLS)); emailToField.setReadOnly(true); receiverNameField.setReadOnly(true); emailFromField.setReadOnly(true); senderLoginField.setReadOnly(true); senderNameField.setReadOnly(true); passwordField.setReadOnly(true); hostField.setReadOnly(true); portField.setReadOnly(true); tls.setReadOnly(true); save.setVisible(false); cancel.setVisible(false); change.setVisible(true); check.setVisible(true); } }); FormLayout fields1 = new FormLayout(); fields1.setSizeFull(); fields1.addComponent(senderLoginField); fields1.addComponent(passwordField); fields1.addComponent(hostField); fields1.addComponent(portField); fields1.addComponent(tls); FormLayout fields2 = new FormLayout(); fields2.setSizeFull(); fields2.addComponent(emailToField); fields2.addComponent(receiverNameField); fields2.addComponent(emailFromField); fields2.addComponent(senderNameField); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.setSizeFull(); fields.addComponent(fields1); fields.addComponent(fields2); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(change); buttons.addComponent(save); buttons.addComponent(cancel); buttons.addComponent(check); Label label = new Label("?? "); label.addStyleName(Reindeer.LABEL_H2); emailDates.addComponent(label); emailDates.addComponent(fields); emailDates.addComponent(buttons); emailDates.setExpandRatio(fields, 1f); return panel2; }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
private Panel createMilTaskConfigPanel() { VerticalLayout mailConfig = new VerticalLayout(); mailConfig.setSpacing(true);/*from ww w . j a va 2s. c o m*/ mailConfig.setMargin(true); mailConfig.setSizeFull(); Panel emailTaskPanel = new Panel("?? SMTP ? Email Task", mailConfig); emailTaskPanel.setSizeFull(); final TextField mtDefaultFrom = new TextField("email :"); mtDefaultFrom.setValue(get(API.MT_DEFAULT_FROM)); mtDefaultFrom.setRequired(true); mtDefaultFrom.setReadOnly(true); mtDefaultFrom.addValidator(new EmailValidator(" e-mail ?")); final TextField mtSenderLoginField = new TextField(" ?:"); mtSenderLoginField.setValue(get(API.MT_SENDER_LOGIN)); mtSenderLoginField.setRequired(true); mtSenderLoginField.setReadOnly(true); final PasswordField mtPasswordField = new PasswordField(":"); mtPasswordField.setValue(API.MT_PASSWORD); mtPasswordField.setRequired(true); mtPasswordField.setReadOnly(true); final TextField mtHostField = new TextField("SMTP ?:"); String host = get(API.MT_HOST); mtHostField.setValue(host == null ? "" : host); mtHostField.setRequired(true); mtHostField.setReadOnly(true); final TextField mtPortField = new TextField(":"); String port = get(API.MT_PORT); mtPortField.setValue(port == null ? "" : port); mtPortField.setRequired(true); mtPortField.setReadOnly(true); mtPortField.addValidator(new IntegerValidator(" ")); final CheckBox mtTls = new CheckBox("? TLS", AdminServiceProvider.getBoolProperty(API.MT_TLS)); mtTls.setReadOnly(true); final Button save = new Button(""); save.setVisible(false); final Button cancel = new Button(""); cancel.setVisible(false); final Button change = new Button(""); change.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { mtSenderLoginField.setReadOnly(false); mtDefaultFrom.setReadOnly(false); mtPasswordField.setReadOnly(false); mtHostField.setReadOnly(false); mtPortField.setReadOnly(false); mtTls.setReadOnly(false); change.setVisible(false); save.setVisible(true); cancel.setVisible(true); } }); save.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (StringUtils.isEmpty((String) mtSenderLoginField.getValue()) || StringUtils.isEmpty((String) mtDefaultFrom.getValue()) || StringUtils.isEmpty((String) mtPasswordField.getValue()) || StringUtils.isEmpty((String) mtHostField.getValue()) || mtPortField.getValue() == null) { mtSenderLoginField.getWindow().showNotification(" ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); return; } boolean errors = false; try { mtDefaultFrom.validate(); } catch (Validator.InvalidValueException ignore) { errors = true; } try { mtPortField.validate(); } catch (Validator.InvalidValueException ignore) { errors = true; } if (errors) { return; } set(API.MT_SENDER_LOGIN, mtSenderLoginField.getValue()); set(API.MT_DEFAULT_FROM, mtDefaultFrom.getValue()); set(API.MT_PASSWORD, mtPasswordField.getValue()); set(API.MT_HOST, mtHostField.getValue()); set(API.MT_PORT, mtPortField.getValue()); set(API.MT_TLS, mtTls.getValue()); mtSenderLoginField.setReadOnly(true); mtDefaultFrom.setReadOnly(true); mtPasswordField.setReadOnly(true); mtHostField.setReadOnly(true); mtPortField.setReadOnly(true); mtTls.setReadOnly(true); save.setVisible(false); cancel.setVisible(false); change.setVisible(true); mtSenderLoginField.getWindow().showNotification("?? ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); } }); cancel.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { mtSenderLoginField.setValue(get(API.MT_SENDER_LOGIN)); mtDefaultFrom.setValue(get(API.MT_DEFAULT_FROM)); mtPasswordField.setValue(get(API.MT_PASSWORD)); mtHostField.setValue(get(API.MT_HOST)); mtPortField.setValue(get(API.MT_PORT)); mtTls.setValue(AdminServiceProvider.getBoolProperty(API.MT_TLS)); mtSenderLoginField.setReadOnly(true); mtDefaultFrom.setReadOnly(true); mtPasswordField.setReadOnly(true); mtHostField.setReadOnly(true); mtPortField.setReadOnly(true); mtTls.setReadOnly(true); save.setVisible(false); cancel.setVisible(false); change.setVisible(true); } }); FormLayout leftFields = new FormLayout(); leftFields.setSizeFull(); leftFields.addComponent(mtSenderLoginField); leftFields.addComponent(mtDefaultFrom); leftFields.addComponent(mtPasswordField); leftFields.addComponent(mtHostField); leftFields.addComponent(mtPortField); FormLayout rightFields = new FormLayout(); rightFields.setSizeFull(); rightFields.addComponent(mtTls); HorizontalLayout fieldsLayout = new HorizontalLayout(); fieldsLayout.setSpacing(true); fieldsLayout.setSizeFull(); fieldsLayout.addComponent(leftFields); fieldsLayout.addComponent(rightFields); fieldsLayout.setExpandRatio(leftFields, 0.6f); fieldsLayout.setExpandRatio(rightFields, 0.4f); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(change); buttons.addComponent(save); buttons.addComponent(cancel); Label label = new Label("?? Email Task"); label.addStyleName(Reindeer.LABEL_H2); mailConfig.addComponent(label); mailConfig.addComponent(fieldsLayout); mailConfig.addComponent(buttons); mailConfig.setExpandRatio(fieldsLayout, 1f); return emailTaskPanel; }