Search in sources :

Example 26 with Field

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();
    }
}
Also used : Field(com.revolsys.swing.field.Field) Component(java.awt.Component)

Example 27 with Field

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);
    }
}
Also used : Field(com.revolsys.swing.field.Field)

Example 28 with Field

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);
    }
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField) Color(java.awt.Color)

Example 29 with Field

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);
    }
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField)

Example 30 with Field

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();
        }
    }
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Aggregations

Field (com.revolsys.swing.field.Field)43 NumberTextField (com.revolsys.swing.field.NumberTextField)15 ObjectLabelField (com.revolsys.swing.field.ObjectLabelField)15 Component (java.awt.Component)13 TextField (com.revolsys.swing.field.TextField)12 JComponent (javax.swing.JComponent)9 JTextField (javax.swing.JTextField)8 AbstractRecordQueryField (com.revolsys.swing.field.AbstractRecordQueryField)7 DateField (com.revolsys.swing.field.DateField)7 ColorChooserField (com.revolsys.swing.field.ColorChooserField)5 QueryWhereConditionField (com.revolsys.swing.field.QueryWhereConditionField)5 JXSearchField (org.jdesktop.swingx.JXSearchField)5 Container (java.awt.Container)4 JComboBox (javax.swing.JComboBox)4 RecordDefinition (com.revolsys.record.schema.RecordDefinition)3 FontChooserField (com.revolsys.swing.field.FontChooserField)3 LengthMeasureTextField (com.revolsys.swing.field.LengthMeasureTextField)3 MarkerField (com.revolsys.swing.map.component.MarkerField)3 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)3 BaseCloseable (com.revolsys.io.BaseCloseable)2