use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class AbstractRecordTableModel method toObjectValue.
public Object toObjectValue(final String fieldName, final Object displayValue) {
if (!Property.hasValue(displayValue)) {
return null;
}
final RecordDefinition recordDefinition = getRecordDefinition();
final CodeTable codeTable = recordDefinition.getCodeTableByFieldName(fieldName);
if (codeTable == null) {
final FieldDefinition field = recordDefinition.getField(fieldName);
final Object recordValue = field.toFieldValue(displayValue);
return recordValue;
} else {
if (displayValue instanceof Identifier) {
final Identifier identifier = (Identifier) displayValue;
return identifier;
} else {
final Object objectValue = codeTable.getIdentifier(displayValue);
return objectValue;
}
}
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class RecordListTableModel method isCellEditable.
@Override
public boolean isCellEditable(final int rowIndex, final int columnIndex) {
if (isEditable()) {
final String fieldName = getColumnFieldName(rowIndex, columnIndex);
if (isReadOnly(fieldName)) {
return false;
} else {
final RecordDefinition recordDefinition = getRecordDefinition();
final DataType dataType = recordDefinition.getFieldType(fieldName);
if (dataType == null) {
return false;
} else if (Geometry.class.isAssignableFrom(dataType.getJavaClass())) {
return false;
} else {
return true;
}
}
} else {
return false;
}
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class RecordRowTableModel method isFieldEditable.
public boolean isFieldEditable(final int columnIndex) {
final String fieldName = getColumnFieldName(columnIndex);
if (fieldName != null) {
if (!isReadOnly(fieldName)) {
final RecordDefinition recordDefinition = getRecordDefinition();
final Class<?> fieldClass = recordDefinition.getFieldClass(fieldName);
if (!Geometry.class.isAssignableFrom(fieldClass)) {
return true;
}
}
}
return false;
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class RecordRowTableModel method isCellEditable.
protected boolean isCellEditable(final int rowIndex, final int columnIndex, final Record record) {
final RecordState state = record.getState();
if (state != RecordState.INITIALIZING && state != RecordState.DELETED) {
final String fieldName = getColumnFieldName(rowIndex, columnIndex);
if (fieldName != null) {
if (!isReadOnly(fieldName)) {
final RecordDefinition recordDefinition = getRecordDefinition();
final Class<?> fieldClass = recordDefinition.getFieldClass(fieldName);
if (!Geometry.class.isAssignableFrom(fieldClass)) {
return true;
}
}
}
}
return false;
}
use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.
the class GeometryReader method newRecordDefinition.
default RecordDefinition newRecordDefinition(final String name) {
final GeometryFactory geometryFactory = getGeometryFactory();
final RecordDefinition recordDefinition = //
new RecordDefinitionBuilder(name).addField("GEOMETRY", //
DataTypes.GEOMETRY).setGeometryFactory(//
geometryFactory).getRecordDefinition();
return recordDefinition;
}
Aggregations