@Override
 public boolean canUndo() {
   if (super.canUndo()) {
     final Object value = Property.get(this.object, this.propertyName);
     if (DataType.equal(value, this.newValue)) {
       return true;
     }
   }
   return false;
 }
 @Override
 public int setPreparedStatementValue(
     final PreparedStatement statement, final int parameterIndex, final Object value)
     throws SQLException {
   if (Property.isEmpty(value)) {
     final int sqlType = getSqlType();
     statement.setNull(parameterIndex, sqlType);
   } else {
     final Date date = Dates.getSqlDate(value);
     statement.setDate(parameterIndex, date);
   }
   return parameterIndex + 1;
 }
 @Override
 public void propertyChangeDo(final PropertyChangeEvent event) {
   final Object source = event.getSource();
   if (source instanceof Field) {
     final Field field = (Field) source;
     final String fieldName = field.getFieldName();
     Object fieldValue = field.getFieldValue();
     if ("lineDashOffset".equals(fieldName) && !Property.hasValue(fieldValue)) {
       fieldValue = 0;
     }
     this.geometryStyle.setProperty(fieldName, fieldValue);
   } else if (source == this.geometryStyle) {
     final String name = event.getPropertyName();
     final Object value = event.getNewValue();
     setFieldValue(name, value);
   }
   for (final Component preview : this.previews.getComponents()) {
     preview.repaint();
   }
 }
Ejemplo n.º 4
0
 /**
  * Set the value of the field with the specified name.
  *
  * @param index The index of the field.
  * @param value The new value.
  */
 @Override
 protected boolean setValue(final FieldDefinition fieldDefinition, Object value) {
   boolean updated = false;
   if (value instanceof String) {
     final String string = (String) value;
     if (!Property.hasValue(string)) {
       value = null;
     }
   }
   if (value instanceof SingleIdentifier) {
     final SingleIdentifier identifier = (SingleIdentifier) value;
     value = identifier.getValue(0);
   }
   final Object newValue = fieldDefinition.toFieldValue(value);
   final int index = fieldDefinition.getIndex();
   final Object oldValue = this.values[index];
   if (!fieldDefinition.equals(oldValue, newValue)) {
     updated = true;
     updateState();
     fieldDefinition.equals(oldValue, newValue);
   }
   this.values[index] = newValue;
   return updated;
 }
 @Override
 protected void undoDo() {
   Property.setSimple(this.object, this.propertyName, this.oldValue);
 }