|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.plaf.ComponentUI | +--javax.swing.plaf.TreeUI | +--torero.gui.MyTreeUI
Pluggable Look&Feel Component for a horizontal layout of the JTree. This code is compatible to the SWING version bundeled with JDK 1.2.2, but it cannot be guaranted that it is compatible with later SWING versions. It implements the appropriate methods of a TreeUI, but it was not possible to implement all. The original swing implementation is mainly dependent on (table) rows but this implementation is not, therefore the implementation is different. MyTreeUI is designed to work with the NodeWrapper class, but with a few changes it would also work with the standard TreeNode interfaces.
NodeWrapper
,
TreeUI
Inner Class Summary | |
class |
MyTreeUI.ComponentHandler
Updates the preferred size when scrolling (if necessary). |
class |
MyTreeUI.MouseHandler
TreeMouseListener is responsible for updating the selection based on mouse events. |
class |
MyTreeUI.MouseInputHandler
MouseInputHandler handles passing all mouse events, including mouse motion events, until the mouse is released to the destination it is constructed with. |
class |
MyTreeUI.SelectionModelPropertyChangeHandler
Listener on the TreeSelectionModel, resets the row selection if any of the properties of the model change. |
class |
MyTreeUI.TreeExpansionHandler
Updates the TreeState in response to nodes expanding/collapsing. |
class |
MyTreeUI.TreeModelHandler
Forwards all TreeModel events to the Tree's state. |
class |
MyTreeUI.TreeSelectionHandler
Listens for changes in the selection model and updates the display accordingly. |
Field Summary | |
protected TreeSelectionModel |
currenttsm
The current TreeSelectionModel, derived from the JTree. |
protected boolean |
initialized
Field indicating if the TreeUI has already been initialized. |
protected CellRendererPane |
rendererPane
The current CellRendererPane |
protected TreeNode |
root
The root Treenode. |
protected MyTreeUI.TreeExpansionHandler |
teh
Reference to an inner class, that is not used now and does only exists for compatibility. |
Constructor Summary | |
MyTreeUI()
Creates a new TreeUI. |
Method Summary | |
void |
cancelEditing(JTree tree)
Not implemented, because this TreeUI doesn't support editing. |
static ComponentUI |
createUI(JComponent c)
It returns an instance of MyTreeUI as the original BasicTreeUI implementation does. |
TreePath |
getClosestPathForLocation(JTree tree,
int x,
int y)
Implementation different to original SWING BasicTreeUI. |
TreePath |
getEditingPath(JTree tree)
Not implemeted. |
Dimension |
getMaximumSize(JComponent c)
Returns the preferred size of the component. |
Dimension |
getMinimumSize(JComponent c)
Returns the preferred size of the component. |
Rectangle |
getPathBounds(JTree tree,
TreePath path)
Not implemented correct. |
TreePath |
getPathForRow(JTree tree,
int row)
Implementation different to original SWING BasicTreeUI. |
Dimension |
getPreferredSize(JComponent c)
Returns the preferred size of the component. |
int |
getRowCount(JTree tree)
Not implemented, because rows don't make sense in this TreeUI. |
int |
getRowForPath(JTree tree,
TreePath path)
Not implemented, because rows don't make sense in this TreeUI. |
protected void |
installListeners()
Installs the MouseHandler, TreeExpansionHandler and the TreeModelhandler. |
void |
installUI(JComponent c)
This method ist called by the JTree, it is an undocumented call and therefore is is possible that other implementations of Swing dont call this method. |
boolean |
isEditing(JTree tree)
Returns tree.isEditing() whatever that means. |
void |
paint(Graphics g,
JComponent c)
This method is invoked by Swing to draw components. |
void |
startEditingAtPath(JTree tree,
TreePath path)
Not implemented, because this TreeUI doesn't support editing. |
boolean |
stopEditing(JTree tree)
Not implemented, because this TreeUI doesn't support editing. |
void |
uninstallUI(JComponent c)
This method only calls the super.uninstallUI(c). |
protected void |
updateRenderer()
Messaged from the tree we're in when the renderer has changed. |
Methods inherited from class javax.swing.plaf.ComponentUI |
contains, getAccessibleChild, getAccessibleChildrenCount, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected CellRendererPane rendererPane
protected TreeSelectionModel currenttsm
protected MyTreeUI.TreeExpansionHandler teh
protected TreeNode root
protected boolean initialized
Constructor Detail |
public MyTreeUI()
Method Detail |
public static ComponentUI createUI(JComponent c)
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
- not used. Not documented in the JavaDoc.public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
- not used. Not documented in the JavaDoc.public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
- not used. Not documented in the JavaDoc.public void cancelEditing(JTree tree)
cancelEditing
in class TreeUI
public TreePath getClosestPathForLocation(JTree tree, int x, int y)
getClosestPathForLocation
in class TreeUI
tree
- ignored.x,y
- ignored.public TreePath getEditingPath(JTree tree)
getEditingPath
in class TreeUI
public Rectangle getPathBounds(JTree tree, TreePath path)
getPathBounds
in class TreeUI
tree
- ignored.path
- ignored.public TreePath getPathForRow(JTree tree, int row)
getPathForRow
in class TreeUI
tree
- ignored.row
- ignored.public int getRowCount(JTree tree)
getRowCount
in class TreeUI
tree
- ignored.public int getRowForPath(JTree tree, TreePath path)
getRowForPath
in class TreeUI
tree
- ignored.public boolean isEditing(JTree tree)
isEditing
in class TreeUI
tree
- the JTree beeing displayed.public void startEditingAtPath(JTree tree, TreePath path)
startEditingAtPath
in class TreeUI
public boolean stopEditing(JTree tree)
stopEditing
in class TreeUI
tree
- ignored.public void paint(Graphics g, JComponent c)
paint
in class ComponentUI
g
- graphics object used for painting.c
- must be the JTree.public void installUI(JComponent c)
installUI
in class ComponentUI
c
- must be the JTree for beeing displayed.public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
c
- must be the JTree beeing displayed.
Was never tested.protected void updateRenderer()
protected void installListeners()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |