|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.common.hierarchy.DefaultHierarchyManager
Default implementation of the HierarchyManager.
| Constructor Summary | |
DefaultHierarchyManager()
Constructor. |
|
DefaultHierarchyManager(ID rootId)
Constructor. |
|
DefaultHierarchyManager(ID[] rootIds)
Constructor. |
|
| Method Summary | |
void |
addChild(ID parentId,
ID childId)
This implementation uses constant time with respect to the number of nodes and linear time with respect to the number of children of the parent node. |
void |
addHierarchyProviderListener(HierarchyProviderListener listener)
Registers a listener that observes changes in the hierarchy. |
void |
addRoot(ID rootId)
This implementation uses linear time with respect to the number of root nodes. |
void |
dispose()
Disposes the component. |
protected void |
fireChildAdded(ID parentId,
ID childId)
Notifies all registered listeners that a child has been added. |
protected void |
fireChildRemoved(ID parentId,
ID childId)
Notifies all registered listeners that a child has been removed. |
protected void |
fireRootAdded(ID rootId)
Notifies all registered listeners that a root has been added. |
protected void |
fireRootRemoved(ID rootId)
Notifies all registered listeners that a root has been removed. |
int |
getChildCount(ID parentId,
boolean deep,
boolean leafesOnly)
Returns the number of childs for the given parent id. |
ID[] |
getChildren(ID parentId)
Returns the children of a node. |
ID |
getParentForChild(ID id)
This implementation uses constant time with respect to the number of nodes. |
ID[] |
getRoots()
Returns the root nodes. |
boolean |
hasID(ID id)
This implementation uses constant time with respect to the number of nodes. |
boolean |
isChild(ID id1,
ID id2,
boolean deep)
Checks if id2 is a child of id1.
|
void |
removeChild(ID parentId,
ID childId)
This implementation uses constant time with respect to the number of nodes and linear time with respect to the number of children of the parent node. |
void |
removeHierarchyProviderListener(HierarchyProviderListener listener)
Unregisters a listener. |
void |
removeRoot(ID rootId)
This implementation uses linear time with respect to the number of root nodes. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DefaultHierarchyManager()
public DefaultHierarchyManager(ID rootId)
public DefaultHierarchyManager(ID[] rootIds)
| Method Detail |
public boolean hasID(ID id)
hasID in interface HierarchyProviderid - the id to be tested
HierarchyProvider.hasID(ID)public void addRoot(ID rootId)
addRoot in interface HierarchyManagerrootId - the id of the new root nodeHierarchyManager.addRoot(ID)public void removeRoot(ID rootId)
removeRoot in interface HierarchyManagerrootId - the id of the root nodeHierarchyManager.removeRoot(ID)public ID[] getRoots()
HierarchyProvider
getRoots in interface HierarchyProviderIDs of the root nodes.HierarchyProvider.getRoots(),
HierarchyProvider.getRoots()
public void addChild(ID parentId,
ID childId)
addChild in interface HierarchyManagerparentId - the id of the parent nodechildId - the id of the new childHierarchyManager.addChild(ID, ID)public ID[] getChildren(ID parentId)
HierarchyProvider
getChildren in interface HierarchyProviderparentId - the id of the parent node
IDs of the childrenHierarchyProvider.getChildren(ID),
HierarchyProvider.getChildren(com.sdm.quasar.client.core.common.ID)public ID getParentForChild(ID id)
getParentForChild in interface HierarchyProviderid - the id of the child node
HierarchyProvider.getParentForChild(ID)
public boolean isChild(ID id1,
ID id2,
boolean deep)
HierarchyProviderid2 is a child of id1.
The check is done down the whole sub hierarchy of id1
if deep = true.
Else only direct childs are considered.
isChild in interface HierarchyProviderid1 - the potential parentid2 - the potential childdeep - true: The check is done down the whole sub hierarchy
false: only direct childs are considered
public int getChildCount(ID parentId,
boolean deep,
boolean leafesOnly)
HierarchyProvider
getChildCount in interface HierarchyProviderparentId - the ID of the parent to count childs ofdeep - if true, the whole subtree will be counted,
if false, only direct childs are countedleafesOnly - if true, the returned number is
restricted to leafes (childs, that have no childs themselfes)
HierarchyProvider.getChildCount(com.sdm.quasar.client.core.common.ID,
boolean, boolean)
public void removeChild(ID parentId,
ID childId)
removeChild in interface HierarchyManagerparentId - the id of the parent nodechildId - the id of the child node to be removedHierarchyManager.removeChild(ID,
ID)public void addHierarchyProviderListener(HierarchyProviderListener listener)
HierarchyProvider
addHierarchyProviderListener in interface HierarchyProviderlistener - the listener to be addedHierarchyProvider.addHierarchyProviderListener(com.sdm.quasar.client.core.common.hierarchy.HierarchyProviderListener)public void removeHierarchyProviderListener(HierarchyProviderListener listener)
HierarchyProvider
removeHierarchyProviderListener in interface HierarchyProviderlistener - the listener to be removedHierarchyProvider.removeHierarchyProviderListener(com.sdm.quasar.client.core.common.hierarchy.HierarchyProviderListener)protected void fireRootAdded(ID rootId)
rootId - id of the rootprotected void fireRootRemoved(ID rootId)
rootId - id of the root
protected void fireChildAdded(ID parentId,
ID childId)
parentId - the parent idchildId - the child id
protected void fireChildRemoved(ID parentId,
ID childId)
parentId - the parent idchildId - the child id
public void dispose()
throws DisposeException
Disposable
Important:
This method is called by an administrating component
and must never be called directly.
The implementation should release any resources or objects allocated and
any services registered. Furthermore, this method should be developed
carefully to free a maximum of resources even when the system may
have become unstable. In case of one or multiple errors, you should collect
them in a DisposeException, continue with the execution,
and throw it at the end of the method.
Note: The implementation must not return before the component is disposed. Any threads or asynchronous calls started must be completed before this method returns.
dispose in interface DisposableDisposeException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||