Example #1
0
 @Override
 public void setValueAt(Object value, int rowIndex, int columnIndex) {
   if ((columnIndex == 0) && (value instanceof Boolean)) {
     Entry e = data.get(rowIndex);
     e.enabled = (Boolean) value;
     fireTableCellUpdated(rowIndex, columnIndex);
   }
 }
Example #2
0
    /**
     * Include row if each matcher succeeds in at least one column. In other words all the
     * conditions are combined with "and"
     *
     * @param value
     * @return
     */
    @Override
    public boolean include(Entry value) {

      for (Pair<String, Matcher> entry : matchers) {
        String column = entry.getFirst();
        Matcher matcher = entry.getSecond();

        // Search for a match in at least one column.  The first column is the checkbox.
        boolean found = false; // Pessimistic
        int nColumns = table.getColumnCount();
        for (int index = 1; index < nColumns; index++) {

          // Include column headings in search.  This is to prevent premature filtering when
          // entering a
          // specific column condition (e.g. cataType=ChipSeq)
          matcher.reset(table.getColumnName(index).toLowerCase());
          if (matcher.find()) {
            found = true;
            break;
          }

          boolean wildcard = column.equals("*");
          if (wildcard || column.equalsIgnoreCase(table.getColumnName(index))) {
            matcher.reset(value.getStringValue(index));
            if (matcher.find()) {
              found = true;
              break;
            }
          }
        }
        if (!found) return false;
      }
      return true; // If we get here we matched them all
    }