public class DefaultFTreeNodeAdapter extends Object implements FTreeNodeAdapter
Constructor and Description |
---|
DefaultFTreeNodeAdapter(int priority)
The constructor of a FTreeNodeAdapter.
|
DefaultFTreeNodeAdapter(int priority,
FTreeNodeObjectProvider objectProvider) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptNewText(FTreeNodeTextChangeEvent evt,
boolean oldAcceptNewName)
Invoked when a node's text is being changed to check if the corresponding adapters accept the
new text.
|
boolean |
allowsChildren(FTreeNode node,
boolean allowsChildren)
This method is invoked to check if the adapter allows the node to have a substructure.
|
boolean |
canTextBeChanged(FTreeNodeTextChangeEvent evt,
boolean oldCanBeRenamed)
Check if the given node's text can be changed.
|
void |
checkForChildren(FTreeNode node)
This method is invoked when the FTree needs to know about a given FTreeNode's structure.
|
org.freehep.util.commanddispatcher.CommandProcessor |
commandProcessor(FTreeNode[] selectedNodes)
Invoked after each selection change to get the CommandProcessor for the selected nodes.
|
boolean |
doubleClick(FTreeNode node)
This method defines the double click behavior of the given node.
|
Icon |
icon(FTreeNode node,
Icon oldIcon,
boolean selected,
boolean expanded)
Returns the icon of a given node in a given selected/expanded state.
|
JPopupMenu |
modifyPopupMenu(FTreeNode[] nodes,
JPopupMenu menu)
This method is invoked when a popup menu is to be displayed for a given set of nodes.
|
FTreeNodeTransferable |
modifyTransferable(FTreeNode[] nodes,
FTreeNodeTransferable transferable)
This method is invoked when a DnD action is initiated on a set of nodes.
|
boolean |
mouseClicked(FTreeNode node,
MouseEvent mouseEvent,
Dimension dimension)
This method is invoked every time a mouse click event occurs on the
representation of the FTreeNode.
|
void |
nodeBeingDeleted(FTreeNode node)
Invoked when the given node is being removed from then FTree.
|
FTreeNodeStructureProvider |
nodeStructureProvider(FTreeNode node)
Get the FTreeNodeStructureProvider for a given node.
|
void |
nodeTextChanged(FTreeNodeTextChangeEvent evt)
The FTree does not change the text of a node.
|
int |
priority(FTree tree)
This method is used by the FTreeLookupAdapter create a sorted list of FTreeNodeAdapters.
|
boolean |
selectionChanged(FTreeSelectionEvent e)
The default selection behavior is to cancel any existing selection,
effectively reducing the tree to a SINGLE_SELECTION_MODEL.
|
String |
statusMessage(FTreeNode node,
String oldMessage)
This method is invoked when the status message is to be displayed for a given node.
|
String |
text(FTreeNode node,
String oldText)
The text to be displayed next to the icon for a given FTreeNode.
|
String |
toolTipMessage(FTreeNode node,
String oldMessage)
This method is invoked when the tooltip is to be displayed for a given node.
|
Component |
treeCellRendererComponent(Component component,
FTreeNode node,
boolean sel,
boolean expanded,
boolean leaf,
boolean hasFocus)
This method is invoked on all adapters, starting from the lower priority one
each time the corresponding FTreeNode is to be rendered in the FTree.
|
FTreeNodeObjectProvider |
treeNodeObjectProvider(FTreeNode node)
Get the FTreeNodeObjectProvider for this adapter.
|
public DefaultFTreeNodeAdapter(int priority)
priority
- The adapter priority.public DefaultFTreeNodeAdapter(int priority, FTreeNodeObjectProvider objectProvider)
public Icon icon(FTreeNode node, Icon oldIcon, boolean selected, boolean expanded)
icon
in interface FTreeNodeAdapter
node
- The FTreeNode for which the icon is to be provided.oldIcon
- The icon as provided by the lower priority adapters. It can never be null.selected
- true if the node is currently selected.expanded
- true if the node is currently expanded.public boolean doubleClick(FTreeNode node)
doubleClick
in interface FTreeNodeAdapter
node
- The FTreeNode for which the doubleClick action is to be provided.public String statusMessage(FTreeNode node, String oldMessage)
statusMessage
in interface FTreeNodeAdapter
node
- The FTreeNode for which the status message is to be provided.oldMessage
- The current message as modified by previous adapters. It is never null.public String toolTipMessage(FTreeNode node, String oldMessage)
toolTipMessage
in interface FTreeNodeAdapter
node
- The FTreeNode for which the status message is to be provided.oldMessage
- The current message as modified by previous adapters. It is never null.public String text(FTreeNode node, String oldText)
text
in interface FTreeNodeAdapter
node
- The FTreeNode for which the text should be provided.oldText
- The current text as provided by previous adapters. It can be null.public boolean allowsChildren(FTreeNode node, boolean allowsChildren)
allowsChildren
in interface FTreeNodeAdapter
node
- The FTreeNode for which allowsChildren is invoked.allowsChildren
- The returned boolean by the lower priority adapters.true
if the node has a substructure.public void nodeBeingDeleted(FTreeNode node)
nodeBeingDeleted
in interface FTreeNodeAdapter
node
- The FTreeNode being deleted.public JPopupMenu modifyPopupMenu(FTreeNode[] nodes, JPopupMenu menu)
modifyPopupMenu
in interface FTreeNodeAdapter
nodes
- The array of FTreeNode for which the popup menu is to be provided. The nodes are in
the order in which they got selected.menu
- The current menu as it will be popped up if unchanged. It is NEVER null.public FTreeNodeTransferable modifyTransferable(FTreeNode[] nodes, FTreeNodeTransferable transferable)
modifyTransferable
in interface FTreeNodeAdapter
nodes
- The set of FTreeNode being dragged. The nodes are ordered as they were selected.transferable
- The FTreeNodeTransferable carrying the data of the DnD action.public org.freehep.util.commanddispatcher.CommandProcessor commandProcessor(FTreeNode[] selectedNodes)
selectedNodes()
should be used
within this method to get the list of the selected FTreeNodes. Such list is not provided as
an argument to this method to avoid each adapter having to store such list.commandProcessor
in interface FTreeNodeAdapter
public boolean canTextBeChanged(FTreeNodeTextChangeEvent evt, boolean oldCanBeRenamed)
canTextBeChanged
in interface FTreeNodeAdapter
evt
- The FTreeNodeTextChangeEvent containing the information for this change of text.oldCanBeRenamed
- The result as given by lower priority adapters.true
if the name of this node can be changed.public boolean acceptNewText(FTreeNodeTextChangeEvent evt, boolean oldAcceptNewName)
acceptNewText
in interface FTreeNodeAdapter
evt
- The FTreeNodeTextChangeEvent containing the information for this change of text.oldAcceptNewName
- The result of lower priority adapters.true
if the new name has been accepted.public void nodeTextChanged(FTreeNodeTextChangeEvent evt)
nodeTextChanged
in interface FTreeNodeAdapter
evt
- The FTreeNodeTextChangeEvent containing the information of the text change.public FTreeNodeObjectProvider treeNodeObjectProvider(FTreeNode node)
treeNodeObjectProvider
in interface FTreeNodeAdapter
node
- The FTreeNode for which the object provider is to be returned.public int priority(FTree tree)
priority
in interface FTreeNodeAdapter
tree
- The FTree on which the adapter will act.public void checkForChildren(FTreeNode node)
FTreeNodeAdapter
checkForChildren
in interface FTreeNodeAdapter
node
- The FTreeNode for which the sub-structure is being requested.public boolean selectionChanged(FTreeSelectionEvent e)
selectionChanged
in interface FTreeNodeAdapter
e
- The FTreeSelectionEvent containing the information of the selection change.public Component treeCellRendererComponent(Component component, FTreeNode node, boolean sel, boolean expanded, boolean leaf, boolean hasFocus)
FTreeNodeAdapter
treeCellRendererComponent
in interface FTreeNodeAdapter
component
- The FTreeNode's renderer as provided by lower priority adapters.node
- The FTreeNode for which the rendering is taking place.sel
- true
if the node is selected.expanded
- true
if the node is expanded.leaf
- true
if the node is a leaf.hasFocus
- true
if the node has focus.public boolean mouseClicked(FTreeNode node, MouseEvent mouseEvent, Dimension dimension)
FTreeNodeAdapter
mouseClicked
in interface FTreeNodeAdapter
node
- The FTreeNode on which the mouse has been clicked.mouseEvent
- The MouseEvent describing the click.dimension
- The location of the click in the FTreeNode's internal representation.true
if a non trivial behavior is provided.public FTreeNodeStructureProvider nodeStructureProvider(FTreeNode node)
FTreeNodeAdapter
nodeStructureProvider
in interface FTreeNodeAdapter
node
- The FTreeNode for which the FTreeNodeStructureProvider is requested.Copyright © 2016. All rights reserved.