Ejemplo n.º 1
0
  @Override
  public void setVisible(boolean b) {
    //
    // Only do this if 1 entry and can add...
    //
    ListFacade<InfoFacade> availableList = chooser.getAvailableList();
    if ((availableList != null)
        && (availableList.getSize() == 1)
        && (listModel.getSize() == 0)
        && b
        && !chooser.isUserInput()) {
      final int method = UIPropertyContext.getSingleChoiceAction();

      if (method != Constants.CHOOSER_SINGLE_CHOICE_METHOD_NONE) {
        chooser.addSelected(availableList.getElementAt(0));

        if (method == Constants.CHOOSER_SINGLE_CHOICE_METHOD_SELECT_EXIT) {
          chooser.commit();
          committed = true;
          return;
        }
      }
    }

    super.setVisible(b);
  }