|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.dlsc.flexgantt.swing.treetable.CellFocusManager
public class CellFocusManager
The cell focus manager is concerned with anything related to tracking and
changing the focus of tree table cells. The manager always knows which cell
is currently focused on. It also knows which cell to focus on when the user
wants to change the focus on the previous cell, the next cell, the cell above
or below the currently focused cell. This manager class listens to mouse and
keyboard events that occure on the table and reacts appropriately. Note: an
instance of FocusTraversalPolicy
could not be used for this task as
it works on containers and components, but the cells of a tree table are not
components.
Constructor Summary | |
---|---|
CellFocusManager(TreeTable table)
Constructs a new focus manager. |
Method Summary | |
---|---|
void |
focusOnCell(int row,
int col)
Sets the cell focus on the specified cell. |
void |
focusOnCellAbove()
Moves the focus to the cell above the currently focused cell. |
void |
focusOnCellBelow()
Moves the focus to the cell below the currently focused cell. |
void |
focusOnCellNext()
Changes the focus from one cell to the next cell. |
void |
focusOnCellPrevious()
Changes the focus from one cell to the previous cell. |
void |
focusOnFirstCell()
Sets the cell focus on the first cell. |
void |
focusOnLastCell()
Sets the cell focus on the last cell. |
TreeTableColumn |
getFocusedColumn()
Returns the tree table column that contains the focused cell. |
int |
getFocusedColumnIndex()
Returns the column of the currently focused cell. |
javax.swing.tree.TreePath |
getFocusedPath()
Returns the tree path of the focused cell. |
int |
getFocusedRow()
Returns the row of the currently focused cell. |
TreeTable |
getTreeTable()
Returns the tree table to which the cell focus manager belongs. |
boolean |
hasFocus()
Checks whether any cell is currently focused. |
boolean |
hasFocus(int row,
int column)
Checks whether the cell at the given row and column is currently focused. |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
looseFocus()
Forces the tree table to loose the cell focus. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
setFocusedColumn(TreeTableColumn column)
Sets the tree table column that contains the focused cell and updates the tree table. |
void |
setFocusedPath(javax.swing.tree.TreePath path)
Sets the tree path of the focused cell and updates the tree table. |
void |
setFocusedRow(int row)
Sets the row of the focused cell. |
void |
treeWillCollapse(javax.swing.event.TreeExpansionEvent event)
|
void |
treeWillExpand(javax.swing.event.TreeExpansionEvent event)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CellFocusManager(TreeTable table)
table
- is the table which will be controlled by this manager. The
manager attaches itself via a KeyListener
and via a
MouseListener
.Method Detail |
---|
public int getFocusedRow()
public int getFocusedColumnIndex()
public boolean hasFocus(int row, int column)
row
- the cell's rowcolumn
- the cell's column
public boolean hasFocus()
public void looseFocus()
public void focusOnCell(int row, int col)
row
- the row where the cell is locatedcol
- the column where the cell is locatedpublic void focusOnFirstCell()
public void focusOnLastCell()
public void focusOnCellNext()
public void focusOnCellPrevious()
public void focusOnCellAbove()
public void focusOnCellBelow()
public TreeTableColumn getFocusedColumn()
public void setFocusedColumn(TreeTableColumn column)
column
- the column of the focused cellpublic javax.swing.tree.TreePath getFocusedPath()
public void setFocusedPath(javax.swing.tree.TreePath path)
path
- the tree path of the focused cellpublic void setFocusedRow(int row)
setFocusedPath(TreePath)
.
row
- the row of the focused cellpublic TreeTable getTreeTable()
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void treeWillCollapse(javax.swing.event.TreeExpansionEvent event)
treeWillCollapse
in interface javax.swing.event.TreeWillExpandListener
public void treeWillExpand(javax.swing.event.TreeExpansionEvent event)
treeWillExpand
in interface javax.swing.event.TreeWillExpandListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |