use of com.revolsys.swing.table.record.model.AbstractRecordTableModel 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.swing.table.record.model.AbstractRecordTableModel 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;
}
Aggregations