use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.
the class GridLayerStylePanel method propertyChangeDo.
@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);
this.textStyle.setProperty(fieldName, fieldValue);
} else if (source == this.geometryStyle || source == this.textStyle) {
final String name = event.getPropertyName();
final Object value = event.getNewValue();
setFieldValue(name, value);
}
for (final Component preview : this.previews.getComponents()) {
preview.repaint();
}
}
use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.
the class GriddedElevationModelStylePanel method propertyChangeDo.
@Override
public void propertyChangeDo(final PropertyChangeEvent event) {
final Object source = event.getSource();
if (source instanceof Field) {
final Field field = (Field) source;
if (this.rasterizer != null) {
final String fieldName = field.getFieldName();
final Object fieldValue = field.getFieldValue();
this.rasterizer.setProperty(fieldName, fieldValue);
}
} else if (source == this.rasterizer) {
final String name = event.getPropertyName();
final Object value = event.getNewValue();
setFieldValue(name, value);
}
}
use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.
the class LayerRecordForm method setFieldValidDo.
protected void setFieldValidDo(final String fieldName) {
this.fieldErrors.remove(fieldName);
this.fieldWarnings.remove(fieldName);
final boolean valid = isFieldValid(fieldName);
final Field field = getField(fieldName);
field.setFieldValid();
if (this.record.isModified(fieldName)) {
final Object originalValue = this.record.getOriginalValue(fieldName);
String originalString;
if (originalValue == null) {
originalString = "-";
} else {
originalString = DataTypes.toString(originalValue);
}
field.setFieldToolTip(originalString);
field.setFieldBackgroundColor(new Color(0, 255, 0, 31));
} else {
field.setFieldToolTip("");
}
if (!valid) {
this.invalidFieldNames.remove(fieldName);
this.fieldInValidMessage.remove(fieldName);
final int tabIndex = getTabIndex(fieldName);
Maps.removeFromSet(this.tabInvalidFieldMap, tabIndex, fieldName);
updateTabValid(tabIndex);
updateInvalidFields(true);
}
}
use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.
the class LayerRecordForm method setFieldInvalidDo.
protected void setFieldInvalidDo(final String fieldName, String message) {
final String oldValue = this.fieldInValidMessage.get(fieldName);
if (message == null) {
message = "Invalid value";
}
if (!DataType.equal(message, oldValue)) {
this.fieldInValidMessage.put(fieldName, message);
final Field field = getField(fieldName);
field.setFieldInvalid(message, WebColors.Red, WebColors.Pink);
this.invalidFieldNames.add(fieldName);
final int tabIndex = getTabIndex(fieldName);
Maps.addToSet(this.tabInvalidFieldMap, tabIndex, fieldName);
updateTabValid(tabIndex);
updateInvalidFields(true);
}
}
use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.
the class LayerRecordForm method focusGained.
@Override
public void focusGained(final FocusEvent e) {
Component component = e.getComponent();
while (component != null) {
if (component instanceof Field) {
final Field field = (Field) component;
this.focussedFieldName = field.getFieldName();
return;
} else {
component = component.getParent();
}
}
}
Aggregations