List of usage examples for com.vaadin.ui FormLayout FormLayout
public FormLayout()
From source file:org.sensorhub.ui.SWECommonFormBuilder.java
License:Mozilla Public License
public Panel buildForm(DataComponent dataComponent) { FormLayout layout = new FormLayout(); for (int i = 0; i < dataComponent.getComponentCount(); i++) { DataComponent c = dataComponent.getComponent(i); Component w = buildWidget(c); if (w != null) layout.addComponent(w);//from www .j a v a2s.co m } Panel panel = new Panel(); panel.setContent(layout); return panel; }
From source file:org.sensorhub.ui.SWECommonFormBuilder.java
License:Mozilla Public License
protected Component buildWidget(DataComponent dataComponent) { if (dataComponent instanceof DataRecord) { DataRecord dataRecord = (DataRecord) dataComponent; FormLayout layout = new FormLayout(); for (int i = 0; i < dataRecord.getComponentCount(); i++) { DataComponent c = dataRecord.getComponent(i); Component w = buildWidget(c); if (w != null) layout.addComponent(w);/*w w w. j av a 2 s .c o m*/ } Panel panel = new Panel(); panel.setCaption(getPrettyName(dataComponent)); panel.setContent(layout); return panel; } else if (dataComponent instanceof DataArray) { DataArray dataArray = (DataArray) dataComponent; VerticalLayout layout = new VerticalLayout(); layout.addComponent(new Label(getPrettyName(dataArray))); layout.addComponent(buildWidget(dataArray.getElementType())); return layout; } else if (dataComponent instanceof DataChoice) { } else if (dataComponent instanceof Quantity) { Label c = new Label(); c.setCaption(getPrettyName(dataComponent)); c.setDescription(dataComponent.getDescription()); return c; } return null; }
From source file:org.vaadin.spring.samples.security.shared.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();// www .ja v a 2s .c o m userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:pl.adrian.pieper.biuwaw.NewPartyView.java
private AbstractComponent createNewGuestForm() { final FormLayout newGuestForm = new FormLayout(); final Guest guest = new Guest(); final FieldGroup fieldGroup = new FieldGroup(new BeanItem(guest)); fieldGroup.setBuffered(false);/*from w w w .j ava2s. c o m*/ final Button addButton = new Button("Nowy Go"); addButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { if (fieldGroup.isValid()) { fieldGroup.commit(); guests.addBean(new Guest(guest)); } } catch (FieldGroup.CommitException ex) { Logger.getLogger(MainUI.class.getName()).log(Level.SEVERE, null, ex); } } }); final Field<?> emailfield = fieldGroup.buildAndBind("adres e-mail", "email"); emailfield.addValidator(new EmailValidator("Nieprawidlowy adres e-mail")); emailfield.setRequired(true); newGuestForm.addComponents(new Label(), emailfield, addButton); return newGuestForm; }
From source file:pl.adrian.pieper.biuwaw.NewPartyView.java
private AbstractComponent createGiftEditor() { final FormLayout formLayout = new FormLayout(); editedGift.setBuffered(false);//from www.j a v a 2s . c om final Button editButton = new Button("Zatwierd"); editButton.addClickListener((event) -> { try { editedGift.commit(); } catch (FieldGroup.CommitException ex) { Logger.getLogger(MainUI.class.getName()).log(Level.SEVERE, null, ex); } }); formLayout.addComponents(new Label("Edytor"), editedGift.buildAndBind("name"), editButton); formLayout.setMargin(true); return formLayout; }
From source file:pl.exsio.frameset.vaadin.account.window.view.AccountWindowView.java
License:Open Source License
private FormLayout createForm() { this.form = new Form(); this.form.setFormFieldFactory(new FramesetFieldFactory(UserImpl.class)); this.form.setItemDataSource(this.item, Arrays.asList(FIELD_USERNAME, FIELD_FIRST_NAME, FIELD_lAST_NAME, FIELD_PHONE_NO)); this.form.setBuffered(true); this.form.getField(FIELD_USERNAME) .addValidator(new EmailValidator(t("core.management.users.invalid_username"))); Field passwordField = this.createPasswordField(); this.form.addField(FIELD_PASSWORD, passwordField); Field passwordFieldRepeated = this.createPasswordRepeatedField(); this.form.addField(FIELD_PASSWORD_REPEATED, passwordFieldRepeated); FormLayout formLayout = new FormLayout(); formLayout.addComponent(this.form); formLayout.setMargin(true);/*from w w w . j a v a 2 s . co m*/ HorizontalLayout controls = this.createFormControls(); formLayout.addComponent(controls); return formLayout; }
From source file:pl.exsio.frameset.vaadin.module.management.roles.RolesDataTable.java
License:Open Source License
@Override protected Layout decorateForm(TabbedForm form, EntityItem<? extends Role> item, int mode) { form.init(this.getTabsConfig()); form.getLayout().setWidth("400px"); FormLayout formLayout = new FormLayout(); FramesetFieldFactory<? extends Role> ff = new FramesetFieldFactory<>(this.securityEntities.getRoleClass(), this.getClass()); ff.setMultiSelectType(this.securityEntities.getRoleClass(), OptionGroup.class); form.setFormFieldFactory(ff);/* w w w. j a va2s .c o m*/ form.setItemDataSource(item, Arrays.asList(new String[] { "name", "label", "childRoles" })); item.getEntity().setOldName(item.getEntity().getName()); form.setBuffered(true); formLayout.addComponent(form); return formLayout; }
From source file:pl.exsio.frameset.vaadin.module.util.usergen.UserGenModule.java
License:Open Source License
private Form getGeneratorForm() { Form form = new Form(); form.addField("usernamePrefix", createUsernamePrefixField()); form.addField("usernameSuffix", createUsernameSuffixField()); form.addField("from", createFromField()); form.addField("to", createToField()); form.addField("groups", createGroupsField()); form.addField("roles", createRolesField()); form.setBuffered(true);/*from ww w . jav a 2 s .c o m*/ FormLayout layout = new FormLayout(); layout.setMargin(true); form.setLayout(layout); return form; }
From source file:pl.exsio.frameset.vaadin.ui.support.component.data.common.DataComponent.java
License:Open Source License
protected Layout decorateForm(F form, I item, int mode) { return new FormLayout(); }
From source file:pl.exsio.frameset.vaadin.ui.support.component.data.form.SecurityPermissionsForm.java
License:Open Source License
@Override protected void doInit() { this.setMargin(true); final JPAContainer<? extends Role> roles = JPAContainerFactory.make(this.getRoleClass(), this.entityProvider.getEntityManager()); ComboBox roleSelect = new ComboBox(t("core.security.management.roles"), roles); roleSelect.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); roleSelect.setItemCaptionPropertyId("label"); this.addComponent(roleSelect); final FormLayout permissionsLayout = new FormLayout(); this.addComponent(permissionsLayout); final Map<String, Permission> permissionsMap = this.permissionMapProvider.getPermissionMap(); this.handleRoleSelectionChange(roleSelect, permissionsLayout, roles, permissionsMap); }