Example #1
0
  @Override
  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    Agent agent = null;
    if (rowIndex > agents.size()) {
      throw new IllegalArgumentException(strings.getString("rowIndex_OOB"));
    } else {
      agent = agents.get(rowIndex);
    }

    switch (columnIndex) {
      case 0:
        agent.setName((String) aValue);
        break;
      case 1:
        agent.setAgentNumber((Integer) aValue);
        break;
      case 2:
        agent.setDateOfEnrollment((Date) aValue);
        break;
      case 3:
        agent.setIsDead((Boolean) aValue);
        break;
      default:
        throw new IllegalArgumentException(strings.getString("columnIndex_OOB"));
    }
  }
Example #2
0
  @Override
  public Object getValueAt(int rowIndex, int columnIndex) {
    if (rowIndex > agents.size()) {
      throw new IllegalArgumentException(strings.getString("rowIndex_OOB"));
    }

    Agent agent = agents.get(rowIndex);
    switch (columnIndex) {
      case 0:
        return agent.getName();
      case 1:
        return agent.getAgentNumber();
      case 2:
        return agent.getDateOfEnrollment();
      case 3:
        return agent.isIsDead();
      default:
        throw new IllegalArgumentException(strings.getString("columnIndex_OOB"));
    }
  }