JIDE 3.5.15

com.jidesoft.grid
Class RolloverTableUtils

java.lang.Object
  extended by 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

Nested Class Summary
static interface RolloverTableUtils.AutoCellAction
           
 
Field Summary
static String CLIENT_PROPERTY_ROLLOVER_AUTO_CELL_ACTION
           
static String CLIENT_PROPERTY_ROLLOVER_COLUMN_MODEL_LISTENER
           
static String CLIENT_PROPERTY_ROLLOVER_MOUSE_LISTENER
           
static String CLIENT_PROPERTY_ROLLOVER_PROPERTY_CHANGE_LISTENER
           
 
Constructor Summary
RolloverTableUtils()
           
 
Method Summary
static void cancelRollover(JTable table, MouseEvent e)
          Cancel the rollover (or editing depending on the AutoCellAction used when install(javax.swing.JTable, com.jidesoft.grid.RolloverTableUtils.AutoCellAction) is called.
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
 

Field Detail

CLIENT_PROPERTY_ROLLOVER_AUTO_CELL_ACTION

public static final String CLIENT_PROPERTY_ROLLOVER_AUTO_CELL_ACTION
See Also:
Constant Field Values

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
Constructor Detail

RolloverTableUtils

public RolloverTableUtils()
Method Detail

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 table
autoCellAction - 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.

cancelRollover

public static void cancelRollover(JTable table,
                                  MouseEvent e)
Cancel the rollover (or editing depending on the AutoCellAction used when install(javax.swing.JTable, com.jidesoft.grid.RolloverTableUtils.AutoCellAction) is called.

Parameters:
table - the table where RolloverTableUtils is used.
e - the MouseEvent

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)

JIDE 3.5.15