public Combobox(String value) throws WrongValueException { this(); setValue(value); }
/** Deselects the currently selected items and selects the given item. * <p>Note: if the label of comboitem has the same more than one, the first * comboitem will be selected at client side, it is a limitation of {@link Combobox} * and it is different from {@link Listbox}.</p> * @since 3.0.2 */ public void setSelectedItem(Comboitem item) { if (item != null && item.getParent() != this) throw new UiException("Not a child: " + item); if (item != _selItem) { _selItem = item; if (item != null) { setValue(item.getLabel()); smartUpdate("selectedItemUuid_", item.getUuid()); } else { //Bug#2919037: don't call setRawValue(), or the error message will be cleared if (_value != null && !"".equals(_value)) { _value = ""; smartUpdate("value", coerceToString(_value)); } } _lastCkVal = getValue(); } }
public void setLabel(String label) { final String old = getLabel(); if (!Objects.equals(old, label)) { final Combobox cb = (Combobox) getParent(); final boolean syncValueToSelection = cb != null && cb.getSelectedItemDirectly() == this; super.setLabel(label); if (syncValueToSelection) { final Constraint constr = cb.getConstraint(); if (constr != null && constr instanceof SimpleConstraint && (((SimpleConstraint) constr).getFlags() & SimpleConstraint.STRICT) != 0) { cb.setValue(label); } else { cb.schedSyncValueToSelection(); } } } }
setValue((String) selObj);