/* * Copyright 2005 Joe Walker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jsx3.html; import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions; import org.directwebremoting.io.Context; /** * Represents an HTML element that occupies a rectangle of the screen. This class is available only when the Charting add-in is enabled. * @author Joe Walker [joe at getahead dot org] * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator */ public class BlockTag extends jsx3.html.Tag { /** * All reverse ajax proxies need context to work from * @param context The script that got us to where we are now */ public BlockTag(Context context, String extension) { super(context, extension); } /** * The instance initializer. * @param strTagNS * @param strTagName * @param left left position (in pixels) of the object relative to its parent container * @param top top position (in pixels) of the object relative to its parent container * @param width width (in pixels) of the object * @param height height (in pixels) of the object */ public BlockTag(String strTagNS, String strTagName, int left, int top, int width, int height) { super((Context) null, (String) null); ScriptBuffer script = new ScriptBuffer(); script.appendCall("new BlockTag", strTagNS, strTagName, left, top, width, height); setInitScript(script); } /** * Returns the left field. * @param callback left */ public void getLeft(org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getLeft"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the left field. * @param left the new value for left */ public void setLeft(int left) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setLeft", left); ScriptSessions.addScript(script); } /** * Returns the top field. * @param callback top */ public void getTop(org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getTop"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the top field. * @param top the new value for top */ public void setTop(int top) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setTop", top); ScriptSessions.addScript(script); } /** * Returns the width field. * @param callback width */ public void getWidth(org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getWidth"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the width field. * @param width the new value for width */ public void setWidth(int width) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setWidth", width); ScriptSessions.addScript(script); } /** * Returns the height field. * @param callback height */ public void getHeight(org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getHeight"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the height field. * @param height the new value for height */ public void setHeight(int height) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setHeight", height); ScriptSessions.addScript(script); } /** * Returns the margin field, as set by setMargin(). * @param callback margin */ public void getMargin(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getMargin"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the margin field, can be a single value or four values separated by space that correspond to top, right, bottom, and left. * @param margin the new value for margin */ public void setMargin(String margin) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setMargin", margin); ScriptSessions.addScript(script); } /** * Returns the padding field, as set by setPadding(). * @param callback padding */ public void getPadding(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getPadding"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the padding field, can be a single value or four values separated by space that correspond to top, right, bottom, and left. * @param padding the new value for padding */ public void setPadding(String padding) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setPadding", padding); ScriptSessions.addScript(script); } /** * Returns the position field. * @param callback position */ public void getPosition(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getPosition"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the position field, can be 'absolute' or 'relative'. * @param position the new value for position */ public void setPosition(String position) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setPosition", position); ScriptSessions.addScript(script); } /** * Returns the zIndex field. * @param callback zIndex */ public void getZIndex(org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getZIndex"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the zIndex field. * @param zIndex the new value for zIndex */ public void setZIndex(int zIndex) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setZIndex", zIndex); ScriptSessions.addScript(script); } /** * Returns the bgcolor field. * @param callback bgcolor */ public void getBackgroundColor(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getBackgroundColor"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the bgcolor field. * @param bgcolor the new value for bgcolor */ public void setBackgroundColor(String bgcolor) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setBackgroundColor", bgcolor); ScriptSessions.addScript(script); } /** * parses the margin field into an array of four int values * @param callback [top,right,bottom,left] */ public void getMarginDimensions(org.directwebremoting.ui.Callback<Object[]> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getMarginDimensions"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Object[].class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * parses the padding field into an array of four int values * @param callback [top,right,bottom,left] */ public void getPaddingDimensions(org.directwebremoting.ui.Callback<Object[]> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getPaddingDimensions"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Object[].class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Returns the dimensions in an array of four int values * @param callback [left,top,width,height] */ public void getDimensions(org.directwebremoting.ui.Callback<Object[]> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getDimensions"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Object[].class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets all four dimensions at once. * @param left the new left value or an array containing all four new values * @param top the new top value * @param width the new width value * @param height the new height value */ public void setDimensions(int left, int top, int width, int height) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setDimensions", left, top, width, height); ScriptSessions.addScript(script); } /** * Sets all four dimensions at once. * @param left the new left value or an array containing all four new values * @param top the new top value * @param width the new width value * @param height the new height value */ public void setDimensions(Object[] left, int top, int width, int height) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setDimensions", left, top, width, height); ScriptSessions.addScript(script); } }