Exemplo n.º 1
0
  @Override
  @SuppressWarnings({"unchecked"})
  public void setSelectedItem(Object anItem) {
    T i = (T) anItem;

    if (checker.isValueCorrect(i)) {
      selected = i;
      fireContentsChanged(this, -1, -1);
    }
  }
Exemplo n.º 2
0
 @SuppressWarnings({"unchecked"})
 public ComboBoxEditorModel(IValueChecker<T> checker, T selected) {
   this.checker = checker;
   if (selected != null && checker.isValueCorrect(selected)) {
     this.selected = selected;
   } else {
     // Automatically select the first component
     this.selected = getElementAt(0);
   }
 }