use of com.ramussoft.gui.attribute.OtherElementPlugin.RowAttributeWrapper in project ramus by Vitaliy-Yakovchuk.
the class OtherElementTableCellEditor method getTableCellEditorComponent.
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int rowIndex, int columnIndex) {
this.table = table;
if (value instanceof String) {
Row r = rowSet.findRow((String) value);
if (r != null)
value = r.getElementId();
else
value = null;
}
if (value instanceof Long) {
value = new RowAttributeWrapper(rowSet.findRow((Long) value), nameAttribute);
}
this.value = value;
if (value != null)
this.value = ((RowAttributeWrapper) value).getRow().getElementId();
Row row = (value != null) ? ((RowAttributeWrapper) value).getRow() : null;
if (row == null) {
codeField.setText("");
valueField.setText("");
} else {
codeField.setText(row.getCode());
valueField.setText(value.toString());
valueField.setCaretPosition(0);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
codeField.selectAll();
codeField.requestFocus();
}
});
if (table instanceof ElementsTable) {
element = ((ElementsTable) table).getElementForRow(rowIndex);
}
return component;
}
Aggregations