|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.panels.MetaTraversable oracle.ide.panels.Navigable
Each instance of the Navigable
class represents a
single tree node. Clicking on that tree node brings up the
UI corresponding to the associated Traversable
.
A Navigable
instance is responsible for building
part of the tree structure through its createTreeNode(NavigableContext)
method. This allows a
particular Navigable
implementation to provide for more
complex ways of determining the structure of its subtree.
Subclasses with additional member fields will also need to override
the copyTo(Object)
and copyToImpl(Navigable)
methods in order to maintain correct copying behavior. Without
the right copying behavior, a Navigable
subclass will
not cooperate properly with a NavigableRegistry
.
Displayable
Nested Class Summary | |
static class |
Navigable.NavigableComparator
Comparator implementation used for sorting child Navigable instances by label. |
Field Summary | |
static int |
BOLD
|
static java.lang.String |
DEFAULT_CHILD_COMPARATOR_KEY
The key to use for looking up the default Navigable.NavigableComparator in a
NavigableContext ; the Comparator is used for
sorting Navigable children during a call to createTreeNode(NavigableContext) . |
static int |
ITALIC
|
static java.util.Comparator |
NAVIGABLE_COMPARATOR
A standard Navigable.NavigableComparator that sorts Navigable instances
by the short label. |
static int |
PLAIN
|
Constructor Summary | |
protected |
Navigable()
Should only be used by copyTo(Object) . |
protected |
Navigable(java.lang.String shortLabel)
Creates a new Navigable with the specified
label. |
|
Navigable(java.lang.String shortLabel,
java.lang.Class traversableClass)
Creates a new Navigable with the specified
label and Traversable class. |
|
Navigable(java.lang.String shortLabel,
java.lang.Class traversableClass,
java.lang.Class[] constructorArgTypes,
java.lang.Object[] constructorArgs,
Navigable[] childNavigables)
|
|
Navigable(java.lang.String shortLabel,
java.lang.Class traversableClass,
Navigable[] childNavigables)
Creates a new Navigable with the specified label,
Traversable class, and array of child
Navigable s. |
Method Summary | |
void |
addChildNavigable(Navigable childNavigable)
Adds a new Navigable to the array of child
Navigables. |
protected void |
appendChildNavigables(javax.swing.tree.DefaultMutableTreeNode parent,
NavigableContext nc)
This method calls getChildNavigables() to get the list of
child Navigable objects. |
protected void |
appendChildNodes(javax.swing.tree.DefaultMutableTreeNode parent,
Navigable[] children,
NavigableContext nc)
This method invokes createTreeNode(NavigableContext) on each
Navigable specified in children and adds
the resulting DefaultMutableTreeNode (if it is not
null ) to the parent . |
protected void |
appendDetailNavigables(javax.swing.tree.DefaultMutableTreeNode parent,
NavigableContext nc)
This method calls getDetailNavigables() to get the list
of detail Navigable objects. |
java.lang.Object |
copyTo(java.lang.Object target)
Subclasses must override this method if new member fields are introduced. |
protected void |
copyToImpl(Navigable copy)
Subclasses must implement an appropriate variant of this method if new member fields are introduced. |
javax.swing.tree.DefaultMutableTreeNode |
createDetailRootNode(NavigableContext nc)
When the Navigable is used to show detail nodes in a
separate tree, this method is used to construct the detail tree,
using the returned tree node as the root of the detail tree; in
general, only NavigableUIContainer implementations should
call this method directly. |
javax.swing.tree.DefaultMutableTreeNode |
createTreeNode(NavigableContext nc)
This method constructs a DefaultMutableTreeNode that is
to represent the Navigable in the tree; in general,
only NavigableUIContainer implementations should call this
method directly. |
protected javax.swing.tree.DefaultMutableTreeNode |
createTreeNodeImpl(NavigableContext nc)
This method is the essential method in which a tree node that represents a Navigable is created. |
protected java.util.Comparator |
getChildComparator()
Fetch the comparator to use for sorting the child navigables. |
protected Navigable[] |
getChildNavigables()
By default, this returns the child Navigable s that were
set when this DefaultNavigable was constructed. |
protected Navigable[] |
getDetailNavigables()
Returns null by default. |
int |
getDisplayStyle()
|
javax.swing.Icon |
getIcon()
Part of Displyable interface. |
java.lang.String |
getLongLabel()
Part of Displayable interface. |
java.lang.String |
getShortLabel()
Part of Displayable interface. |
java.lang.String |
getToolTipText()
Part of Displayable interface. |
protected boolean |
mayHaveChildren(NavigableContext nc)
Overridable method to determine whether a Navigable may have
children such that a + may be shown next to it in the tree. |
void |
setChildComparator(java.util.Comparator customComparator)
Sets whether the child navigables are sorted or not. |
protected void |
setChildNavigables(Navigable[] childNavigables)
Accessor for the private data member that stores the current child Navigable s. |
protected void |
setDataScope(Namespace dataScope)
Sets the specified Namespace as the data scope for this
Navigable . |
void |
setDisplayStyle(int displayStyle)
|
void |
setShortLabel(java.lang.String shortLabel)
|
protected static Navigable[] |
sortNavigables(Navigable[] navigables,
java.util.Comparator comparator)
Sorts the specified Navigable array using the specified
Navigable.NavigableComparator , and returns a sorted version of the array. |
java.lang.String |
toString()
Returns the Short Label displayed to a user. |
Methods inherited from class oracle.ide.panels.MetaTraversable |
copyToImpl, getTraversableClass, isUsingTraversableDefaultConstructor, newTraversable, newTraversable, setHelpID, setNameLink |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int PLAIN
public static final int BOLD
public static final int ITALIC
public static final java.lang.String DEFAULT_CHILD_COMPARATOR_KEY
Navigable.NavigableComparator
in a
NavigableContext
; the Comparator
is used for
sorting Navigable
children during a call to createTreeNode(NavigableContext)
.
public static final java.util.Comparator NAVIGABLE_COMPARATOR
Navigable.NavigableComparator
that sorts Navigable
instances
by the short label.
Constructor Detail |
protected Navigable(java.lang.String shortLabel)
Navigable
with the specified
label. There is no associated Traversable
class, and the
Navigable
has no children. In general, this
constructor will be called by a subclass that overrides MetaTraversable.newTraversable(ApplyNotifier)
, getChildNavigables()
, and/or getDetailNavigables()
.
shortLabel
- The short label to display when rendering the
UI for the Navigable
.public Navigable(java.lang.String shortLabel, java.lang.Class traversableClass)
Navigable
with the specified
label and Traversable
class. The Navigable
has no children unless a subclass implementation provides them.
shortLabel
- The short label to display when rendering the
UI for the Navigable
.traversableClass
- The Class
of the Traversable
associated with this Navigable
. Since
many usages of Navigable
do not require any
parameters when instantiating the Traversable
, this is
provided as a convenience. Note that if the Traversable
class implements the ApplyListener
interface, instances will
be added as an ApplyListener to the ApplyNotifier
linked
to the NavigableUIContainer
.{@link #newTraversable(ApplyNotifier)}.
public Navigable(java.lang.String shortLabel, java.lang.Class traversableClass, Navigable[] childNavigables)
Navigable
with the specified label,
Traversable
class, and array of child
Navigable
s.
shortLabel
- The short label to display when rendering the
UI for the Navigable
.traversableClass
- The Class
of the Traversable
associated with this Navigable
. Since
many usages of Navigable
do not require any
parameters when instantiating the Traversable
, this is
provided as a convenience. See MetaTraversable.newTraversable(ApplyNotifier)
.childNavigables
- An array of the children of this
Navigable
. This parameter may be null
if there are no children.public Navigable(java.lang.String shortLabel, java.lang.Class traversableClass, java.lang.Class[] constructorArgTypes, java.lang.Object[] constructorArgs, Navigable[] childNavigables)
protected Navigable()
copyTo(Object)
.
Method Detail |
public java.lang.Object copyTo(java.lang.Object target)
Copyable
for
details.
copyTo
in interface Copyable
copyTo
in class MetaTraversable
Copyable.copyTo(Object)
protected final void copyToImpl(Navigable copy)
protected final void copyToImpl( copy );
Then, the subclass implementation must first delegate to this
method with a call to:
super.copyToImpl( copy );
This ensures that the copyTo(Object)
method instantiates
the correct class when the target is null
and also
provides an extendable way of implementing copying behavior.
copy
- The Navigable
to which this
Navigable
's state should be copied.public java.lang.String getShortLabel()
Displayable
interface. This implementation
returns the short label that was specified when this
Navigable
was created.
getShortLabel
in interface Displayable
Displayable
that can be shown to the user.Displayable.getShortLabel()
public java.lang.String getLongLabel()
Displayable
interface. This implementation
simply invokes return getShortLabel()
.
getLongLabel
in interface Displayable
Displayable
that
can be shown to the user.Displayable.getLongLabel()
public javax.swing.Icon getIcon()
Displyable
interface. This implementation
always returns null
.
getIcon
in interface Displayable
Icon
to be displayed for the
Displayable
.Displayable.getIcon()
public java.lang.String getToolTipText()
Displayable
interface. This implementation
always returns null
.
getToolTipText
in interface Displayable
Displayable
.Displayable.getToolTipText()
public java.lang.String toString()
Displayable
toString
method in java.lang.Object
.
Implementors of the Displayable
interface should
override this as appropriate. The default implementation is
the same as getShortLabel
toString
in interface Displayable
public int getDisplayStyle()
public void setDisplayStyle(int displayStyle)
public void setShortLabel(java.lang.String shortLabel)
public void setChildComparator(java.util.Comparator customComparator)
Navigable
instance.
customComparator
- comparator to use for sorting, null to
disable sortingprotected java.util.Comparator getChildComparator()
public javax.swing.tree.DefaultMutableTreeNode createTreeNode(NavigableContext nc)
DefaultMutableTreeNode
that is
to represent the Navigable
in the tree; in general,
only NavigableUIContainer
implementations should call this
method directly. Subclasses may, of course, override the
behavior.
The user object of the returned tree node (and all its descendant
nodes) must be an instance of Navigable
.
If the return value is null
, the
Navigable
is omitted from the tree.
Note: this method returns DefaultMutableTreeNode instead of just MutableTreeNode because the getUserObject(...) method is not specified by MutableTreeNode.
nc
- The NavigableContext
in which this
Navigable
should render the tree node.
Navigable
.public javax.swing.tree.DefaultMutableTreeNode createDetailRootNode(NavigableContext nc)
Navigable
is used to show detail nodes in a
separate tree, this method is used to construct the detail tree,
using the returned tree node as the root of the detail tree; in
general, only NavigableUIContainer
implementations should
call this method directly. Subclasses may, of course, override
the behavior.
The root is not actually displayed in the detail tree, so the
user object associated with the root is not important. However,
all descendants of the returned root must also be instances of
DefaultMutableTreeNode
whose user objects are instances
of Navigable
.
It is important that this method return a non-null
value, even if there are no detail root nodes.
nc
- The NavigableContext
in which this
Navigable
should render the tree node.
Navigable
has no detail nodes, then
this method must return an empty tree node.public void addChildNavigable(Navigable childNavigable)
Navigable
to the array of child
Navigables.
protected void setDataScope(Namespace dataScope)
Namespace
as the data scope for this
Navigable
. This method must be called at some point
before a Navigable
is used in a UI container.
This is a transient property, so it will not be copied in the
copyTo(Object)
or copyToImpl(Navigable)
method.
dataScope
- The Namespace
that represents the data
scope for this Navigable
.protected Navigable[] getChildNavigables()
Navigable
s that were
set when this DefaultNavigable
was constructed.
Subclasses can override this method to specify a custom list of
children. The result of this method is used by
appendChildNavigables(...)
to append
child nodes.
Navigable
s of this
Navigable
.protected void setChildNavigables(Navigable[] childNavigables)
Navigable
s.
protected Navigable[] getDetailNavigables()
null
by default. Subclasses should override
this method in order to specify a list of detail Navigable
s. The result of this method is used by appendDetailNavigables(DefaultMutableTreeNode,
NavigableContext)
to append detail nodes.
Navigables
representing the
detail for this Navigable
. Detail nodes are
uncommonly used, so in order to specify detail nodes, a subclass
must override this method's implementation in order to provide
a return value other than null
.protected javax.swing.tree.DefaultMutableTreeNode createTreeNodeImpl(NavigableContext nc)
Navigable
is created. It is called from
createTreeNode(NavigableContext)
. This
implementation has been separated to express a specific step in
the Template Method design pattern for creating a
Navigable
tree node.
nc
- The NavigableContext
in which this
Navigable
should render the tree node.
Navigable
has no detail nodes, then
this method must return an empty tree node.protected void appendChildNavigables(javax.swing.tree.DefaultMutableTreeNode parent, NavigableContext nc)
getChildNavigables()
to get the list of
child Navigable
objects. Then this method calls
appendChildNodes
to append the child
Navigable
s to the specified parent.
parent
- The node to which the child nodes will be added.nc
- The NavigableContext
in which this
Navigable
should render the child tree nodes.protected void appendChildNodes(javax.swing.tree.DefaultMutableTreeNode parent, Navigable[] children, NavigableContext nc)
createTreeNode(NavigableContext)
on each
Navigable
specified in children
and adds
the resulting DefaultMutableTreeNode
(if it is not
null
) to the parent
.
parent
- The node to which the child nodes will be added.children
- The child Navigable
s whose
DefaultMutableTreeNode
representations are to be added to
the parent
.nc
- The NavigableContext
in which this
Navigable
should render its tree nodes.protected void appendDetailNavigables(javax.swing.tree.DefaultMutableTreeNode parent, NavigableContext nc)
getDetailNavigables()
to get the list
of detail Navigable
objects. Then this method calls
appendChildNodes
to append the detail
Navigable
s to the specified parent
.
parent
- The node to which the detail nodes will be added.nc
- The NavigableContext
in which this
Navigable
should render its tree nodes.protected static Navigable[] sortNavigables(Navigable[] navigables, java.util.Comparator comparator)
Navigable
array using the specified
Navigable.NavigableComparator
, and returns a sorted version of the array. The
input array is never modified; if the array might need sorting, a
copy of the array is sorted and returned instead.
protected boolean mayHaveChildren(NavigableContext nc)
Navigable
may have
children such that a + may be shown next to it in the tree.
Implementations can override this when the result is known a priori and a
call to getChildNavigables()
could be expensive. The test
should include detail Navigable
instances as well if the
NavigableContext
specifies that detail nodes should be shown
as children
nc
- The NavigableContext
used to determine the
context of the check
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.