/** * Returns the selected item id. * @return Object */ @Override protected Object getInternalValue() { return combobox.getValue(); }
@Override protected Object getValue() throws MException { String ret = (String)((ComboBox)getComponentEditor()).getValue(); if (ret == null) return null; return ret; }
public FilterRequest createFilterRequest() { return new FilterRequest( (String)filter.getValue() ); }
@SuppressWarnings("unchecked") protected void doMenuSelected() { Pair<String,Object[]> item = (Pair<String,Object[]>) menuDelete.getValue(); if (item == null) return; Object[] val = item.getValue(); if (((String)val[0]).equals("add")) doAdd(val[1]); else if (((String)val[0]).equals("mod")) doModify(val[1]); else if (((String)val[0]).equals("del")) doDelete(val[1]); }
@Override protected PersistenceSelectorStrategy getInternalValue() { PersistenceSelectorStrategy strategy = new PersistenceSelectorStrategy(); if (combo.getValue() != null) { strategy.setClazz((String) combo.getValue()); } for (Object itemId: container.getItemIds()) { strategy.addParameter(container.getItem(itemId).getBean()); } return strategy; }
@Override protected StorageStrategy getInternalValue() { StorageStrategy strategy = new StorageStrategy(); if (combo.getValue() != null) { strategy.setClazz((String) combo.getValue()); } for (Object itemId: container.getItemIds()) { strategy.addParameter(container.getItem(itemId).getBean()); } return strategy; }
Object selection = getValue(); if (isScrollToSelectedItem() && !optionRequest && selection != null) {
/** * Sets the previous value - if the current value is not the first available in the set. */ public void goBack() { Object currentItemId = combobox.getValue(); if (getContainerDataSource().isFirstId(currentItemId)) { return; } setValue(getContainerDataSource().prevItemId(currentItemId)); }
/** * Sets the next value - if the current value is not the last available in the set. */ public void goForward() { Object currentItemId = combobox.getValue(); if (getContainerDataSource().isLastId(currentItemId)) { return; } setValue(getContainerDataSource().nextItemId(currentItemId)); }
final Object current = getValue(); final Collection<?> visible = getVisibleItemIds(); if (visible != null && visible.contains(current)) {
@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); } });
@Test public void defaultNodeTypeIsPreselected() throws Exception { // GIVEN this.definition.setDefaultValue("foo"); // WHEN final ComboBox field = (ComboBox) nodeTypeSelectFieldFactory.createField(); // THEN assertThat(field.getValue(), Matchers.<Object>equalTo("foo")); }
Object parent = parentSelect.getValue(); if (parent instanceof Folder) { folder.setParent((Folder) parent);
Object selection = getValue(); if (isScrollToSelectedItem() && !optionRequest && selection != null) {
@Override public void doUpdateMetadata() throws MException { ComboBox cb = (ComboBox)getComponentEditor(); Object value = cb.getValue(); cb.removeAllItems(); String itemsDef = getConfig().getString("itemdef", getName() + "." + DataSource.ITEMS);
@Test public void preventSwitchingLocaleWhenFormIsInValid() throws Exception { // GIVEN formViewer.setCurrentLocale(Locale.ENGLISH); formViewer.setAvailableLocales(new ArrayList<Locale>() {{ add(Locale.ENGLISH); add(Locale.GERMAN); }}); // Add an invalid form. TextField requiredTextField = new TextField(); requiredTextField.setRequired(true); FormSection formSection = mock(FormSection.class); when(formSection.iterator()).thenReturn(new ArrayList<Component>() {{ add(requiredTextField); }}.iterator()); formViewer.addFormSection("", formSection); // WHEN // Try to switch the language. formViewer.setCurrentLocale(Locale.GERMAN); // THEN // Should stay the same. assertEquals(Locale.ENGLISH, getLanguageSelector(formViewer).getValue()); }