ExplorerManager (Hyperic HQ Plugin API)
Keywords: org.hyperic.hq.bizapp.explorer.ExplorerManager class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.hq.bizapp.explorer
Class ExplorerManager

    java.lang.Object
      org.hyperic.hq.bizapp.explorer.ExplorerManager

    public class ExplorerManager

extends java.lang.Object

This manager provides a registry and utility methods when dealing with ExplorerItems and trees. The manager is also used to traverse an item hierarchy. The methods `findAllChildren(ExplorerContext, ExplorerItem)` and `findChild(ExplorerContext, ExplorerItem, String)` can be used to deal with item children. `ExporerItem`s essentially have 2 sets of children .. ones which are implicit to them `ExplorerItem.getChildren()` and ones which are adopted, and specified by some other `ExplorerItemType`. Calling the hierarchy methods from the manager ensures that both sets of children are accounted for. The major players in the Explorer code is the `ExplorerManager`, the `ExplorerItemType`, and `ExplorerViewProvider`. There are 2 main phases in dealing with the explorer. First part: Generating a tree 1 - Querying ExplorerManager (via findAllChildren(), you can create a tree represented by ExplorerItems 2 - To fill out this tree of ExplorerItems, the manager talks to ExplorerTypes which have been registered, asking if they have children for the currently processed node. Second part: After selecting an ExplorerItem, getting the views 1 - Once an ExplorerItem is obtained, you can ask the ExplorerManager which views it has onto that item. 2 - The ExplorerManager then asks all the registered ExplorerViewProviders for their views of that item, and returns them in a list. Finally, the UI can take that list of views and present their associated content in the right-hand side.

Method Summary
`java.lang.String` | `composePathTo(ExplorerItem item)` Compose a path of codes leading up to (and including) the item.
`java.util.List` | `findAllChildren(ExplorerContext ctx, ExplorerItem parent)` Find all children of a given parent, adopted and otherwise.
`ExplorerItem` | `findChild(ExplorerContext ctx, ExplorerItem parent, java.lang.String code)` Find a child of the given parent.
`ExplorerItem` | `findItem(ExplorerContext ctx, java.lang.String path)` Find an item by code, given a full path.
`java.util.Collection` | `getAllTypes()` Get a collection of all `ExplorerItemType`s
`static ExplorerManager` | `getInstance()`
`ExplorerItemType` | `getType(java.lang.String name)` Get an item type by name
`java.util.List` | `getViewsFor(ExplorerContext ctx, ExplorerItem item)` Get a list of `ExplorerView`s relevant to the specified item.
`void` | `registerProvider(HQUGroupProvider provider)`
`void` | `registerType(ExplorerItemType type)` Register an item type which can be used for filling out explorer trees.
`void` | `unregisterProvider(java.lang.String providerName)`
`void` | `unregisterType(java.lang.String name)` Unregister a previously registered item type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### registerProvider

    public void registerProvider(HQUGroupProvider provider)

### unregisterProvider

    public void unregisterProvider(java.lang.String providerName)

### getViewsFor

    public java.util.List getViewsFor(ExplorerContext ctx,
                                      ExplorerItem item)

  Get a list of `ExplorerView`s relevant to the specified item.

  Returns:
    a list of `ExplorerView`s

### registerType

    public void registerType(ExplorerItemType type)

  Register an item type which can be used for filling out explorer trees. The type is keyed off `ExplorerItemType.getName()`, so any item type previously using that name will be unregistered.

### unregisterType

    public void unregisterType(java.lang.String name)

  Unregister a previously registered item type.

  Parameters:
    `name` - the name of the item type, as from `ExplorerItemType.getName()`

### getType

    public ExplorerItemType getType(java.lang.String name)

  Get an item type by name

  See Also:
    `ExplorerItemType.getName()`

### getAllTypes

    public java.util.Collection getAllTypes()

  Get a collection of all `ExplorerItemType`s

### findChild

    public ExplorerItem findChild(ExplorerContext ctx,
                                  ExplorerItem parent,
                                  java.lang.String code)

  Find a child of the given parent. This method should be used (instead of parent.getChildren()), since a parent may have an adopted child specifying that code.

### findAllChildren

    public java.util.List findAllChildren(ExplorerContext ctx,
                                          ExplorerItem parent)

  Find all children of a given parent, adopted and otherwise.

### composePathTo

    public java.lang.String composePathTo(ExplorerItem item)

  Compose a path of codes leading up to (and including) the item.

  Returns:
    a path like: '/gRoot/g=1'

### findItem

    public ExplorerItem findItem(ExplorerContext ctx,
                                 java.lang.String path)

  Find an item by code, given a full path. A path is simply a series of ExplorerItem codes, separated by a / e.g.: findItem(ctx, "/gRoot/g=1") finds the GroupItem representing group id=1 under the root

### getInstance

    public static ExplorerManager getInstance()

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.