@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(); } }
/** * 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; }