Exemplo n.º 1
0
  public List getChange() {
    ArrayList change = new ArrayList();
    for (Iterator i = fieldComponents.keySet().iterator(); i.hasNext(); ) {
      String fieldId = (String) i.next();
      Object component = fieldComponents.get(fieldId);
      if (component instanceof ChangeAwareComponent
          && ((ChangeAwareComponent) component).hasChanged()) {
        String stringValue;
        if (component instanceof JTextField) stringValue = ((JTextField) component).getText();
        // hangle other components here
        else continue;

        Field field = Configuration.getFieldFromId(fieldId);
        try {
          Object value = FieldConverter.fromString(stringValue, field.getDisplayType());
          change.add(new FieldChange(field, value));
        } catch (Exception e) {
          Alert.error(e.getMessage());
        }
      }
    }
    return change;
  }