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.vector;
017:
018: import org.directwebremoting.ScriptBuffer;
019: import org.directwebremoting.proxy.ScriptProxy;
020: import org.directwebremoting.proxy.io.Context;
021:
022: /**
023: * The base class for jsx3.vector.Group and jsx3.vector.Shape. Defines getters and setters for the shared vector
024: tag attributes and CSS style extensions.
025: * @author Joe Walker [joe at getahead dot org]
026: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
027: */
028: public class Tag extends jsx3.html.BlockTag {
029: /**
030: * All reverse ajax proxies need context to work from
031: * @param scriptProxy The place we are writing scripts to
032: * @param context The script that got us to where we are now
033: */
034: public Tag(Context context, String extension,
035: ScriptProxy scriptProxy) {
036: super (context, extension, scriptProxy);
037: }
038:
039: /**
040: * The instance initializer.
041: * @param strTagName
042: * @param left left position (in pixels) of the object relative to its parent container
043: * @param top top position (in pixels) of the object relative to its parent container
044: * @param width width (in pixels) of the object
045: * @param height height (in pixels) of the object
046: */
047: public Tag(String strTagName, int left, int top, int width,
048: int height) {
049: super ((Context) null, (String) null, (ScriptProxy) null);
050: ScriptBuffer script = new ScriptBuffer();
051: script.appendCall("new Tag", strTagName, left, top, width,
052: height);
053: setInitScript(script);
054: }
055:
056: /**
057: * Returns the tooltip, the text that is displayed on mouse over.
058: */
059: public void getToolTip() {
060: ScriptBuffer script = new ScriptBuffer();
061: script.appendCall(getContextPath() + "getToolTip");
062: getScriptProxy().addScript(script);
063: }
064:
065: /**
066: * Sets the tooltip, the text that is displayed on mouse over.
067: * @param title
068: */
069: public void setToolTip(String title) {
070: ScriptBuffer script = new ScriptBuffer();
071: script.appendCall(getContextPath() + "setToolTip", title);
072: getScriptProxy().addScript(script);
073: }
074:
075: /**
076: * Returns the rotation field.
077: * @param callback rotation
078: */
079: @SuppressWarnings("unchecked")
080: public void getRotation(
081: org.directwebremoting.proxy.Callback<Integer> callback) {
082: ScriptBuffer script = new ScriptBuffer();
083: String callbackPrefix = "";
084:
085: if (callback != null) {
086: callbackPrefix = "var reply = ";
087: }
088:
089: script.appendCall(callbackPrefix + getContextPath()
090: + "getRotation");
091:
092: if (callback != null) {
093: String key = org.directwebremoting.extend.CallbackHelper
094: .saveCallback(callback, Integer.class);
095: script
096: .appendCall("__System.activateCallback", key,
097: "reply");
098: }
099:
100: getScriptProxy().addScript(script);
101: }
102:
103: /**
104: * Sets the rotation field, an angle between 0 and 360.
105: * @param rotation the new value for rotation
106: */
107: public void setRotation(int rotation) {
108: ScriptBuffer script = new ScriptBuffer();
109: script.appendCall(getContextPath() + "setRotation", rotation);
110: getScriptProxy().addScript(script);
111: }
112:
113: }
|