01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08:
09: package com.gwtext.client.widgets;
10:
11: import com.gwtext.client.core.Function;
12:
13: /**
14: * Component manager.
15: */
16: public class ComponentMgr {
17:
18: /**
19: * Registers a function that will be called when a specified component is added to ComponentMgr.
20: *
21: * @param id the component ID
22: * @param fn the function to execute
23: */
24: public native void onAvailable(String id, Function fn)/*-{
25: $wnd.Ext.ComponentMgr.onAvailable(id, function() {
26: fn.@com.gwtext.client.core.Function::execute()();
27: });
28: }-*/;
29:
30: /**
31: * Returns a component by id.
32: *
33: * @param id the component ID
34: * @return the component or null if not found
35: */
36: public static native Component getComponent(String id) /*-{
37: var comp = $wnd.Ext.ComponentMgr.get(id);
38: return comp == null || comp === undefined ? null : @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(comp);
39: }-*/;
40:
41: }
|