public abstract class MasterDetailTreeNode extends Object implements TreeNode, Serializable
JTree
with exactly one TreeModel
.
The root node stores these. Through a node's parents one gets to the root, and thus these.
fetchChildren
, called once.
parent==null
then this node is root. In which case it stores table model and tree.
All nodes have getTableModel
etc methods, they just call parent.getTableModel until
root is found.
deleteNode0
, redraw
, getTreePath
etc.
Node.CellRenderer
, allowing icon,text,extra-text to be displayed
newPopupMenu
Tree t = new Tree(); // from NetBeans UI designer MyRootNode n = new MyNode(null); // extends MasterDetailTreeNode, parent==null n.installIntoTreeAsRootNode(t);
Modifier and Type | Method and Description |
---|---|
Enumeration<MasterDetailTreeNode> |
children() |
void |
expandAllChildren() |
int |
getAcceptableDropActions()
Returns a bitmask of acceptable actions such as
DnDConstants.ACTION_COPY . |
DataFlavor[] |
getAcceptableDropFlavors()
Returns array of Flavors which can be accepted, in the case a drag & drop
attempts to drop on this node.
|
TreeNode |
getChildAt(int param) |
int |
getChildCount() |
MasterDetailTreeNode[] |
getChildren() |
String |
getExtraText()
Returns the text which is in color at the end of the name.
|
Color |
getExtraTextColor()
Returns the color which should be used for the extra text.
|
int |
getIndex(TreeNode treeNode) |
TreeNode |
getParent() |
MasterDetailTreeNode |
getSelectedNode()
Can be called anywhere on the tree.
|
abstract ImageIcon |
getTreeIcon()
Returns an ImageIcon which represents this icon, to be displayed to the
left of it in the tree-view
|
abstract String |
getTreeText()
Returns the text which can be used to display this icon in the
tree-view
|
void |
installIntoTreeAsRootNode(JTree tree,
JPanel detailPanelContainer,
JPanel defaultDetailPanel)
Sets
Node.treeModel and makes this the first node
of it. |
boolean |
isLeaf() |
abstract JPanel |
newDetailJPanel()
Create and return a Panel which can be displayed on the right hand
side of the window, when this node is selected.
|
JPopupMenu |
newPopupMenu()
Create and return a JPopupMenu which can be displayed when the user
right-clicks on this node, or null for no pop-up menu
|
TreePath |
newTreePath() |
void |
redraw() |
void |
select() |
void |
setParent(MasterDetailTreeNode n) |
void |
transferrableHasBeenDropped(DropTargetDropEvent e)
When a
Transferrable is dropped on this node, this method
is called. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllowsChildren
public MasterDetailTreeNode[] getChildren()
public void setParent(MasterDetailTreeNode n)
public void installIntoTreeAsRootNode(JTree tree, JPanel detailPanelContainer, JPanel defaultDetailPanel)
Node.treeModel
and makes this the first node
of it. Also sets some properties of the tree such as the cell renderer.
This can only be called on root nodes (where parent==null
)detailPanelContainer
- panel which should contain the detail panelsdefaultDetailPanel
- if no node selected, this panel is shown in detailContainingPanel
public TreePath newTreePath()
public void select()
public void redraw()
public void expandAllChildren()
public MasterDetailTreeNode getSelectedNode()
public abstract JPanel newDetailJPanel()
public JPopupMenu newPopupMenu()
public abstract ImageIcon getTreeIcon()
public abstract String getTreeText()
public String getExtraText()
public Color getExtraTextColor()
public DataFlavor[] getAcceptableDropFlavors()
public int getAcceptableDropActions()
DnDConstants.ACTION_COPY
.public void transferrableHasBeenDropped(DropTargetDropEvent e)
Transferrable
is dropped on this node, this method
is called. In the default implementation this should never be reached,
as a default node cannot accept any DataFlavors or accept any actions.public Enumeration<MasterDetailTreeNode> children()
public TreeNode getChildAt(int param)
getChildAt
in interface TreeNode
public int getChildCount()
getChildCount
in interface TreeNode