org.openide.src.nodes
Class SourceChildren

java.lang.Object
  extended byorg.openide.nodes.Children
      extended byorg.openide.nodes.Children.Array
          extended byorg.openide.nodes.Children.Keys
              extended byorg.openide.src.nodes.SourceChildren
All Implemented Interfaces:
Cloneable, FilterCookie, Node.Cookie

public class SourceChildren
extends Children.Keys
implements FilterCookie

Normal implementation of children for source element nodes.

Ordering and filtering of the children can be customized using SourceElementFilter. FilterCookie is implemented to provide a means for user customization of the filter.

The child list listens to changes in the source element, as well as the filter, and automatically updates itself as appropriate.

A child factory can be used to cause the children list to create non-default child nodes, if desired, both at the time of the creation of the children list, and when new children are added.

The children list may be unattached to any source element temporarily, in which case it will have no children (except possibly an error indicator).


Nested Class Summary
 
Nested classes inherited from class org.openide.nodes.Children
Children.Array, Children.Keys, Children.Map, Children.SortedArray, Children.SortedMap
 
Field Summary
protected  SourceElement element
          The element whose subelements are represented.
protected  ElementNodeFactory factory
          Factory for obtaining class nodes.
protected  SourceElementFilter filter
          Filter for elements.
 
Fields inherited from class org.openide.nodes.Children.Array
nodes
 
Fields inherited from class org.openide.nodes.Children
LEAF, MUTEX
 
Constructor Summary
SourceChildren()
          Create a children list with the default factory and no attached source element.
SourceChildren(ElementNodeFactory factory)
          Create a children list with no attached source element.
SourceChildren(ElementNodeFactory factory, SourceElement element)
          Create a children list.
SourceChildren(SourceElement element)
          Create a children list with the default factory.
 
Method Summary
protected  void addNotify()
           
protected  Node[] createNodes(Object key)
           
 Node findChild(String name)
           
 SourceElement getElement()
          Get the currently attached source element.
 Object getFilter()
           
 Class getFilterClass()
           
 Node[] getNodes(boolean initialize)
          If `initialize' is true, invokes the parser and waits for it to finish.
protected  void removeNotify()
           
 void setElement(SourceElement element)
          Set a new source element to get information about children from.
 void setFilter(Object filter)
           
 
Methods inherited from class org.openide.nodes.Children.Keys
add, clone, destroyNodes, refreshKey, remove, setBefore, setKeys, setKeys
 
Methods inherited from class org.openide.nodes.Children.Array
initCollection, refresh
 
Methods inherited from class org.openide.nodes.Children
getNode, getNodes, getNodesCount, isInitialized, nodes
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected SourceElement element
The element whose subelements are represented.


filter

protected SourceElementFilter filter
Filter for elements. Can be null, in which case modifier filtering is disabled, and ordering may be reset to the default order.


factory

protected ElementNodeFactory factory
Factory for obtaining class nodes.

Constructor Detail

SourceChildren

public SourceChildren()
Create a children list with the default factory and no attached source element.


SourceChildren

public SourceChildren(SourceElement element)
Create a children list with the default factory.

Parameters:
element - source element to attach to, or null

SourceChildren

public SourceChildren(ElementNodeFactory factory)
Create a children list with no attached source element.

Parameters:
factory - a factory for creating children

SourceChildren

public SourceChildren(ElementNodeFactory factory,
                      SourceElement element)
Create a children list.

Parameters:
factory - a factory for creating children
element - source element to attach to, or null
Method Detail

getFilterClass

public Class getFilterClass()
Specified by:
getFilterClass in interface FilterCookie

getFilter

public Object getFilter()
Specified by:
getFilter in interface FilterCookie

setFilter

public void setFilter(Object filter)
Specified by:
setFilter in interface FilterCookie

addNotify

protected void addNotify()

removeNotify

protected void removeNotify()

createNodes

protected Node[] createNodes(Object key)

getNodes

public Node[] getNodes(boolean initialize)
If `initialize' is true, invokes the parser and waits for it to finish. If false, it just returns whatever nodes are available right now.

Returns:
array of nodes after the Children are fully initialized

findChild

public Node findChild(String name)

getElement

public SourceElement getElement()
Get the currently attached source element.

Returns:
the element, or null if unattached

setElement

public void setElement(SourceElement element)
Set a new source element to get information about children from.

Parameters:
element - the new element, or null to detach

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.