Search in sources :

Example 31 with Field

use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.

the class LayerRecordForm method getField.

@SuppressWarnings("unchecked")
protected <T extends Field> T getField(final String fieldName) {
    synchronized (this.fields) {
        Field field = this.fields.get(fieldName);
        if (field == null) {
            final boolean editable = !this.readOnlyFieldNames.contains(fieldName);
            try {
                field = RecordLayerFields.newFormField(this.layer, fieldName, editable);
                addField(fieldName, field);
            } catch (final IllegalArgumentException e) {
            }
        }
        if (field != null && !isEditable()) {
            field.setEditable(false);
        }
        return (T) field;
    }
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField)

Example 32 with Field

use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.

the class LayerRecordForm method destroy.

public void destroy() {
    this.addOkButton = null;
    this.fieldsTableModel = null;
    this.recordStore = null;
    this.fieldInValidMessage.clear();
    for (final Field field : this.fields.values()) {
        Property.removeAllListeners(field);
    }
    this.fields.clear();
    this.fieldTabIndex.clear();
    this.fieldToNameMap.clear();
    this.invalidFieldNames.clear();
    this.geometryCoordinatesPanel = null;
    this.recordDefinition = null;
    this.record = null;
    this.propertyChangeSupport = null;
    this.readOnlyFieldNames.clear();
    this.tabInvalidFieldMap.clear();
    this.tabs = null;
    this.toolBar = null;
    this.undoManager = null;
    final Container parent = getParent();
    if (parent != null) {
        parent.remove(this);
    }
    final AbstractRecordLayer layer = getLayer();
    if (layer != null) {
        this.layer = null;
        if (this.fieldsTableModel != null) {
            Property.removeListener(layer, this.fieldsTableModel);
            this.fieldsTableModel = null;
        }
        Property.removeListener(layer, this);
    }
    final Window window = SwingUtil.getWindowAncestor(this);
    if (window != null) {
        window.removeWindowListener(this);
    }
    removeAll();
}
Also used : Window(java.awt.Window) NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField) Container(java.awt.Container) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 33 with Field

use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.

the class LayerRecordForm method addField.

@SuppressWarnings("unchecked")
public <T> T addField(final Container container, final String fieldName) {
    final Field field = getField(fieldName);
    addField(container, field);
    return (T) field;
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField)

Example 34 with Field

use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.

the class AbstractLayer method newPropertiesTabGeneralPanelGeneral.

protected ValueField newPropertiesTabGeneralPanelGeneral(final BasePanel parent) {
    final ValueField panel = new ValueField(this);
    Borders.titled(panel, "General");
    final Field nameField = (Field) SwingUtil.addObjectField(panel, this, "name");
    Property.addListener(nameField, "name", this.beanPropertyListener);
    final String type = Property.get(this, "type");
    final String typeLabel = CaseConverter.toCapitalizedWords(type);
    SwingUtil.addLabelledReadOnlyTextField(panel, "Type", typeLabel);
    GroupLayouts.makeColumns(panel, 2, true);
    parent.add(panel);
    return panel;
}
Also used : Field(com.revolsys.swing.field.Field) ValueField(com.revolsys.swing.component.ValueField) ValueField(com.revolsys.swing.component.ValueField)

Example 35 with Field

use of com.revolsys.swing.field.Field in project com.revolsys.open by revolsys.

the class TextStylePanel 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();
        final Object fieldValue = field.getFieldValue();
        this.textStyle.setProperty(fieldName, fieldValue);
    } else if (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)

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