001: /*
002: * Copyright 2005 Joe Walker
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package jsx3.gui;
017:
018: import org.directwebremoting.ScriptBuffer;
019: import org.directwebremoting.proxy.ScriptProxy;
020: import org.directwebremoting.proxy.io.Context;
021:
022: /**
023: * jsx3.gui.WindowBar instances are used as the captionbar for JSXDialog and JSXAlert instances. They can contain any object type supported by the JSXBlock class. Developers will not instantiate this class (although it is possible); instead, when a new dialog is instanced, it will bind an instance of this class as a child for use as a captionbar container.
024: * @author Joe Walker [joe at getahead dot org]
025: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
026: */
027: public class WindowBar extends jsx3.gui.Block {
028: /**
029: * All reverse ajax proxies need context to work from
030: * @param scriptProxy The place we are writing scripts to
031: * @param context The script that got us to where we are now
032: */
033: public WindowBar(Context context, String extension,
034: ScriptProxy scriptProxy) {
035: super (context, extension, scriptProxy);
036: }
037:
038: /**
039: * instance initializer
040: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
041: * @param TYPE one of: jsx3.gui.WindowBar.TYPECAPTION, jsx3.gui.WindowBar.TYPETOOL, jsx3.gui.WindowBar.TYPEMENU, jsx3.gui.WindowBar.TYPETASK
042: */
043: public WindowBar(String strName, int TYPE) {
044: super ((Context) null, (String) null, (ScriptProxy) null);
045: ScriptBuffer script = new ScriptBuffer();
046: script.appendCall("new WindowBar", strName, TYPE);
047: setInitScript(script);
048: }
049:
050: /**
051: * 26 (default)
052: */
053: public static final int DEFAULTHEIGHT = 26;
054:
055: /**
056: * The default background pattern
057: */
058: public static final String DEFAULTBACKGROUND = null;
059:
060: /**
061: * #c8c8d5 (default)
062: */
063: public static final String DEFAULTBG = "#c8c8d5";
064:
065: /**
066: * #ffffff (default)
067: */
068: public static final String DEFAULTBGCAPTION = "#aaaacb";
069:
070: /**
071: * jsx3.gui.Block.FONTBOLD (default)
072: */
073: public static final String DEFAULTFONTWEIGHT = Block.FONTBOLD;
074:
075: /**
076: * 11 (default)
077: */
078: public static final int DEFAULTFONTSIZE = 11;
079:
080: /**
081: * 0 (default)
082: */
083: public static final int TYPECAPTION = 0;
084:
085: /**
086: * 1
087: */
088: public static final int TYPETOOL = 1;
089:
090: /**
091: * 2
092: */
093: public static final int TYPEMENU = 2;
094:
095: /**
096: * 3
097: */
098: public static final int TYPETASK = 3;
099:
100: /**
101: * Returns the type of the window bar; one of: jsx3.gui.WindowBar.TYPECAPTION, jsx3.gui.WindowBar.TYPETOOL, jsx3.gui.WindowBar.TYPEMENU, jsx3.gui.WindowBar.TYPETASK
102: * @param callback one of: jsx3.gui.WindowBar.TYPECAPTION, jsx3.gui.WindowBar.TYPETOOL, jsx3.gui.WindowBar.TYPEMENU, jsx3.gui.WindowBar.TYPETASK
103: */
104: @SuppressWarnings("unchecked")
105: public void getType(
106: org.directwebremoting.proxy.Callback<Integer> callback) {
107: ScriptBuffer script = new ScriptBuffer();
108: String callbackPrefix = "";
109:
110: if (callback != null) {
111: callbackPrefix = "var reply = ";
112: }
113:
114: script
115: .appendCall(callbackPrefix + getContextPath()
116: + "getType");
117:
118: if (callback != null) {
119: String key = org.directwebremoting.extend.CallbackHelper
120: .saveCallback(callback, Integer.class);
121: script
122: .appendCall("__System.activateCallback", key,
123: "reply");
124: }
125:
126: getScriptProxy().addScript(script);
127: }
128:
129: /**
130: * Returns the type of the window bar;
131: returns reference to self to facilitate method chaining;
132: * @param TYPE one of: jsx3.gui.WindowBar.TYPECAPTION, jsx3.gui.WindowBar.TYPETOOL, jsx3.gui.WindowBar.TYPEMENU, jsx3.gui.WindowBar.TYPETASK
133: * @return this object
134: */
135: public jsx3.gui.WindowBar setType(int TYPE) {
136: ScriptBuffer script = new ScriptBuffer();
137: script.appendCall(getContextPath() + "setType", TYPE);
138: getScriptProxy().addScript(script);
139: return this;
140: }
141:
142: }
|