private void updateControls() { boolean visible = radYes.isSelected(); boolean first = true; for (Component row : rows.getChildren()) { row.setVisible(first || visible); first = false; } pnlGoalOther.setVisible("other".equalsIgnoreCase(cboGoal.getValue())); Clients.resize(pnlGoalOther); }
private void syncValueToSelection() { final String value = getValue(); if (!Objects.equals(_lastCkVal, value)) { _lastCkVal = value; _selItem = null; for (final Comboitem item : getItems()) { if (Objects.equals(value, item.getLabel())) { _selItem = item; break; } } syncSelectionToModel(); } }
Set<Comboitem> selItems = evt.getSelectedItems(); _selItem = selItems != null && !selItems.isEmpty() ? (Comboitem) selItems.iterator().next() : null; _lastCkVal = getValue(); //onChange is sent before onSelect
/** 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(); } }