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