001: /*
002: * GWT-Ext Widget Library
003: * Copyright(c) 2007-2008, GWT-Ext.
004: * licensing@gwt-ext.com
005: *
006: * http://www.gwt-ext.com/license
007: */
008: package com.gwtext.client.widgets;
009:
010: /**
011: * The default global window group that is available automatically. To have more than one group of windows with separate z-order stacks, create additional instances of WindowGroup as needed.
012: */
013: public class WindowMgr {
014:
015: /**
016: * Brings the specified window to the front of any other active windows.
017: *
018: * @param windowID the window ID
019: */
020: public static native void bringToFront(String windowID) /*-{
021: $wnd.Ext.WindowMgr.bringToFront(windowID);
022: }-*/;
023:
024: /**
025: * Brings the specified window to the front of any other active windows.
026: *
027: * @param window the window
028: */
029: public static native void bringToFront(Window window) /*-{
030: var w = window.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
031: $wnd.Ext.WindowMgr.bringToFront(w);
032: }-*/;
033:
034: /**
035: * Executes the specified function once for every window in the group, passing each window as the only parameter. Returning false from the function will stop the iteration.
036: *
037: * @param cb the traversal callback function
038: */
039: public static native void each(ComponentTraversalCallback cb)/*-{
040: $wnd.Ext.WindowMgr.each(function(comp) {
041: var compJ = @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(comp);
042: return cb.@com.gwtext.client.widgets.ComponentTraversalCallback::execute(Lcom/gwtext/client/widgets/Component;)(compJ);
043: });
044: }-*/;
045:
046: /**
047: * Gets a registered window by id.
048: *
049: * @param id the window ID
050: * @return the window or null if not found
051: */
052: public static native Window get(String id) /*-{
053: var w = $wnd.Ext.WindowMgr.get(id);
054: return w == null || w=== undefined ? null : @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(w);
055: }-*/;
056:
057: /**
058: * Gets the currently-active window in the group.
059: *
060: * @return the window or null if not found
061: */
062: public static native Window getActive() /*-{
063: var w = $wnd.Ext.WindowMgr.getActive();
064: return w == null || w=== undefined ? null : @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(w);
065: }-*/;
066:
067: /**
068: * Returns zero or more windows in the group using the custom search function passed to this method. The function
069: * should accept a single Ext.Window reference as its only argument and should return true if the window matches
070: * the search criteria, otherwise it should return false.
071: *
072: * @param cb the callback
073: * @return an array of windows
074: */
075: public native Window[] findBy(ComponentTraversalCallback cb)/*-{
076: var comps = $wnd.Ext.WindowMgr.findBy(function(comp) {
077: var compJ = @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(comp);
078: return cb.@com.gwtext.client.widgets.ComponentTraversalCallback::execute(Lcom/gwtext/client/widgets/Component;)(compJ);
079: });
080: return @com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaComponentArray(Lcom/google/gwt/core/client/JavaScriptObject;)(comps);
081: }-*/;
082:
083: /**
084: * Hides all windows in the group.
085: */
086: public static native void hideAll() /*-{
087: $wnd.Ext.WindowMgr.hideAll();
088: }-*/;
089:
090: /**
091: * Sends the specified window to the back of other active windows.
092: *
093: * @param windowID the window ID
094: */
095: public static native void sendToBack(String windowID) /*-{
096: $wnd.Ext.WindowMgr.sendToBack(windowID);
097: }-*/;
098:
099: /**
100: * Sends the specified window to the back of other active windows.
101: *
102: * @param window the window
103: */
104: public static native void sendToBack(Window window) /*-{
105: var w = window.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
106: $wnd.Ext.WindowMgr.sendToBack(w);
107: }-*/;
108:
109: /**
110: * The starting z-index for windows (defaults to 9000).
111: *
112: * @param zseed the zseed
113: */
114: public static native void setZseed(int zseed) /*-{
115: $wnd.Ext.WindowMgr.zseed = zseed;
116: }-*/;
117: }
|