Beispiel #1
0
 private void columnsChanged(final ItemListener listener) {
   final String currentID = ((Column) this.comboColonnePourRecherche.getSelectedItem()).getID();
   fillColumnCombo(listener);
   final ListComboBoxModel comboModel =
       (ListComboBoxModel) this.comboColonnePourRecherche.getModel();
   // no selection since the model was just emptied
   assert this.comboColonnePourRecherche.getSelectedIndex() == -1
       && this.comboColonnePourRecherche.getSelectedItem() == null;
   // try to reselect the same column if it's still there
   for (final Object o : comboModel.getList()) {
     final Column col = (Column) o;
     if (CompareUtils.equals(col.getID(), currentID))
       this.comboColonnePourRecherche.setSelectedItem(o);
   }
   if (comboModel.getSelectedItem() == null) selectAllColumnsItem();
 }
Beispiel #2
0
 public SearchItemComponent(final SearchListComponent list) {
   super();
   this.list = list;
   this.setOpaque(false);
   // Initialisation de l'interface graphique
   this.searchMode =
       new JComboBox(
           new String[] {
             TM.tr("contains"),
             TM.tr("contains.exactly"),
             TM.tr("isLessThan"),
             TM.tr("isEqualTo"),
             TM.tr("isExactlyEqualTo"),
             TM.tr("isGreaterThan"),
             TM.tr("isEmpty")
           });
   final ListComboBoxModel comboModel = new ListComboBoxModel(Arrays.asList(TOUT));
   comboModel.setSelectOnAdd(false);
   // allow getColIndex() and thus getSearchItem() to work from now on
   assert comboModel.getSelectedItem() != null;
   this.comboColonnePourRecherche = new JComboBox(comboModel);
   uiInit();
 }