|
org.openide.nodes 7.12.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openide.nodes.NodeOp
public final class NodeOp
Utility class for operations on nodes.
Since version 7.9 this class supports creation of a lazy node
-
a node that displays basic information
about the original node behind it, without touching the original. As soon as
the node is expanded, or a pop up menu is invoked on it, it switches
to the real delegates and since then everything is being bridged to
the real node.
This method is especially useful when used from
layers.
Use following
XML snippet to register your node into Services tab:
<folder name="UI"> <folder name="Runtime"> <file name="org-yourorg-yourpgk-YourNode.instance"> <attr name="instanceCreate" methodvalue="org.openide.nodes.NodeOp.factory"/> <attr name="name" stringvalue="YourNode"/> <attr name="displayName" bundlevalue="org.yourorg.yourpkg.Bundle#NAME-KEY"/> <attr name="shortDescription" bundlevalue="org.yourorg.yourpkg.Bundle#SHORT-KEY"/> <attr name="iconResource" stringvalue="org/yourorg/yourpkg/image.png"/> <attr name="original" newvalue="org.yourorg.yourpkg.YourNode"/> <file/> <folder/> <folder/>
Method Summary | |
---|---|
static int[] |
computePermutation(Node[] arr1,
Node[] arr2)
Compute a permutation between two arrays of nodes. |
static String[] |
createPath(Node node,
Node parent)
Find a path (by name) from one node to the root or a parent. |
static Action[] |
findActions(Node[] nodes)
Asks the provided nodes for their actions and those that are common, to all of them returns. |
static Node |
findChild(Node node,
String name)
Look for a node child of given name. |
static JPopupMenu |
findContextMenu(Node[] nodes)
Compute common menu for specified nodes. |
static Node |
findPath(Node start,
Enumeration<String> names)
Traverse a path from a parent node down, by an enumeration of names. |
static Node |
findPath(Node start,
String[] names)
Traverse a path from a parent node down, by an enumeration of names. |
static Node |
findRoot(Node node)
Find the root for a given node. |
static Node[] |
fromHandles(Node.Handle[] handles)
Takes array of handles and creates array of nodes. |
static SystemAction[] |
getDefaultActions()
Deprecated. Do not use this method. It is useless now. |
static boolean |
isSon(Node parent,
Node son)
Test whether the second node is a (direct) child of the first one. |
static void |
setDefaultActions(SystemAction[] def)
Deprecated. Useless. |
static Node.Handle[] |
toHandles(Node[] nodes)
Takes array of nodes and creates array of handles. |
static NodeListener |
weakNodeListener(NodeListener l,
Object source)
Creates a weak implementation of NodeListener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
@Deprecated public static SystemAction[] getDefaultActions()
@Deprecated public static void setDefaultActions(SystemAction[] def)
public static JPopupMenu findContextMenu(Node[] nodes)
nodes
- the nodes
public static Action[] findActions(Node[] nodes)
nodes
- array of nodes to compose actions for
public static boolean isSon(Node parent, Node son)
parent
- parent nodeson
- son node
true
if sopublic static String[] createPath(Node node, Node parent)
node
- the node to start inparent
- parent node to stop in (can be null
for the root)
IllegalArgumentException
- if node
's getName()
method returns null
public static Node findChild(Node node, String name)
node
- node to search inname
- name of child to look for
null
if there is no such childpublic static Node findPath(Node start, Enumeration<String> names) throws NodeNotFoundException
start
- node to start searching atnames
- enumeration of names of nodes
along the path
NodeNotFoundException
- if the node with such name
does not exists; the exception contains additional information
about the failure.public static Node findPath(Node start, String[] names) throws NodeNotFoundException
start
- node to start searching atnames
- names of nodes
along the path
NodeNotFoundException
- if the node with such name
does not exists; the exception contains additional information
about the failure.public static Node findRoot(Node node)
node
- the node
public static int[] computePermutation(Node[] arr1, Node[] arr2) throws IllegalArgumentException
arr1
- first arrayarr2
- second array
null
if the arrays are the same
IllegalArgumentException
- if the arrays cannot be permuted to each other. Either
they have different sizes or they do not contain the same elements.public static Node.Handle[] toHandles(Node[] nodes)
nodes
- array of nodes
public static Node[] fromHandles(Node.Handle[] handles) throws IOException
handles
- array of handles
IOException
- if a node cannot be created from the handlepublic static NodeListener weakNodeListener(NodeListener l, Object source)
l
- the listener to delegate tosource
- the source that the listener should detach from when
listener l
is freed, can be null
l
.
|
org.openide.nodes 7.12.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |