com.extjs.gxt.ui.client.widget
Class ComponentManager

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.ComponentManager
All Implemented Interfaces:
Observable

public class ComponentManager
extends BaseObservable

Provides a registry of all attached components. Only components currently part of the page (DOM) are part of the registry as all components register when attached, and unregister when detached.

 Collection components = ComponentManager.get().getAll();
 Component comp = ComponentManager.get().get("foo");
 for (Component c : components) {
 }
 
Events:
Register : ComponentManagerEvent(source, component)
Fires after the component is registered.
Unregister : ComponentManagerEvent(source, component)
Fires after the component is unregistered.


Method Summary
<X extends Component>
X
find(com.google.gwt.dom.client.Element target)
          Attempts to find a component.
<X extends Component>
X
find(com.google.gwt.dom.client.Element target, java.lang.Class<X> clazz)
          Attempts to find a component.
static ComponentManager get()
          Returns the component manager instance.
<X extends Component>
java.util.List<X>
get(java.lang.Class<?> clazz)
          Returns all component by class.
 Component get(java.lang.String id)
          Returns a component by id.
 java.util.Collection<Component> getAll()
          Returns a collection of all registered components.
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static ComponentManager get()
Returns the component manager instance.

Returns:
the component manager

find

public <X extends Component> X find(com.google.gwt.dom.client.Element target)
Attempts to find a component.

Parameters:
target - the element or inner element of the component
Returns:
the matching component or null if no match

find

public <X extends Component> X find(com.google.gwt.dom.client.Element target,
                                    java.lang.Class<X> clazz)
Attempts to find a component.

Parameters:
target - the element or inner element of the component
clazz - the class the component should have
Returns:
the matching component or null if no match

get

public <X extends Component> java.util.List<X> get(java.lang.Class<?> clazz)
Returns all component by class.

Parameters:
clazz - the class to match
Returns:
the list of matching components

get

public Component get(java.lang.String id)
Returns a component by id.

Parameters:
id - the component id
Returns:
the component or null if no match

getAll

public java.util.Collection<Component> getAll()
Returns a collection of all registered components.

Returns:
the collection of components