org.openide.explorer
.
Classes pertaining to the Property Sheet (which displays properties of
explored nodes) may be found in
org.openide.explorer.propertysheet
.
A set of standard Explorer Views is available in
org.openide.explorer.view
.
getActions()
.
A given Explorer view instance will be some visual component (such as a Swing panel) displaying some representation of a Node and its children. The topmost node being displayed is said to be the root of the Explorer.
The API permits you to use the prebuilt views, and also to create your own if you need to.
NodeOperation.explore(...)
.
This will simply show a node and its subtree (if any) in a new window
using the normal tree-style Explorer view. It does not permit any
customization of the UI, however - it creates a standard window with
the usual buttons, etc.
If you want to use a special view, it is first necessary to understand the structure of a live Explorer instance:
ExplorerManager.Provider
.
Often in NetBeans it will be a subclass of TopComponent.
This topmost container does not really do anything; it just makes sure
that an ExplorerManager
can be found by its
children. Follow the instructions in
ExplorerUtils
,
to create such a panel.
The container that implements ExplorerManager.Provider may contain
non-Explorer components - add whatever components you like to it, set
layout appropriately. When an Explorer view is added as a descendant
of this panel, it will find this panel by searching the component
hierarchy.
ExplorerManager
itself handles the control of the Explorer view or views it is
attached to. It provides the external interface by which the selection
of nodes, e.g., can be examined or set, and permits multiple views to
be synchronized (for example, creating a master/detail view is very easy).
ExplorerActions
object will be attached to the manager to make sure that such things
as cut/copy/paste actions are correctly enabled or disabled according
to the current node selection. Typically, the topmost component will
attach these actions to the manager when it is
activated
or otherwise given focus (and detach them when
not). ExplorerPanel
does this for you.
Once you have created an Explorer component, your code will not typically interact directly with it - rather it will call methods on its ExplorerManager to set selection, etc.
org.openide.explorer.view
contains a number of prebuilt views which you may use. Of special note
are the
BeanTreeView
,
which is the standard tree view used to implement the Explorer window
proper;
and
MenuView
,
which is of interest because it actually implements a view using popup
menus, rather than a static display. The best way to familiarize
yourself with the standard views, and to test any custom view you
might build, is probably to create an ExplorerPanel
which
adds some or all of them; the views will be automatically
synchronized, which will be helpful in understanding how they behave.
PropertySheetView
to the container. It is an Explorer view which does not actually
display any nodes, but rather displays a list of properties for the
node or nodes which are selected according to the ExplorerManager.
Since views by default will share the same manager if they are added to the same manager-providing container, just adding a regular Explorer view and a Property Sheet to the same container will result in the Property Sheet being sensitive to the node selection in the regular view, which is usually the desired effect.
Children.Keys
.
Generally nodes may allow their children to be
reordered.
Node.getActions()
,
Node.getContextActions()
,
Node.getDefaultAction()
,
Node.getContextMenu()
,
etc. are typically used to build an event-handling system for the
visual representation of the nodes.
Node.hasCustomizer()
,
Node.getLookup().lookup(...)
,
Node.getNewTypes()
,
Node.getPasteTypes(...)
,
and so on affect other UI components (such as toolbars) which may hold
action presenters.
Node.getPropertySets()
is of course used by the Property Sheet view.
Node.canRename()
,
Node.cloneNode()
,
or
Node.clipboardCut()
.
Consider providing a custom UI where possible, rather than relying on the user having the Property Sheet visible to work with your module.
Node.PropertySet
can specify that it should be displayed in
a tab: It must return an internationalized string from
PropertySet.getValue("tabName")
. If multiple
property sets belonging to a single node specify the same tab name
in this manner, all of them will be included on a tab with the specified
name*.
* Note that for this functionality to function properly, the NetBeans Window System must be installed. Further information on how to work use this functionality in a stand-alone application can be found here.
Node.Property
or
PropertyDescriptor
. This is described in detail
here.