Search in sources :

Example 91 with RecordDefinition

use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.

the class SaifSchemaReader method loadSchema.

private RecordDefinitionFactory loadSchema(final CsnIterator iterator) throws IOException {
    if (this.schema == null) {
        this.schema = new RecordDefinitionFactoryImpl();
        this.schema.addRecordDefinition(new RecordDefinitionImpl(PathName.newPathName("/AggregateType")));
        this.schema.addRecordDefinition(new RecordDefinitionImpl(PathName.newPathName("/PrimitiveType")));
        addExportedObjects();
    }
    while (iterator.next() != CsnIterator.END_DOCUMENT) {
        this.currentSuperClasses.clear();
        this.currentClass = null;
        final Object definition = getDefinition(iterator);
        if (definition instanceof RecordDefinition) {
            final RecordDefinitionImpl recordDefinition = (RecordDefinitionImpl) definition;
            setRecordDefinitionProperties(recordDefinition);
            recordDefinition.setRecordDefinitionFactory(this.schema);
            this.schema.addRecordDefinition(recordDefinition);
        }
    }
    return this.schema;
}
Also used : RecordDefinitionFactoryImpl(com.revolsys.record.schema.RecordDefinitionFactoryImpl) RecordDefinitionImpl(com.revolsys.record.schema.RecordDefinitionImpl) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 92 with RecordDefinition

use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.

the class RecordTableCellEditor method getTableCellEditorComponent.

@Override
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, int rowIndex, int columnIndex) {
    rowIndex = table.convertRowIndexToModel(rowIndex);
    columnIndex = table.convertColumnIndexToModel(columnIndex);
    this.oldValue = value;
    final AbstractRecordTableModel model = getTableModel();
    this.fieldName = model.getColumnFieldName(rowIndex, columnIndex);
    final RecordDefinition recordDefinition = model.getRecordDefinition();
    this.dataType = recordDefinition.getFieldType(this.fieldName);
    final Field field = newField(this.fieldName);
    this.editorComponent = (JComponent) field;
    if (this.editorComponent instanceof JTextField) {
        final JTextField textField = (JTextField) this.editorComponent;
        textField.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(WebColors.LightSteelBlue), BorderFactory.createEmptyBorder(1, 2, 1, 2)));
    } else if (this.editorComponent instanceof AbstractRecordQueryField) {
        final AbstractRecordQueryField queryField = (AbstractRecordQueryField) this.editorComponent;
        queryField.setSearchFieldBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(WebColors.LightSteelBlue), BorderFactory.createEmptyBorder(1, 2, 1, 2)));
    }
    this.editorComponent.setOpaque(false);
    SwingUtil.setFieldValue(this.editorComponent, value);
    this.rowIndex = rowIndex;
    this.columnIndex = columnIndex;
    this.editorComponent.addKeyListener(this);
    this.editorComponent.addMouseListener(this.mouseListeners);
    if (this.editorComponent instanceof JComboBox) {
        final JComboBox<?> comboBox = (JComboBox<?>) this.editorComponent;
        final ComboBoxEditor editor = comboBox.getEditor();
        final Component comboEditorComponent = editor.getEditorComponent();
        comboEditorComponent.addKeyListener(this);
        comboEditorComponent.addMouseListener(this.mouseListeners);
    } else if (this.editorComponent instanceof AbstractRecordQueryField) {
        final AbstractRecordQueryField queryField = (AbstractRecordQueryField) this.editorComponent;
        final TextField searchField = queryField.getSearchField();
        searchField.addKeyListener(this);
        searchField.addMouseListener(this.mouseListeners);
    }
    this.popupMenuListener = ShowMenuMouseListener.addListener(this.editorComponent, this.popupMenuFactory);
    return this.editorComponent;
}
Also used : JTextField(javax.swing.JTextField) Field(com.revolsys.swing.field.Field) TextField(com.revolsys.swing.field.TextField) AbstractRecordQueryField(com.revolsys.swing.field.AbstractRecordQueryField) AbstractRecordTableModel(com.revolsys.swing.table.record.model.AbstractRecordTableModel) JComboBox(javax.swing.JComboBox) JTextField(javax.swing.JTextField) TextField(com.revolsys.swing.field.TextField) AbstractRecordQueryField(com.revolsys.swing.field.AbstractRecordQueryField) JTextField(javax.swing.JTextField) JComponent(javax.swing.JComponent) Component(java.awt.Component) ComboBoxEditor(javax.swing.ComboBoxEditor) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 93 with RecordDefinition

use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.

the class ExcludeGeometryRowFilter method include.

@Override
public boolean include(final Entry<? extends TableModel, ? extends Integer> entry) {
    final TableModel model = entry.getModel();
    if (model instanceof AbstractRecordTableModel) {
        final AbstractRecordTableModel recordModel = (AbstractRecordTableModel) entry.getModel();
        final Integer identifier = entry.getIdentifier();
        final RecordDefinition recordDefinition = recordModel.getRecordDefinition();
        final Class<?> clazz = recordDefinition.getFieldClass(identifier);
        if (Geometry.class.isAssignableFrom(clazz)) {
            return false;
        }
    }
    return true;
}
Also used : AbstractRecordTableModel(com.revolsys.swing.table.record.model.AbstractRecordTableModel) AbstractRecordTableModel(com.revolsys.swing.table.record.model.AbstractRecordTableModel) TableModel(javax.swing.table.TableModel) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 94 with RecordDefinition

use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.

the class LabelCountMap method writeCounts.

public void writeCounts(final Object target, final String labelTitle) {
    final RecordDefinitionBuilder recordDefinitionBuilder = new RecordDefinitionBuilder("Counts");
    recordDefinitionBuilder.addField(labelTitle, DataTypes.STRING, 50);
    recordDefinitionBuilder.addField("Count", DataTypes.LONG, 10);
    final RecordDefinition recordDefinition = recordDefinitionBuilder.getRecordDefinition();
    try (RecordWriter recordWriter = RecordWriter.newRecordWriter(recordDefinition, target)) {
        for (final String label : getLabels()) {
            final Long count = getCount(label);
            recordWriter.write(label, count);
        }
    }
}
Also used : RecordDefinitionBuilder(com.revolsys.record.schema.RecordDefinitionBuilder) RecordWriter(com.revolsys.record.io.RecordWriter) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Example 95 with RecordDefinition

use of com.revolsys.record.schema.RecordDefinition in project com.revolsys.open by revolsys.

the class FileGdbRecordStore method updateRecord.

@Override
public void updateRecord(final Record record) {
    if (record == null) {
    } else {
        final RecordDefinition recordDefinition = record.getRecordDefinition();
        final Table table = getTableWithWriteLock(recordDefinition);
        try {
            updateRecord(table, record);
        } finally {
            releaseTableAndWriteLock(recordDefinition);
        }
    }
}
Also used : CodeTable(com.revolsys.record.code.CodeTable) DETable(com.revolsys.record.io.format.esri.gdb.xml.model.DETable) Table(com.revolsys.gis.esri.gdb.file.capi.swig.Table) FileGdbDomainCodeTable(com.revolsys.gis.esri.gdb.file.capi.FileGdbDomainCodeTable) 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