public ConditionsTableModel() { m_conditions = new java.util.ArrayList(); Condition cond = new Condition(); cond.setProperty(""); cond.setOperator(ComparisonOperator.eq); cond.setValue(""); m_conditions.add(cond); }
public Object getValueAt(int row, int col) { Condition cond = (Condition) m_conditions.get(row); if (col == 0) { return cond.getProperty(); } else if (col == 1) { return getNiceName(cond.getOperator().toString()); } else { return cond.getValue(); } }
public void setValueAt(Object value, int row, int col) { Condition cond; if (row == -1) cond = new Condition(); else cond = (Condition) m_conditions.get(row); if (col == 0) cond.setProperty((String) value); /* if(col == 1) { try { cond.setOperator(ComparisonOperator.fromValue(FedoraUtils.getAdvancedSearchOperatorsActuals((tufts.oki.dr.fedora.DR)dr,(String)value))); } catch (Exception ex) { System.out.println("Value = "+value+": Not supported -"+ex); cond.setOperator(ComparisonOperator.ge); } } */ if (col == 2) cond.setValue((String) value); // row = -1 adds new condions else replace the existing one. if (row == -1) m_conditions.add(cond); else m_conditions.set(row, cond); fireTableCellUpdated(row, col); }
public int getRowCount() { return m_conditions.size(); }