Search in sources :

Example 81 with RecordDefinition

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;
        }
    }
}
Also used : CodeTable(com.revolsys.record.code.CodeTable) Identifier(com.revolsys.identifier.Identifier) FieldDefinition(com.revolsys.record.schema.FieldDefinition) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 82 with RecordDefinition

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;
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) DataType(com.revolsys.datatype.DataType) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 83 with RecordDefinition

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;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 84 with RecordDefinition

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;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) RecordState(com.revolsys.record.RecordState) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 85 with RecordDefinition

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;
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

RecordDefinition (com.revolsys.record.schema.RecordDefinition)189 FieldDefinition (com.revolsys.record.schema.FieldDefinition)38 Record (com.revolsys.record.Record)34 Geometry (com.revolsys.geometry.model.Geometry)20 CodeTable (com.revolsys.record.code.CodeTable)19 Query (com.revolsys.record.query.Query)18 LineString (com.revolsys.geometry.model.LineString)17 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)16 PathName (com.revolsys.io.PathName)13 ArrayList (java.util.ArrayList)12 DataType (com.revolsys.datatype.DataType)11 Identifier (com.revolsys.identifier.Identifier)11 RecordReader (com.revolsys.record.io.RecordReader)11 RecordStore (com.revolsys.record.schema.RecordStore)11 HashMap (java.util.HashMap)9 VectorOfWString (com.revolsys.gis.esri.gdb.file.capi.swig.VectorOfWString)8 ArrayRecord (com.revolsys.record.ArrayRecord)8 RecordDefinitionImpl (com.revolsys.record.schema.RecordDefinitionImpl)6 Table (com.revolsys.gis.esri.gdb.file.capi.swig.Table)5 RecordWriter (com.revolsys.record.io.RecordWriter)5