use of com.l2fprod.common.propertysheet.PropertySheetTableModel.Item in project CodenameOne by codenameone.
the class PropertySheetTable method prepareRenderer.
/**
* Overriden
* <li>to prevent the cell focus rect to be painted
* <li>to disable ({@link Component#setEnabled(boolean)} the renderer if the
* Property is not editable
*/
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Object value = getValueAt(row, column);
boolean isSelected = isCellSelected(row, column);
Component component = renderer.getTableCellRendererComponent(this, value, isSelected, false, row, column);
PropertySheetTableModel.Item item = getSheetModel().getPropertySheetElement(row);
if (item.isProperty()) {
component.setEnabled(item.getProperty().isEditable());
}
return component;
}
use of com.l2fprod.common.propertysheet.PropertySheetTableModel.Item in project CodenameOne by codenameone.
the class PropertySheetTable method getCellEditor.
/**
* Gets the CellEditor for the given row and column. It uses the
* editor registry to find a suitable editor for the property.
* @see javax.swing.JTable#getCellEditor(int, int)
*/
public TableCellEditor getCellEditor(int row, int column) {
if (column == 0) {
return null;
}
Item item = getSheetModel().getPropertySheetElement(row);
if (!item.isProperty())
return null;
TableCellEditor result = null;
Property propery = item.getProperty();
PropertyEditor editor = getEditorFactory().createPropertyEditor(propery);
if (editor != null)
result = new CellEditorAdapter(editor);
return result;
}
Aggregations