public class JiveTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.awt.datatransfer.Transferable
JiveTreeNode
class is a better implementation than using the
DefaultMutableTree node. This allows better searching of children/parents as well
as handling of icons and drag and drop events.Modifier and Type | Field and Description |
---|---|
static java.awt.datatransfer.DataFlavor[] |
DATA_FLAVORS
Default Drag and Drop to use for Node detection.
|
Constructor and Description |
---|
JiveTreeNode(java.lang.Object o,
boolean allowsChildren)
Creates a new JiveTreeNode.
|
JiveTreeNode(java.lang.String userobject)
Creates a new JiveTreeNode.
|
JiveTreeNode(java.lang.String name,
boolean allowsChildren)
Create parent node.
|
JiveTreeNode(java.lang.String userObject,
boolean allowChildren,
javax.swing.Icon icon)
Creates a new JiveTreeNode.
|
JiveTreeNode(TreeFolder folder) |
JiveTreeNode(TreeFolder folder,
javax.swing.Icon img)
Creates a new JiveTreeNode from a TreeFolder.
|
JiveTreeNode(TreeItem item)
Creates a new JiveTreeNode from a TreeItem.
|
JiveTreeNode(TreeItem item,
javax.swing.Icon img)
Createa new JiveTreeNode from a TreeItem and Image.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getAssociatedObject()
Returns the associated object used.
|
javax.swing.Icon |
getClosedIcon()
Returns the icon that is displayed when the node is collapsed.
|
javax.swing.Icon |
getIcon()
Returns the default image used.
|
javax.swing.Icon |
getOpenIcon()
Return the icon that is displayed when the node is expanded.
|
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor) |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
Transferable implementation
|
boolean |
hasParent(java.lang.String parentName)
Returns true if a parent with the specified name is found.
|
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor) |
void |
setAssociatedObject(java.lang.Object o)
Returns the associated object.
|
void |
setIcon(javax.swing.Icon icon)
Sets the default icon.
|
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
public static final java.awt.datatransfer.DataFlavor[] DATA_FLAVORS
public JiveTreeNode(TreeFolder folder)
public JiveTreeNode(java.lang.String name, boolean allowsChildren)
name
- the name of the node.allowsChildren
- true if the node allows children.public JiveTreeNode(java.lang.Object o, boolean allowsChildren)
o
- the object to use.allowsChildren
- true if it allows children.public JiveTreeNode(TreeItem item)
item
- the TreeItem
public JiveTreeNode(TreeFolder folder, javax.swing.Icon img)
folder
- the TreeFolder
.img
- the image to use in the node.public JiveTreeNode(TreeItem item, javax.swing.Icon img)
item
- the TreeItem
to use.img
- the image to use in the node.public JiveTreeNode(java.lang.String userobject)
userobject
- the object to use in the node. Note: By default, the node
will not allow children.public JiveTreeNode(java.lang.String userObject, boolean allowChildren, javax.swing.Icon icon)
userObject
- the userObject to use.allowChildren
- true if it allows children.icon
- the image to use in the node.public javax.swing.Icon getIcon()
public javax.swing.Icon getOpenIcon()
public javax.swing.Icon getClosedIcon()
public void setIcon(javax.swing.Icon icon)
icon
- the icon.public java.lang.Object getAssociatedObject()
public void setAssociatedObject(java.lang.Object o)
o
- the associated object.public final boolean hasParent(java.lang.String parentName)
parentName
- the name of the parent.public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException