Extension SDK 10.1.2

oracle.ide.panels
Class NavigableRegistry

java.lang.Object
  extended byoracle.ide.panels.NavigableRegistry

public class NavigableRegistry
extends java.lang.Object

A data and UI registry for Navigables.

Data classes must meet the following requirements in order to be registered successfully:

After registerData(String, Class) is called to register a data class, subsequent calls to createData() will include the data class in the returned Map. Order of registration for data classes is not significant.

After registerUI(Navigable) is called to register some UI, subsequent calls to getNavigables() will include the Navigable in the returned array. Order of registration for Navigables is significant; the order of the Navigables in the returned array directly corresponds to the order in which they were registered. The returned array of Navigables is a copy of the registered Navigables, so any changes applied to them will not be reflected in the registry.


Constructor Summary
NavigableRegistry()
           
 
Method Summary
 java.util.Map createData()
          Create new instances of all data classes that have been registered and put them in a new Map, which is returned.
 void deregisterUI(Navigable navigable)
          Deregisters the UI that is specified by the Navigable.
 boolean ensureData(java.util.Map map)
          Iterates over the keys in data registry and if the map is missing any keys, then a new instance of the class registered with the data registry is created and added to the map.
 Navigable[] getNavigables()
          Returns an array whose contents are based on the Navigable objects that have been registered.
 void registerData(java.lang.String name, java.lang.Class dataClass)
          Registers a data class whose instance is referred to by the specified name.
 void registerUI(Navigable navigable)
          Registers the UI that is specified by the Navigable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavigableRegistry

public NavigableRegistry()
Method Detail

registerData

public void registerData(java.lang.String name,
                         java.lang.Class dataClass)
Registers a data class whose instance is referred to by the specified name. Data classes must meet the following requirements in order to be registered successfully: After this method is called to register a data class, subsequent calls to createData() will include the data class in the returned Map. Order of registration for data classes is not significant.


registerUI

public void registerUI(Navigable navigable)
Registers the UI that is specified by the Navigable. After this method is called to register some UI, subsequent calls to getNavigables() will include the Navigable in the returned array. Order of registration for Navigables is significant; the order of the Navigables in the returned array directly corresponds to the order in which they were registered. The returned array of Navigables is a copy of the registered Navigables, so any changes applied to them will not be reflected in the registry.


deregisterUI

public void deregisterUI(Navigable navigable)
Deregisters the UI that is specified by the Navigable.


createData

public java.util.Map createData()
Create new instances of all data classes that have been registered and put them in a new Map, which is returned.


ensureData

public boolean ensureData(java.util.Map map)
Iterates over the keys in data registry and if the map is missing any keys, then a new instance of the class registered with the data registry is created and added to the map.

This method solves the problem of having a half populated Map. You usually get into this situation when reading the Map from Disk or other storage. This method will ensure that if any key is missing, it will be updated with the default values generated from the default constructor for the data class.

The data registry is populated by registerData(String, Class)

Parameters:
map - The Map which will be sure to contain all keys in the data registry on exit.
Returns:
true if any entries were added to map.

getNavigables

public Navigable[] getNavigables()
Returns an array whose contents are based on the Navigable objects that have been registered. The returned array contains copies of the registered Navigables, so that changes to the ones in the array will not be reflected in the registry. The order of the returned Navigables is based on the order of registration through registerUI(Navigable).


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.