blob: 547e2c4baa71c3f56b568e9d7ed2aa88b1669ee3 [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= DevFaqExplorerManager
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqExplorerManager
:description: Apache NetBeans wiki DevFaqExplorerManager
:toc: left
:toc-title:
:syntax: true
=== What is an ExplorerManager?
You do not directly set the Node that is displayed by an link:DevFaqExplorerViews.asciidoc[Explorer view ] component (Swing components that display link:DevFaqWhatIsANode.asciidoc[Nodes ]) by calling a method on that component. Rather, you set that kind of information by finding the _manager_ for that component - it's what is in charge of what node is displayed, selected, etc.
The manager may be explicitly set on an Explorer view, but usually this is not necessary. When you add a view component (such as a link:Http://www.netbeans.org/download/dev/javadoc/orgOpenideOxplorer/org/openide/explorer/view/BeanTreeView.html.asciidoc[BeanTreeView ]) to a Swing container, it will search backward through its parent, it's parent's parent, and so forth, looking for a component that implements link:Http://www.netbeans.org/download/dev/javadoc/orgOpenideOxplorer/org/openide/explorer/ExplorerManager.Provider.html.asciidoc[ExplorerManager.Provider ] (an interface with one method - `getExplorerManager()`). That ExplorerManager is what will determine what is displayed.
While this may seem like an unnecessary layer of indirection, it is actually quite powerful: It makes it possible to very simply create master-detail views ala Windows Explorer: Just add two views to a JPanel subclass that implements link:Http://www.netbeans.org/download/dev/javadoc/orgOpenideOxplorer/org/openide/explorer/ExplorerManager.Provider.html.asciidoc[ExplorerManager.Provider ]. It is very easy to set it up so changing the selection in one causes the other one to show the children of the selected object - just the way selecting a folder in Windows Explorer does.
See also the link:Http://www.netbeans.org/download/dev/javadoc/orgOpenideOxplorer/org/openide/explorer/ExplorerManager.html.asciidoc[ExplorerManager javadoc ]. The link:DevFaqCreateExplorerPanel.asciidoc[FAQ about showing explorer views in the main window ] includes sample usage of ExplorerManager.
=== Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.
This page was exported from link:http://wiki.netbeans.org/DevFaqExplorerManager[http://wiki.netbeans.org/DevFaqExplorerManager] ,
that was last modified by NetBeans user Admin
on 2009-11-06T15:41:30Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.