List of usage examples for com.vaadin.ui ListSelect setRows
public void setRows(int rows)
From source file:com.esofthead.mycollab.module.project.view.TimeTrackingSummaryViewImpl.java
License:Open Source License
private void initListSelectStyle(ListSelect listSelect) { listSelect.setWidth("300px"); listSelect.setItemCaptionMode(ItemCaptionMode.EXPLICIT); listSelect.setNullSelectionAllowed(false); listSelect.setMultiSelect(true);/*www.j a va 2 s . c om*/ listSelect.setRows(4); }
From source file:com.expressui.core.view.field.FormField.java
License:Open Source License
/** * Sets the dimensions of a multi-select menu * * @param rows height// w w w .ja va 2 s .c om * @param columns width */ public void setMultiSelectDimensions(int rows, int columns) { Field field = getField(); Assert.PROGRAMMING.instanceOf(field, ListSelect.class, "property " + getTypeAndPropertyId() + " is not a AbstractSelect field"); ListSelect selectField = (ListSelect) field; selectField.setRows(rows); selectField.setColumns(columns); }
From source file:com.purebred.core.view.field.FormField.java
License:Open Source License
/** * Set the dimensions of a multi-select menu * * @param rows height//from w w w .j a v a 2 s. co m * @param columns width */ public void setMultiSelectDimensions(int rows, int columns) { Field field = getField(); Assert.PROGRAMMING.assertTrue(field instanceof ListSelect, "property " + getPropertyId() + " is not a AbstractSelect field"); ListSelect selectField = (ListSelect) field; selectField.setRows(rows); selectField.setColumns(columns); }
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultFormView.java
License:Apache License
private Field<?> createMultiSelect(MultiOptionListFormField field) { ListSelect select = new ListSelect(field.getTitle()); fillOptions(field.getOptionList(), select, new FormSelectionContext(field)); // addOptionListChangeListener(field, select, new FormSelectionContext( // field));/*from ww w . ja v a2s . com*/ select.setMultiSelect(true); select.setPropertyDataSource(field.getListProperty()); select.setInvalidAllowed(false); select.setImmediate(true); select.setRows(field.getVisibleRows()); select.addStyleName(field.getName()); return select; }
From source file:org.hip.vif.admin.admin.ui.PrintGroupView.java
License:Open Source License
/** Constructor * * @param inGroups {@link GroupContainer} * @param inTask {@link PrintGroupTask} */ public PrintGroupView(final GroupContainer inGroups, final PrintGroupTask inTask) { final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.print.title.page"); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("admin.print.remark"), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(RiplaViewHelper.createSpacer()); final LabelValueTable lTable = new LabelValueTable(); final ListSelect lGroups = new ListSelect(); lGroups.setContainerDataSource(inGroups); lGroups.setRows(Math.min(SELECT_SIZE, inGroups.size())); lGroups.setStyleName(VIF_STYLE);/* w ww.j av a 2s .c om*/ lGroups.setMultiSelect(true); lGroups.setItemCaptionMode(ItemCaptionMode.PROPERTY); lGroups.setItemCaptionPropertyId(GroupContainer.PROPERTY_CAPTION); lGroups.focus(); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.select"), lGroups); //$NON-NLS-1$ lLayout.addComponent(lTable); final FileDownloaderExtension lDownloader = new FileDownloaderExtension(lGroups, inTask); final Button lPrint = new Button(lMessages.getMessage("admin.print.button.print")); //$NON-NLS-1$ lDownloader.extend(lPrint); lLayout.addComponent(lPrint); }
From source file:org.hip.vif.admin.admin.ui.SendMailView.java
License:Open Source License
/** @param inGroups {@link GroupContainer} * @param inTask {@link SendMailTask} */ public SendMailView(final GroupContainer inGroups, final SendMailTask inTask) { final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.send.mail.title.page"); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("admin.send.remark"), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(RiplaViewHelper.createSpacer()); final LabelValueTable lTable = new LabelValueTable(); final ListSelect lGroups = new ListSelect(); lGroups.setContainerDataSource(inGroups); lGroups.setRows(Math.min(SELECT_SIZE, inGroups.size())); lGroups.setStyleName(VIF_STYLE);/*from w w w . j av a2s .co m*/ lGroups.setMultiSelect(true); lGroups.setItemCaptionMode(ItemCaptionMode.PROPERTY); lGroups.setItemCaptionPropertyId(GroupContainer.PROPERTY_CAPTION); lGroups.focus(); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.select"), lGroups); //$NON-NLS-1$ final TextField lSubject = new TextField(); lSubject.setWidth(WIDTH, Unit.PIXELS); lSubject.setStyleName(VIF_STYLE); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.subject"), lSubject); //$NON-NLS-1$ final RichTextArea lBody = new RichTextArea(); lBody.setStyleName("vif-editor " + VIF_STYLE); //$NON-NLS-1$ lBody.setWidth(WIDTH, Unit.PIXELS); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.body"), lBody); //$NON-NLS-1$ lLayout.addComponent(lTable); send = new Button(lMessages.getMessage("admin.send.mail.button.send")); //$NON-NLS-1$ // send.setClickShortcut(KeyCode.ENTER); send.addClickListener(new Button.ClickListener() { @Override @SuppressWarnings("unchecked") public void buttonClick(final ClickEvent inEvent) { if (!isValid(lGroups, lSubject, lBody)) { Notification.show(lMessages.getMessage("admin.send.mail.msg.not.valid"), //$NON-NLS-1$ Type.WARNING_MESSAGE); return; } if (!inTask.processGroups((Collection<GroupWrapper>) lGroups.getValue(), lSubject.getValue().toString(), lBody.getValue())) { Notification.show(lMessages.getMessage("admin.send.mail.msg.errmsg"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lLayout.addComponent(send); }
From source file:org.jumpmind.metl.ui.views.deploy.EditAgentDeploymentPanel.java
License:Open Source License
protected ListSelect getScheduleComponent(String caption) { ListSelect listSelect = new ListSelect(caption); listSelect.setWidth(90, Unit.PIXELS); listSelect.setMultiSelect(true);/*ww w .j a v a 2s. c om*/ listSelect.setRows(10); listSelect.setImmediate(true); listSelect.addItem("*"); listSelect.setItemCaption("*", "<All>"); if (caption.equals("Second") || caption.equals("Minute")) { for (int i = 0; i <= 59; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Hour")) { for (int i = 0; i <= 23; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Day")) { for (int i = 1; i <= 31; i++) { listSelect.addItem(String.valueOf(i)); } } else if (caption.equals("Month")) { listSelect.addItems("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"); } else if (caption.equals("Day of Week")) { listSelect.addItems("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"); } else if (caption.equals("Year")) { for (int i = Calendar.getInstance().get(Calendar.YEAR); i <= 2099; i++) { listSelect.addItem(String.valueOf(i)); } } listSelect.select(listSelect.getItemIds().iterator().next()); listSelect.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { updateScheduleExpression(); } }); return listSelect; }
From source file:org.jumpmind.metl.ui.views.design.ChooseWsdlServiceOperationWindow.java
License:Open Source License
public ChooseWsdlServiceOperationWindow(List<SoapOperation> operations, final ServiceChosenListener listener) { setCaption("Choose SOAP Operation"); setModal(true);//from w ww . j av a 2s . c o m setResizable(false); setSizeUndefined(); setClosable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); setContent(layout); layout.addComponent(new Label("Choose the SOAP operation to use.")); final ListSelect field = new ListSelect(); field.setNullSelectionAllowed(false); field.setMultiSelect(false); field.setWidth(100, Unit.PERCENTAGE); field.setRows(15); layout.addComponent(field); Collections.sort(operations, new Comparator<SoapOperation>() { public int compare(SoapOperation o1, SoapOperation o2) { return o1.getOperationName().compareTo(o2.getOperationName()); } }); for (SoapOperation operation : operations) { field.addItem(operation); field.setItemCaption(operation, operation.getBindingName().getLocalPart() + "." + operation.getOperationName()); } HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth(100, Unit.PERCENTAGE); Label spacer = new Label(" "); buttonLayout.addComponent(spacer); buttonLayout.setExpandRatio(spacer, 1); Button cancelButton = new Button("Cancel"); cancelButton.setClickShortcut(KeyCode.ESCAPE); cancelButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(ChooseWsdlServiceOperationWindow.this); } }); buttonLayout.addComponent(cancelButton); Button okButton = new Button("Ok"); okButton.setClickShortcut(KeyCode.ENTER); okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { if (listener.onOk((SoapOperation) field.getValue())) { UI.getCurrent().removeWindow(ChooseWsdlServiceOperationWindow.this); } } }); buttonLayout.addComponent(okButton); layout.addComponent(buttonLayout); field.focus(); }
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 a va 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); }
From source file:org.sensorhub.ui.GenericConfigForm.java
License:Mozilla Public License
protected Component buildSimpleTable(final String propId, final ContainerProperty prop) { String label = prop.getLabel(); if (label == null) label = DisplayUtils.getPrettyName((String) propId); final MyBeanItemContainer<Object> container = prop.getValue(); final ListSelect listBox = new ListSelect(label, container); listBox.setValue(container);// w w w . ja va2 s . c om listBox.setItemCaptionMode(ItemCaptionMode.PROPERTY); listBox.setItemCaptionPropertyId(MyBeanItem.PROP_VALUE); listBox.setImmediate(true); listBox.setBuffered(true); listBox.setNullSelectionAllowed(false); listBox.setDescription(prop.getDescription()); listBox.setWidth(500, Unit.PIXELS); listBox.setRows(Math.max(2, Math.min(5, container.size()))); FieldWrapper<Object> field = new FieldWrapper<Object>(listBox) { private static final long serialVersionUID = 1499878131611223989L; protected Component initContent() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); // inner field layout.addComponent(innerField); layout.setComponentAlignment(innerField, Alignment.MIDDLE_LEFT); VerticalLayout buttons = new VerticalLayout(); layout.addComponent(buttons); // add button Button addBtn = new Button(ADD_ICON); addBtn.addStyleName(STYLE_QUIET); addBtn.addStyleName(STYLE_SMALL); buttons.addComponent(addBtn); addBtn.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { ValueEntryPopup popup = new ValueEntryPopup(500, new ValueCallback() { @Override public void newValue(String value) { container.addBean(value); // grow list size with max at 5 listBox.setRows(Math.max(2, Math.min(5, container.size()))); } }); popup.setModal(true); AdminUI.getInstance().addWindow(popup); } }); // remove button Button delBtn = new Button(DEL_ICON); delBtn.addStyleName(STYLE_QUIET); delBtn.addStyleName(STYLE_SMALL); buttons.addComponent(delBtn); delBtn.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { Object itemId = listBox.getValue(); container.removeItem(itemId); } }); return layout; } @Override public void commit() throws SourceException, InvalidValueException { // override commit here because the ListSelect setValue() method // only sets the index of the selected item, and not the list content prop.setValue(container); } }; return field; }