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