public class CellFocusManager extends Object implements MouseListener, PropertyChangeListener
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 and Description |
---|
CellFocusManager(TreeTable table)
Constructs a new focus manager.
|
Modifier and Type | Method and Description |
---|---|
void |
focusOnCell(int row,
int col)
Sets the cell focus on the specified cell.
|
void |
focusOnCell(int row,
TreeTableColumn column)
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 |
focusOnFirstVisibleCell()
Changes the focus to the first visible cell (in the first visible row) of
the same column.
|
void |
focusOnLastCell()
Sets the cell focus on the last cell.
|
void |
focusOnPageDown()
Changes the focus in such a way that the tree table will scroll down one
page.
|
void |
focusOnPageUp()
Changes the focus in such a way that the tree table will scroll up one
page.
|
TreeTableColumn |
getFocusedColumn()
Returns the tree table column that contains the focused cell.
|
int |
getFocusedColumnIndex()
Returns the column of the currently focused cell.
|
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 |
looseFocus()
Forces the tree table to loose the cell focus.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
propertyChange(PropertyChangeEvent evt) |
void |
setFocusedColumn(TreeTableColumn column)
Sets the tree table column that contains the focused cell and updates the
tree table.
|
void |
setFocusedPath(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.
|
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
.public int getFocusedRow()
public int getFocusedColumnIndex()
public boolean hasFocus(int row, int column)
row
- the cell's rowcolumn
- the cell's columnpublic 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 focusOnCell(int row, TreeTableColumn column)
row
- the row where the cell is locatedcolumn
- the column where the cell is locatedpublic void focusOnFirstCell()
public void focusOnLastCell()
public void focusOnPageUp()
public void focusOnPageDown()
public void focusOnFirstVisibleCell()
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 TreePath getFocusedPath()
public void setFocusedPath(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 mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.