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);
}
}
}
}
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);
}
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);
}
}
}
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);
}
}
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);
}
}
Aggregations