List of usage examples for com.vaadin.ui TwinColSelect TwinColSelect
public TwinColSelect()
From source file:org.jumpmind.metl.ui.views.admin.GroupEditPanel.java
License:Open Source License
public GroupEditPanel(ApplicationContext context, Group group) { this.context = context; this.group = group; FormLayout layout = new FormLayout(); TextField nameField = new TextField("Group Name", StringUtils.trimToEmpty(group.getName())); nameField.addValueChangeListener(new NameChangeListener()); layout.addComponent(nameField);//from w w w.j av a2 s . c o m nameField.focus(); CheckBox readOnly = new CheckBox("Read Only"); readOnly.setImmediate(true); readOnly.setValue(group.isReadOnly()); readOnly.addValueChangeListener(new ReadOnlyChangeListener()); layout.addComponent(readOnly); TwinColSelect privSelect = new TwinColSelect(); for (Privilege priv : Privilege.values()) { privSelect.addItem(priv.name()); } lastPrivs = new HashSet<String>(); for (GroupPrivilege groupPriv : group.getGroupPrivileges()) { lastPrivs.add(groupPriv.getName()); } privSelect.setValue(lastPrivs); privSelect.setRows(20); privSelect.setNullSelectionAllowed(true); privSelect.setMultiSelect(true); privSelect.setImmediate(true); privSelect.setLeftColumnCaption("Available privileges"); privSelect.setRightColumnCaption("Selected privileges"); privSelect.addValueChangeListener(new PrivilegeChangeListener()); layout.addComponent(privSelect); addComponent(layout); setMargin(true); }
From source file:org.jumpmind.metl.ui.views.admin.UserEditPanel.java
License:Open Source License
public UserEditPanel(ApplicationContext context, User user) { this.context = context; this.user = user; FormLayout form = new FormLayout(); form.setSpacing(true);//from ww w . jav a 2s .co m TextField loginField = new TextField("Login ID", StringUtils.trimToEmpty(user.getLoginId())); form.addComponent(loginField); loginField.addValueChangeListener(new LoginChangeListener()); loginField.focus(); TextField nameField = new TextField("Full Name", StringUtils.trimToEmpty(user.getName())); nameField.addValueChangeListener(new NameChangeListener()); form.addComponent(nameField); PasswordField passwordField = new PasswordField("Password", NOCHANGE); passwordField.addValueChangeListener(new PasswordChangeListener()); form.addComponent(passwordField); List<Group> groups = context.getConfigurationService().findGroups(); groupsById = new HashMap<String, Group>(); TwinColSelect groupSelect = new TwinColSelect(); for (Group group : groups) { groupSelect.addItem(group.getId()); groupSelect.setItemCaption(group.getId(), group.getName()); groupsById.put(group.getId(), group); } lastGroups = new HashSet<String>(); for (Group group : user.getGroups()) { lastGroups.add(group.getId()); } groupSelect.setValue(lastGroups); groupSelect.setRows(20); groupSelect.setNullSelectionAllowed(true); groupSelect.setMultiSelect(true); groupSelect.setImmediate(true); groupSelect.setLeftColumnCaption("Available groups"); groupSelect.setRightColumnCaption("Selected groups"); groupSelect.addValueChangeListener(new GroupChangeListener()); form.addComponent(groupSelect); addComponent(form); setMargin(true); }
From source file:org.lunarray.model.generation.vaadin.render.factories.form.vaadin.components.ShuttleSelectPropertyStrategy.java
License:Open Source License
/** {@inheritDoc} */ @Override protected Component createSelectComponent() { return new TwinColSelect(); }
From source file:org.ripla.web.demo.widgets.views.SelectionWidgetsView.java
License:Open Source License
public SelectionWidgetsView(final CountryContainer inCountries) { super();//from ww w. j a va2 s .c o m final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "widgets.title.page.select"); //$NON-NLS-1$ final HorizontalLayout lColumns = new HorizontalLayout(); lColumns.setSpacing(true); lLayout.addComponent(lColumns); final VerticalLayout lCol1 = new VerticalLayout(); lCol1.setSizeUndefined(); lColumns.addComponent(lCol1); final VerticalLayout lCol2 = new VerticalLayout(); lCol2.setSizeUndefined(); lColumns.addComponent(lCol2); final VerticalLayout lCol3 = new VerticalLayout(); lCol3.setSizeUndefined(); lColumns.addComponent(lCol3); lColumns.setExpandRatio(lCol3, 1); lCol1.addComponent(getSubtitle(lMessages.getMessage("widgets.selection.subtitle.list"))); //$NON-NLS-1$ final ListSelect lList1 = new ListSelect(null, inCountries); lList1.setItemCaptionMode(ItemCaptionMode.ID); lList1.setRows(10); lList1.setMultiSelect(true); lList1.setNullSelectionAllowed(false); lList1.select(inCountries.getIdByIndex(0)); lList1.setImmediate(true); lList1.addValueChangeListener(new Listener()); lCol1.addComponent(lList1); lCol1.addComponent(getSubtitle(lMessages.getMessage("widgets.selection.subtitle.combox"))); //$NON-NLS-1$ final ComboBox lCombo = new ComboBox(null, inCountries); lCombo.setInputPrompt(lMessages.getMessage("widgets.selection.combox.prompt")); //$NON-NLS-1$ lCombo.setNullSelectionAllowed(false); lCombo.setFilteringMode(FilteringMode.STARTSWITH); lCombo.setImmediate(true); lCombo.addValueChangeListener(new Listener()); lCol1.addComponent(lCombo); lCol2.addComponent(getSubtitle(lMessages.getMessage("widgets.selection.subtitle.options.single"))); //$NON-NLS-1$ List<String> lCountries = getRandomSubset(inCountries, OPTION_SIZE, System.currentTimeMillis()); final OptionGroup lOptions1 = new OptionGroup(null, lCountries); lOptions1.setNullSelectionAllowed(false); lOptions1.select(lCountries.get(0)); lOptions1.setImmediate(true); lOptions1.addValueChangeListener(new Listener()); lCol2.addComponent(lOptions1); lCol2.addComponent(getSubtitle(lMessages.getMessage("widgets.selection.subtitle.options.multiple"))); //$NON-NLS-1$ lCountries = getRandomSubset(inCountries, OPTION_SIZE, System.currentTimeMillis() + 2000); final OptionGroup lOptions2 = new OptionGroup(null, lCountries); lOptions2.setNullSelectionAllowed(false); lOptions2.setMultiSelect(true); lOptions2.select(lCountries.get(0)); lOptions2.setImmediate(true); lOptions2.addValueChangeListener(new Listener()); lCol2.addComponent(lOptions2); lCol3.addComponent(getSubtitle(lMessages.getMessage("widgets.selection.subtitle.twin"))); //$NON-NLS-1$ final TwinColSelect lCountrySelect = new TwinColSelect(); lCountrySelect.setContainerDataSource(inCountries); lCountrySelect.setRows(OPTION_SIZE); lCountrySelect.setNullSelectionAllowed(true); lCountrySelect.setMultiSelect(true); lCountrySelect.setWidth(400, Unit.PIXELS); lCol3.addComponent(lCountrySelect); }
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 . c o 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.codeinside.adm.ui.TreeTableOrganization.java
License:Mozilla Public License
void createGroupEditor(final long id, final Set<String> names) { final Organization org = AdminServiceProvider.get().findOrganizationById(id); final Set<String> all = AdminServiceProvider.get().getOrgGroupNames(); final VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*from www . j av a 2s . co m*/ final TwinColSelect twin = new TwinColSelect(); twin.setSizeFull(); twin.setNullSelectionAllowed(true); twin.setLeftColumnCaption("?"); twin.setRightColumnCaption(" ? " + org.getName()); twin.setImmediate(true); for (final String name : all) { twin.addItem(name); if (names.contains(name)) { twin.select(name); } } layout.addComponent(twin); final HorizontalLayout h = new HorizontalLayout(); h.setSpacing(true); Button cancel = new Button("", new Button.ClickListener() { private static final long serialVersionUID = -2885182304929510066L; @Override public void buttonClick(Button.ClickEvent event) { showOrganization(id); } }); cancel.setClickShortcut(KeyCode.ESCAPE, 0); Button ok = new Button("", new Button.ClickListener() { private static final long serialVersionUID = -3182280627040233669L; @Override public void buttonClick(Button.ClickEvent event) { AdminServiceProvider.get().setOrgGroupNames(id, new TreeSet<String>((Collection<String>) twin.getValue())); showOrganization(id); } }); ok.setClickShortcut(KeyCode.O, ModifierKey.CTRL); h.addComponent(ok); h.addComponent(cancel); layout.addComponent(h); layout.setSizeFull(); panel.removeAllComponents(); panel.addComponent(layout); twin.focus(); }