List of usage examples for com.vaadin.ui TwinColSelect setRows
public void setRows(int rows)
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);// ww w.ja v a 2 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);/*w ww . ja v a2 s. c o 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.ripla.web.demo.widgets.views.SelectionWidgetsView.java
License:Open Source License
public SelectionWidgetsView(final CountryContainer inCountries) { super();//from w w w.j av a 2 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); }