@Override public Field<?> createField(Container container, Object itemId, Object propertyId, Component uiContext) { if (propertyId.equals("mename")) { final ComboBox field = new ComboBox(); field.setSizeFull(); field.setRequired(true); field.setImmediate(true); field.setNullSelectionAllowed(false); field.setNewItemsAllowed(false); field.addItem(Maskelement.TAG_UEI); field.addItem(Maskelement.TAG_SOURCE); field.addItem(Maskelement.TAG_NODEID); field.addItem(Maskelement.TAG_HOST); field.addItem(Maskelement.TAG_INTERFACE); field.addItem(Maskelement.TAG_SNMPHOST); field.addItem(Maskelement.TAG_SERVICE); field.addItem(Maskelement.TAG_SNMP_EID); field.addItem(Maskelement.TAG_SNMP_SPECIFIC); field.addItem(Maskelement.TAG_SNMP_GENERIC); field.addItem(Maskelement.TAG_SNMP_COMMUNITY); return field; } if (propertyId.equals("mevalues")) { final TextField field = new TextField(); field.setConverter(new CsvListConverter()); return field; } return super.createField(container, itemId, propertyId, uiContext); } });
@Override public void addNewItem(String newItemCaption) { if (!combo.containsId(newItemCaption)) { combo.addItem(newItemCaption); combo.setValue(newItemCaption); } } });
@Override public void addNewItem(String newItemCaption) { if (!field.containsId(newItemCaption)) { field.addItem(newItemCaption); field.setValue(newItemCaption); } } });
private void initialiseTargetServerCombo() { if(this.targetServerComboBox == null) { this.targetServerComboBox = new ComboBox(); } this.targetServerComboBox.removeAllItems(); List<String> targetServers = this.getValidTargetServers(); for(String targetServer: targetServers) { this.targetServerComboBox.addItem(targetServer); } }
public void clear() { this.module = null; this.serverCombo.removeAllItems(); List<Server> servers = this.topologyService.getAllServers(); for(Server server: servers) { this.serverCombo.addItem(server); this.serverCombo.setItemCaption(server, server.getName()); } }
private void populateValuesOfDistribution(final Long editDistId) { final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId); if (!distSet.isPresent()) { return; } distNameTextField.setValue(distSet.get().getName()); distVersionTextField.setValue(distSet.get().getVersion()); if (distSet.get().getType().isDeleted()) { distsetTypeNameComboBox.addItem(distSet.get().getType().getId()); } distsetTypeNameComboBox.setValue(distSet.get().getType().getId()); distsetTypeNameComboBox.setEnabled(false); reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep()); descTextArea.setValue(distSet.get().getDescription()); }
@Override public void valueChange(Property.ValueChangeEvent event) { String selected = (String) typeField.getValue(); if (selected == null) { return; } // Get available fields. // FIXME If a new dcGroup is added, DataCollectionConfigDao is not able to reach it. List<String> values = selected.equals(IncludeCollectionWrapper.SYSTEM_DEF) ? dataCollectionConfigDao.getAvailableSystemDefs() : dataCollectionConfigDao.getAvailableDataCollectionGroups(); // Remove already selected for (IncludeCollectionWrapper obj : container.getOnmsBeans()) { if (obj.getType().equals(selected)) { values.remove(obj.getValue()); } } // Updating combo-box valueField.removeAllItems(); for (String v : values) { valueField.addItem(v); } if (wrapper.getValue() != null) { valueField.addItem(wrapper.getValue()); } valueField.setEnabled(valueField.getItemIds().size() > 1); } });
private void populateValuesOfDistribution(final Long editDistId) { final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId); if (!distSet.isPresent()) { return; } distNameTextField.setValue(distSet.get().getName()); distVersionTextField.setValue(distSet.get().getVersion()); if (distSet.get().getType().isDeleted()) { distsetTypeNameComboBox.addItem(distSet.get().getType().getId()); } distsetTypeNameComboBox.setValue(distSet.get().getType().getId()); distsetTypeNameComboBox.setEnabled(false); reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep()); descTextArea.setValue(distSet.get().getDescription()); }
/** * Initializes the select options.<p> * * @param orgUnits the selectable OUs */ public void initOrgUnits(List<CmsOrganizationalUnit> orgUnits) { if ((orgUnits.size() == 1) && (orgUnits.get(0).getParentFqn() == null)) { setVisible(false); m_alwaysHidden = true; } for (CmsOrganizationalUnit ou : orgUnits) { String key = normalizeOuName(ou.getName()); m_ouSelect.addItem(key); m_ouSelect.setItemCaption(key, ou.getDisplayName(A_CmsUI.get().getLocale())); } }
/** * Enables/disables selection of the 'Roles' prinipal type.<p> * * @param editRoles true if the user should be allowed to select roles */ public void setRoleSelectionAllowed(boolean editRoles) { m_principalTypeSelect.removeItem(CmsRole.PRINCIPAL_ROLE); if (editRoles) { Item item = m_principalTypeSelect.addItem(CmsRole.PRINCIPAL_ROLE); String roleText = CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_ROLE_0); item.getItemProperty(CmsVaadinUtils.PROPERTY_LABEL).setValue(roleText); } m_principalTypeSelect.setNewItemsAllowed(!editRoles); }
/** * Sets the combo value. * * @param value the new combo value */ protected void setComboValue(String value) { boolean comboState = combo.isReadOnly(); combo.setReadOnly(false); if (!combo.containsId(value)) { combo.addItem(value); } combo.setValue(value); if (comboState) combo.setReadOnly(true); }
public void clear() { this.serverCombo.removeAllItems(); this.moduleCombo.removeAllItems(); this.resultsTable.removeAllItems(); this.flow = null; List<Server> servers = this.topologyService.getAllServers(); for(Server server: servers) { this.serverCombo.addItem(server); this.serverCombo.setItemCaption(server, server.getName()); } List<Module> modules = this.topologyService.getAllModules(); for(Module module: modules) { this.moduleCombo.addItem(module); this.moduleCombo.setItemCaption(module, module.getName()); } }
ComboBox accountStatusChoice = new ComboBox(); accountStatusChoice.setCaption(MessageResource.getLocalizedString("caption.accountStatus")); accountStatusChoice.setRequired(true); accountStatusChoice.setRequiredError(MessageResource.getLocalizedString("error.required.accountStatus")); accountStatusChoice.setImmediate(true); for (AccountStatus accountStatus : AccountStatus.values()) { accountStatusChoice.addItem(accountStatus); accountStatusChoice.setItemCaption(accountStatus, MessageResource.getLocalizedString(accountStatus.name())); } return accountStatusChoice;
BeanItemContainer<Person> container = new BeanItemContainer<Person>(Person.class); container.addAll(myPersonList); ComboBox combobox = new ComboBox(); combobox.setContainerDataSource(container); combobox.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); combobox.setItemCaptionPropertyId("name"); // the person's name field will be shown on the UI // imho if you want to add a static text (String) into a container // which populated with Person objects then you have to make a fake Person object Person staticText = new Person(); staticText.setName("My static text"); combobox.addItem(staticText); // if you want to specify the index of the item, add them one by one in for cycle // and insert the static text item in the appropritate place
private ComboBox createType(Object itemId) { ComboBox select = new ComboBox(); for (AttribType type : AttribType.values()) select.addItem(type.name()); select.setValue(AttribType.valueOf(itemId).name()); select.setNullSelectionAllowed(false); select.setData(itemId); select.setBuffered(true); return select; }
public Field getPropertyField(FormProperty formProperty) { ComboBox comboBox = new MonthCombobox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); // Fill combobox I18nManager i18nManager = ExplorerApp.get().getI18nManager(); for (int i=0; i<12; i++) { comboBox.addItem(i); comboBox.setItemCaption(i, i18nManager.getMessage(Messages.MONTH_PREFIX + i)); } // Select first comboBox.setNullSelectionAllowed(false); Calendar cal = Calendar.getInstance(); comboBox.select(cal.get(Calendar.MONTH)); return comboBox; }
/** * Instantiates a new SNMP collection form. * * @param dataCollectionConfigDao the data collection configuration DAO */ public SnmpCollectionForm(final DataCollectionConfigDao dataCollectionConfigDao) { setCaption("SNMP Collection Detail"); snmpCollectionLayout.setMargin(true); name.setRequired(true); name.setWidth("100%"); snmpCollectionLayout.addComponent(name); snmpStorageFlag.setRequired(true); snmpStorageFlag.addItem("select"); snmpStorageFlag.addItem("all"); snmpCollectionLayout.addComponent(snmpStorageFlag); rrd.setRequired(true); rrd.setWidth("100%"); snmpCollectionLayout.addComponent(rrd); includeCollections = new IncludeCollectionField(dataCollectionConfigDao); snmpCollectionLayout.addComponent(includeCollections); setSnmpCollection(createBasicSnmpCollection()); snmpCollectionEditor.bind(name, "name"); snmpCollectionEditor.bind(snmpStorageFlag, "snmpStorageFlag"); snmpCollectionEditor.bind(rrd, "rrd"); snmpCollectionEditor.bind(includeCollections, "includeCollections"); setCompositionRoot(snmpCollectionLayout); }
public Field getPropertyField(FormProperty formProperty) { ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty)); comboBox.setRequired(formProperty.isRequired()); comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); comboBox.setEnabled(formProperty.isWritable()); List<ProcessDefinition> processDefinitions = ProcessEngines.getDefaultProcessEngine() .getRepositoryService() .createProcessDefinitionQuery() .orderByProcessDefinitionName().asc() .orderByProcessDefinitionVersion().asc() .list(); for (ProcessDefinition processDefinition : processDefinitions) { comboBox.addItem(processDefinition.getId()); String name = processDefinition.getName() + " (v" + processDefinition.getVersion() + ")"; comboBox.setItemCaption(processDefinition.getId(), name); } // Select first if (!processDefinitions.isEmpty()) { comboBox.setNullSelectionAllowed(false); comboBox.select(processDefinitions.get(0).getId()); } return comboBox; }