List of usage examples for com.vaadin.ui ComboBox ComboBox
public ComboBox(String caption, Collection<T> options)
From source file:org.adho.dhconvalidator.ui.PaperSelectionPanel.java
/** Setup UI. */ private void initComponents() { Label info = new Label(Messages.getString("PaperSelectionPanel.hintMsg"), ContentMode.HTML); languages = new ComboBox(Messages.getString("PaperSelectionPanel.language"), Arrays.asList(SubmissionLanguage.values())); languages.setNullSelectionAllowed(false); languages.setValue(SubmissionLanguage .valueOf(PropertyKey.defaultSubmissionLanguage.getValue(SubmissionLanguage.ENGLISH.name()))); paperTable = new Table(Messages.getString("PaperSelectionPanel.tableTitle")); paperTable.setSelectable(true);// w ww.j a va 2 s . c om paperTable.setMultiSelect(true); paperTable.setPageLength(4); paperTable.addContainerProperty("title", String.class, null); paperTable.setColumnHeader("title", Messages.getString("PaperSelectionPanel.titleColumnTitle")); paperTable.setWidth("100%"); paperTable.setImmediate(true); btGenerate = new Button(Messages.getString("PaperSelectionPanel.generateButtonCaption")); StreamResource templateStreamResource = new StreamResource(new StreamSource() { @Override public InputStream getStream() { return createTemplates(); } }, "your_personal_dh_templates.zip"); templateStreamResource.setCacheTime(0); new FileDownloader(templateStreamResource).extend(btGenerate); addCenteredComponent(info); addCenteredComponent(languages); addCenteredComponent(paperTable); addCenteredComponent(btGenerate); postDownloadLabel = new Label( Messages.getString("PaperSelectionPanel.postDownloadInfo", inputConverter.getTextEditorDescription(), PropertyKey.base_url.getValue() + "popup/DHConvalidatorServices#!converter"), ContentMode.HTML); postDownloadLabel.addStyleName("postDownloadInfoRedAndBold"); postDownloadLabel.setVisible(false); addCenteredComponent(postDownloadLabel); }
From source file:org.eclipse.skalli.view.component.MultiComboBox.java
License:Open Source License
private ComboBox createComboBox(UUID uuid) { ComboBox comboBox = new ComboBox(null, new ProjectDataSource()); comboBox.setImmediate(true);// ww w. j a v a 2 s. c o m if (description != null) { comboBox.setDescription(description); } if (inputPrompt != null) { comboBox.setInputPrompt(inputPrompt); } if (uuid != null) { ProjectService projectService = ((ProjectService) EntityServices.getByEntityClass(Project.class)); Project project = projectService.getByUUID(uuid); comboBox.select(project); } return comboBox; }
From source file:org.eclipse.skalli.view.component.PhaseSelect.java
License:Open Source License
private Layout createLayout(boolean showDeletedCheckbox) { final FloatLayout layout = new FloatLayout(); cb = new ComboBox(null, phases); cb.setImmediate(true);// w w w . java 2s . co m layout.addComponent(cb); if (showDeletedCheckbox) { deleted = new CheckBox("Deleted", project.isDeleted()); deleted.setImmediate(true); layout.addComponent(deleted, "margin-left:20px;margin-top:3px"); } return layout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
/** * @param property// w ww .j a va2 s . c o m * @return */ public static AbstractComponent createStaticComboBoxFieldFromLabel(Property property) { Preconditions.checkNotNull(property, "Datasource is null"); final ComboBox comboBox = new ComboBox(null, ELabsFileFormatsEnum.toList()); comboBox.setEnabled(true); comboBox.setVisible(true); comboBox.setImmediate(true); comboBox.setMultiSelect(false); comboBox.setNullSelectionAllowed(false); comboBox.setPropertyDataSource(property); comboBox.setReadOnly(false); comboBox.setWidth(COMBOBOX_WIDTH); comboBox.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); comboBox.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); return comboBox; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
/** * @param property/*from w w w.j a v a 2s . com*/ * @return */ @SuppressWarnings("serial") public static AbstractComponent createDynamicComboBoxFieldForInvestigation( final ILabsInvestigationAction labsInvestigationAction, Property property, String itemCaptionProperty, final Container itemContainer) { Preconditions.checkNotNull(labsInvestigationAction, "LabsInvestigationAction is null"); Preconditions.checkNotNull(itemContainer, "ItemContainer is null"); try { final ComboBox comboBox = new ComboBox(StringUtils.EMPTY_STRING, itemContainer); if (property != null && itemCaptionProperty == null) { comboBox.setPropertyDataSource(property); } else if (property == null && itemCaptionProperty != null) { comboBox.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY); comboBox.setItemCaptionPropertyId(itemCaptionProperty); } comboBox.setEnabled(true); comboBox.setVisible(true); comboBox.setImmediate(true); comboBox.setMultiSelect(false); comboBox.setNullSelectionAllowed(false); comboBox.setReadOnly(false); comboBox.setWidth(COMBOBOX_WIDTH); comboBox.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); comboBox.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); comboBox.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if ((comboBox.getValue() instanceof String)) { return; } else if (comboBox.getValue() instanceof RigBean) { labsInvestigationAction.setRigBean((RigBean) comboBox.getValue()); } else if (comboBox.getValue() instanceof UserBean) { labsInvestigationAction.setInvestigator(((UserBean) comboBox.getValue()).getId()); } else { LOG.error("Wrong data type in combobox"); } } }); return comboBox; } catch (Exception e) { LOG.error(e.getMessage()); } return null; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
/** * @param property/* w ww .j a v a 2s . c om*/ * @return */ @SuppressWarnings("serial") public static AbstractComponent createDynamicComboBoxFieldForInstrument( final ILabsInstrumentAction labsInstrumentAction, Property property, String itemCaptionProperty, final Container itemContainer) { Preconditions.checkNotNull(labsInstrumentAction, "LabsInstrumentAction is null"); Preconditions.checkNotNull(itemContainer, "ItemContainer is null"); if (property == null && itemCaptionProperty == null) { LOG.debug("No given datasource at ComboBox!"); } try { final ComboBox comboBox = new ComboBox(StringUtils.EMPTY_STRING, itemContainer); if (property != null && itemCaptionProperty == null) { comboBox.setPropertyDataSource(property); } else if (property == null && itemCaptionProperty != null) { comboBox.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY); comboBox.setItemCaptionPropertyId(itemCaptionProperty); } comboBox.setEnabled(true); comboBox.setVisible(true); comboBox.setImmediate(true); comboBox.setMultiSelect(false); comboBox.setNullSelectionAllowed(false); comboBox.setReadOnly(false); comboBox.setWidth(COMBOBOX_WIDTH); comboBox.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); comboBox.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); comboBox.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if ((comboBox.getValue() instanceof String)) { } else if (comboBox.getValue() instanceof UserBean) { labsInstrumentAction.setDeviceSupervisor(((UserBean) comboBox.getValue()).getId()); } else if (comboBox.getValue() instanceof OrgUnitBean) { labsInstrumentAction.setInstitute(((OrgUnitBean) comboBox.getValue()).getId()); } else if (comboBox.getValue() instanceof FileFormatBean) { labsInstrumentAction.setFileFormat(((FileFormatBean) comboBox.getValue()).getMimeType()); } else { LOG.error("Wrong data type in combobox"); } } }); return comboBox; } catch (Exception e) { LOG.error(e.getMessage()); } return null; }
From source file:org.hip.vif.admin.admin.ui.SkinSelectView.java
License:Open Source License
/** * Constructor./*from w w w .ja va 2 s.c o m*/ * * @param inTask * {@link SkinSelectTask} */ public SkinSelectView(final SkinSelectTask inTask) { final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.select.skin.title.page"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-title", //$NON-NLS-1$ lMessages.getMessage("admin.select.skin.selection")), ContentMode.HTML)); //$NON-NLS-1$ skinSelect = new ComboBox(null, SkinConfigRegistry.INSTANCE.getSkins()); skinSelect.setNullSelectionAllowed(false); skinSelect.setNewItemsAllowed(false); skinSelect.setWidth(230, Unit.PIXELS); skinSelect.focus(); lLayout.addComponent(skinSelect); final Button lSave = new Button(lMessages.getMessage("admin.select.skin.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { inTask.save((SkinBean) skinSelect.getValue()); } }); lSave.setClickShortcut(KeyCode.ENTER); lLayout.addComponent(lSave); }
From source file:org.hip.vif.web.util.DBDriverSelect.java
License:Open Source License
/** Create the <code>Select</code> widget containing the registered DB drivers. * * @param inProperty {@link Property}/*www . j a v a 2 s. co m*/ * @param inWidth int * @param inAllowNull boolean * @param inProcessor {@link IProcessor} may be <code>null</code> * @return {@link ComboBox} */ @SuppressWarnings("serial") public static ComboBox getDBDriverSelection(final Property<String> inProperty, final int inWidth, final boolean inAllowNull, final IProcessor inProcessor) { final DBDriverContainer lContainer = DBDriverContainer .getDBDriverSelection(inProperty.getValue().toString()); final ComboBox outSelect = new ComboBox(null, lContainer); outSelect.select(lContainer.getActiveDriver()); outSelect.setStyleName("vif-select"); //$NON-NLS-1$ outSelect.setWidth(inWidth, Unit.PIXELS); outSelect.setNullSelectionAllowed(inAllowNull); outSelect.setImmediate(true); outSelect.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { final String lItemID = ((DBDriverBean) inEvent.getProperty().getValue()).getID(); inProperty.setValue(lItemID); if (inProcessor != null) { inProcessor.process(lItemID); } } }); return outSelect; }
From source file:org.hip.vif.web.util.DBDriverSelect.java
License:Open Source License
@SuppressWarnings("serial") public static ComboBox getDBDriverSelection(final int inWidth, final boolean inAllowNull, final IProcessor inProcessor) { final ComboBox outSelect = new ComboBox(null, getDbDrivers()); outSelect.setStyleName("vif-select"); //$NON-NLS-1$ outSelect.setWidth(inWidth, Unit.PIXELS); outSelect.setNullSelectionAllowed(inAllowNull); outSelect.setImmediate(true);// www. j a v a2 s . c om outSelect.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { final String lItemID = ((DBDriverBean) inEvent.getProperty().getValue()).getID(); if (inProcessor != null) { inProcessor.process(lItemID); } } }); return outSelect; }
From source file:org.hip.vif.web.util.LanguageSelectHelper.java
License:Open Source License
/** Convenience method, create a language select containing the available languages. * * @param inActiveLanguage String/*w w w . java2s. co m*/ * @return {@link ComboBox} */ private static ComboBox createSelect(final String inActiveLanguage) { final LanguagesContainer lLanguages = LanguagesContainer.getLanguages(Constants.LANGUAGES, inActiveLanguage); final ComboBox outSelect = new ComboBox(null, lLanguages); outSelect.select(lLanguages.getActiveLanguage()); outSelect.setStyleName("vif-select"); //$NON-NLS-1$ outSelect.setWidth(55, Unit.PIXELS); outSelect.setNullSelectionAllowed(false); outSelect.setImmediate(true); return outSelect; }