Search in sources :

Example 11 with Field

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

the class LayerRecordForm method updateErrorsDo.

protected void updateErrorsDo() {
    for (final Field field : getFields()) {
        final String fieldName = field.getFieldName();
        final List<String> errors = this.fieldErrors.get(fieldName);
        final List<String> warnings = this.fieldWarnings.get(fieldName);
        if (Property.hasValue(errors)) {
            String message = Strings.toString("<br />", errors);
            if (Property.hasValue(warnings)) {
                message += "<br />" + warnings;
            }
            field.setFieldInvalid("<html>" + message + "</html>", WebColors.Red, WebColors.Pink);
        } else {
            field.setFieldValid();
            if (Property.hasValue(warnings)) {
                field.setFieldToolTip("<html>" + Strings.toString("<br />", warnings) + "</html>");
                field.setFieldBackgroundColor(WebColors.Yellow);
            }
        }
    }
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField)

Example 12 with Field

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

the class LayerRecordForm method setEditable.

public void setEditable(final boolean editable) {
    final boolean oldValue = this.editable;
    this.editable = editable;
    for (final String fieldName : getFieldNames()) {
        if (!getReadOnlyFieldNames().contains(fieldName)) {
            final Field field = getField(fieldName);
            field.setEditable(editable);
        }
    }
    this.propertyChangeSupport.firePropertyChange("editable", oldValue, editable);
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField)

Example 13 with Field

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

the class LayerRecordForm method addReadOnlyFieldNames.

public void addReadOnlyFieldNames(final Collection<String> readOnlyFieldNames) {
    this.readOnlyFieldNames.addAll(readOnlyFieldNames);
    for (final Entry<String, Field> entry : this.fields.entrySet()) {
        final String name = entry.getKey();
        final Field field = entry.getValue();
        if (this.readOnlyFieldNames.contains(name)) {
            field.setEditable(false);
        } else {
            field.setEditable(true);
        }
    }
}
Also used : NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField)

Example 14 with Field

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

the class FieldFilterPanel method setSearchField.

private void setSearchField(final JComponent searchField) {
    this.searchFieldPanel.removeAll();
    removeListeners(this.searchField);
    this.searchField = searchField;
    if (searchField == null) {
        this.searchFieldPanel.setVisible(false);
    } else {
        this.searchFieldPanel.setVisible(true);
        addListeners(searchField);
        if (searchField instanceof Field) {
            final Field field = (Field) searchField;
            field.setFieldValue(this.lastValue);
        }
        final Dimension size = new Dimension(200, 22);
        searchField.setMinimumSize(size);
        searchField.setPreferredSize(size);
        searchField.setMaximumSize(size);
        this.searchFieldPanel.add(this.searchField);
        GroupLayouts.makeColumns(this.searchFieldPanel, 1, false);
    }
}
Also used : JXSearchField(org.jdesktop.swingx.JXSearchField) DateField(com.revolsys.swing.field.DateField) AbstractRecordQueryField(com.revolsys.swing.field.AbstractRecordQueryField) Field(com.revolsys.swing.field.Field) TextField(com.revolsys.swing.field.TextField) QueryWhereConditionField(com.revolsys.swing.field.QueryWhereConditionField) Dimension(java.awt.Dimension)

Example 15 with Field

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

the class FieldFilterPanel method removeListeners.

@SuppressWarnings("rawtypes")
private void removeListeners(final JComponent component) {
    if (component instanceof AbstractRecordQueryField) {
        final AbstractRecordQueryField queryField = (AbstractRecordQueryField) component;
        queryField.removePropertyChangeListener("selectedRecord", this);
    } else if (component instanceof JXSearchField) {
        final JXSearchField searchTextField = (JXSearchField) component;
        searchTextField.removeActionListener(this);
    } else if (component instanceof JComboBox) {
        final JComboBox comboField = (JComboBox) component;
        comboField.removeActionListener(this);
    } else if (component instanceof DateField) {
        final DateField dateField = (DateField) component;
        dateField.removeActionListener(this);
    }
    if (component instanceof Field) {
        final Field field = (Field) component;
        final String fieldName = field.getFieldName();
        Property.removeListener(field, fieldName, this);
    }
}
Also used : JXSearchField(org.jdesktop.swingx.JXSearchField) DateField(com.revolsys.swing.field.DateField) AbstractRecordQueryField(com.revolsys.swing.field.AbstractRecordQueryField) Field(com.revolsys.swing.field.Field) TextField(com.revolsys.swing.field.TextField) QueryWhereConditionField(com.revolsys.swing.field.QueryWhereConditionField) JXSearchField(org.jdesktop.swingx.JXSearchField) JComboBox(javax.swing.JComboBox) AbstractRecordQueryField(com.revolsys.swing.field.AbstractRecordQueryField) DateField(com.revolsys.swing.field.DateField)

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