com.jidesoft.grid
Class RolloverTableUtils
java.lang.Object
com.jidesoft.grid.RolloverTableUtils
public class RolloverTableUtils
- extends Object
RolloverTableUtils adds a mouse input listener to any JTable and will try to automatically force the
table cell into editing mode or the rollover mode when mouse is moved over a cell if condition meets. If you are
using install(javax.swing.JTable, com.jidesoft.grid.RolloverTableUtils.AutoCellAction), you can create
AutoCellEditingSupport.AutoCellEditing and tell RolloverTableUtils which cells should automatically start cell
editing. If you pass in null for the RolloverTableUtils.AutoCellAction parameter, we will check the CellEditor and
see if it is an instance of CellEditingSupport interface and if true, check if its isEditable method returns
true. We will also check if the cell editor is an instance of CellRolloverSupport and if isRollover returns
true. The difference is for isRollover is true, we will call JideTable.rolloverCellAt(int, int). If
isEditable is true, we will call JTable.editCellAt(int, int). Some cell editors such as ButtonTableCellEditorRenderer and HyperlinkTableCellEditorRenderer implement CellRolloverSupport and
those cell editors will start cell rollover even if the AutoCellAction is not defined.
- See Also:
TableCellEditorRenderer,
AbstractTableCellEditorRenderer,
HyperlinkTableCellEditorRenderer,
ButtonTableCellEditorRenderer
|
Method Summary |
protected static boolean[] |
getCellAction(JTable table,
MouseEvent e,
int row,
int column,
RolloverTableUtils.AutoCellAction autoCellAction)
|
static void |
install(JTable table)
Installs mouse input listener to JTable to enable auto cell editing when rollover. |
static void |
install(JTable table,
RolloverTableUtils.AutoCellAction autoCellAction)
Installs mouse input listener to JTable to enable auto cell editing when rollover. |
static void |
prepareCellEditorComponent(Component component,
JTable table,
boolean isSelected,
int row,
int column)
|
static void |
uninstall(JTable table)
Uninstalls the listener installed by install(javax.swing.JTable) or install(javax.swing.JTable,
com.jidesoft.grid.RolloverTableUtils.AutoCellAction). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CLIENT_PROPERTY_ROLLOVER_MOUSE_LISTENER
public static final String CLIENT_PROPERTY_ROLLOVER_MOUSE_LISTENER
- See Also:
- Constant Field Values
CLIENT_PROPERTY_ROLLOVER_COLUMN_MODEL_LISTENER
public static final String CLIENT_PROPERTY_ROLLOVER_COLUMN_MODEL_LISTENER
- See Also:
- Constant Field Values
CLIENT_PROPERTY_ROLLOVER_PROPERTY_CHANGE_LISTENER
public static final String CLIENT_PROPERTY_ROLLOVER_PROPERTY_CHANGE_LISTENER
- See Also:
- Constant Field Values
RolloverTableUtils
public RolloverTableUtils()
install
public static void install(JTable table)
- Installs mouse input listener to JTable to enable auto cell editing when rollover. If the cell editor implements
CellEditingSupport, it will be used to decide whether to start auto cell editing. For all cells that are
not editable as defined in table model or the cell editor doesn't implement CellEditingSupport, the cell
won't start editing when rollover.
- Parameters:
table - the table
install
public static void install(JTable table,
RolloverTableUtils.AutoCellAction autoCellAction)
- Installs mouse input listener to JTable to enable auto cell editing when rollover. It will use
AutoCellEditingSupport.AutoCellEditing to decide if a cell should start editing. If
AutoCellEditingSupport.AutoCellEditing returned false, it will check if the cell editor implements
CellEditingSupport, the use it to decide whether to start auto cell editing. For all cells that are not editable
as defined in table model or the cell editor doesn't implement CellEditingSupport, the cell won't start
editing when rollover.
- Parameters:
table - the tableautoCellAction - allows user to define if a cell is auto-editing or auto-rollover. it can be controlled by
the cell editor when it implements CellRolloverSupport and/or CellEditingSupport. However when sometimes the cell editors are not under your control,
you can use this interface to do it. If you use AutoCellAction, it has a higher priority
than the returned values defined by cell editors.
getCellAction
protected static boolean[] getCellAction(JTable table,
MouseEvent e,
int row,
int column,
RolloverTableUtils.AutoCellAction autoCellAction)
uninstall
public static void uninstall(JTable table)
- Uninstalls the listener installed by
install(javax.swing.JTable) or install(javax.swing.JTable,
com.jidesoft.grid.RolloverTableUtils.AutoCellAction).
- Parameters:
table - the table.
prepareCellEditorComponent
public static void prepareCellEditorComponent(Component component,
JTable table,
boolean isSelected,
int row,
int column)