use of de.jaret.util.ui.table.editor.ICellEditor in project translationstudio8 by heartsome.
the class JaretTable method getCellEditor.
/**
* Retrieve the cell editor for a cell.
*
* @param row row of the cell
* @param column col of the cell
* @return cell editor or <code>null</code> if no editor can be found
*/
private ICellEditor getCellEditor(IRow row, IColumn column) {
// first check column specific renderers
ICellEditor editor = null;
editor = _colCellEditorMap.get(column);
if (editor == null) {
// try class map
Object value = column.getValue(row);
if (value != null) {
editor = getCellEditorFromMap(value.getClass());
} else if (column.getContentClass(row) != null) {
editor = getCellEditorFromMap(column.getContentClass(row));
} else if (column.getContentClass() != null) {
editor = getCellEditorFromMap(column.getContentClass());
}
}
return editor;
}
use of de.jaret.util.ui.table.editor.ICellEditor in project translationstudio8 by heartsome.
the class JaretTable method getCellEditorFromMap.
/**
* Retrieve a cell editor for a given class. Checks all interfaces and all superclasses.
*
* @param clazz class in queston
* @return editor or null
*/
private ICellEditor getCellEditorFromMap(Class<?> clazz) {
ICellEditor result = null;
result = _colClassEditorMap.get(clazz);
if (result != null) {
return result;
}
Class<?>[] interfaces = clazz.getInterfaces();
for (Class<?> c : interfaces) {
result = _colClassEditorMap.get(c);
if (result != null) {
return result;
}
}
Class<?> sc = clazz.getSuperclass();
while (sc != null) {
result = _colClassEditorMap.get(sc);
if (result != null) {
return result;
}
// interfaces of the superclass
Class<?>[] scinterfaces = sc.getInterfaces();
for (Class<?> c : scinterfaces) {
result = _colClassEditorMap.get(c);
if (result != null) {
return result;
}
}
sc = sc.getSuperclass();
}
return result;
}
use of de.jaret.util.ui.table.editor.ICellEditor in project translationstudio8 by heartsome.
the class JaretTable method handleEditorSingleClick.
/**
* Handle a single mouseclick by passing it to the cell editor if present.
*
* @param x x coordinate of the click
* @param y y coordinate of the click
* @return true if the editor handled the click
*/
private boolean handleEditorSingleClick(int x, int y) {
IRow row = rowForY(y);
IColumn col = colForX(x);
if (col != null && row != null) {
ICellEditor editor = getCellEditor(row, col);
if (editor != null) {
Rectangle area = getCellBounds(row, col);
return editor.handleClick(this, row, col, area, x, y);
}
}
return false;
}
Aggregations