|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openide.explorer.ExplorerManager
Manages a selection and root context for a (set of) Explorer view(s).
The views should register their VetoableChangeListener
s and PropertyChangeListener
s at
the ExplorerManager
of the Explorer they belong to. The manager listens on changes
to the node hierarchy and updates the selection and root node.
Deserialization of this object is done with validation with priority 10. In readObject
the ExplorerManager is temporarily initialized with void values. These values are
replaced with original ones when the validation proceeds.
Deserialization may throw SafeException
if the contexts cannot be restored correctly,
but the stream is uncorrupted.
Inner Class Summary | |
static interface |
ExplorerManager.Provider
Interface for components wishing to provide their own ExplorerManager . |
Field Summary | |
static String |
PROP_EXPLORED_CONTEXT
Name of property for the explored context. |
static String |
PROP_NODE_CHANGE
Name of property for change in a node. |
static String |
PROP_ROOT_CONTEXT
Name of property for the root context. |
static String |
PROP_SELECTED_NODES
Name of property for the node selection. |
Constructor Summary | |
ExplorerManager()
Construct a new manager. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeListener to the listener list. |
void |
addVetoableChangeListener(VetoableChangeListener l)
Add a VetoableListener to the listener list. |
Object |
clone()
Clones the manager. |
static ExplorerManager |
find(Component comp)
Find the proper Explorer manager for a given component. |
Node |
getExploredContext()
Get the explored context. |
Node |
getRootContext()
Get the root context. |
Node[] |
getSelectedNodes()
Get the set of selected nodes. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Remove a PropertyChangeListener from the listener list. |
void |
removeVetoableChangeListener(VetoableChangeListener l)
Remove a VetoableChangeListener from the listener list. |
void |
setExploredContext(Node value)
Set the explored context. |
void |
setExploredContext(Node value,
Node[] selection)
Set the explored context. |
void |
setExploredContextAndSelection(Node value,
Node[] selection)
Set the explored context and selected nodes. |
void |
setRootContext(Node value)
Set the root context. |
void |
setSelectedNodes(Node[] value)
Set the set of selected nodes. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String PROP_ROOT_CONTEXT
public static final String PROP_EXPLORED_CONTEXT
public static final String PROP_SELECTED_NODES
public static final String PROP_NODE_CHANGE
Constructor Detail |
public ExplorerManager()
Method Detail |
public Object clone()
clone
in class Object
public Node[] getSelectedNodes()
null
) if none are selectedpublic final void setSelectedNodes(Node[] value) throws PropertyVetoException
value
- the nodes to select; empty (not null
) if none are to be selectedPropertyVetoException
- when the given nodes cannot be selectedIllegalArgumentException
- if null
is given, or if any elements
of the selection are not within the current root contextpublic final Node getExploredContext()
The "explored context" is not as frequently used as the node selection;
generally it refers to a parent node which contains all of the things
being displayed at this moment. For BeanTreeView
this is
irrelevant, but ContextTreeView
uses it (in lieu of the node
selection) and for IconView
it is important (the node
whose children are visible, i.e. the "background" of the icon view).
null
public final void setExploredContext(Node value)
value
- the new node to explore, or null
if none should be explored.IllegalArgumentException
- if the node is not within the current root context in the node hierarchypublic final void setExploredContext(Node value, Node[] selection)
value
- the new node to explore, or null
if none should be explored.IllegalArgumentException
- if the node is not within the current root context in the node hierarchypublic final void setExploredContextAndSelection(Node value, Node[] selection) throws PropertyVetoException
value
- the new node to explore, or null
if none should be explored.selection
- the new nodes to be selectedIllegalArgumentException
- if the node is not within the current root context in the node hierarchyPropertyVetoExcepion
- if listeners attached to this explorer manager do sopublic final Node getRootContext()
The "root context" is simply the topmost node that this explorer can
display or manipulate. For BeanTreeView
, this would mean
the root node of the tree. For e.g. IconView
, this would
mean the uppermost possible node that that icon view could display;
while the explored context would change at user prompting via the
up button and clicking on subfolders, the root context would be fixed
by the code displaying the explorer.
public final void setRootContext(Node value)
value
- the new node to serve as a rootIllegalArgumentException
- if it is null
public void addPropertyChangeListener(PropertyChangeListener l)
PropertyChangeListener
to the listener list.l
- the listener to addpublic void removePropertyChangeListener(PropertyChangeListener l)
PropertyChangeListener
from the listener list.l
- the listener to removepublic void addVetoableChangeListener(VetoableChangeListener l)
VetoableListener
to the listener list.l
- the listener to addpublic void removeVetoableChangeListener(VetoableChangeListener l)
VetoableChangeListener
from the listener list.l
- the listener to removepublic static ExplorerManager find(Component comp)
ExplorerManager.Provider
.
This method should be used in Component.addNotify()
of each component
that works with the Explorer manager, e.g.:
private transient ExplorerManager explorer;
public void addNotify () {
super.addNotify ();
explorer = ExplorerManager.find (this);
}
comp
- component to find the manager forProvider
ExplorerManager.Provider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |