01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package jsx3.vector;
17:
18: import org.directwebremoting.ScriptBuffer;
19: import org.directwebremoting.proxy.ScriptProxy;
20: import org.directwebremoting.proxy.io.Context;
21:
22: /**
23: * Paints a vector rectangle.
24: * @author Joe Walker [joe at getahead dot org]
25: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
26: */
27: public class Rectangle extends jsx3.vector.Shape {
28: /**
29: * All reverse ajax proxies need context to work from
30: * @param scriptProxy The place we are writing scripts to
31: * @param context The script that got us to where we are now
32: */
33: public Rectangle(Context context, String extension,
34: ScriptProxy scriptProxy) {
35: super (context, extension, scriptProxy);
36: }
37:
38: /**
39: * The instance initializer.
40: * @param left left position (in pixels) of the object relative to its parent container
41: * @param top top position (in pixels) of the object relative to its parent container
42: * @param width width (in pixels) of the object
43: * @param height height (in pixels) of the object
44: */
45: public Rectangle(int left, int top, int width, int height) {
46: super ((Context) null, (String) null, (ScriptProxy) null);
47: ScriptBuffer script = new ScriptBuffer();
48: script.appendCall("new Rectangle", left, top, width, height);
49: setInitScript(script);
50: }
51:
52: /**
53: * Clips this rectangle to the bounds of obj.
54: * @param obj any object that has <code>getLeft()</code>, etc methods.
55: */
56: public void clipToBox(jsx3.gui.Block obj) {
57: ScriptBuffer script = new ScriptBuffer();
58: script.appendCall(getContextPath() + "clipToBox", obj);
59: getScriptProxy().addScript(script);
60: }
61:
62: /**
63: * Clips this rectangle to the bounds of obj.
64: * @param obj any object that has <code>getLeft()</code>, etc methods.
65: */
66: public void clipToBox(jsx3.html.BlockTag obj) {
67: ScriptBuffer script = new ScriptBuffer();
68: script.appendCall(getContextPath() + "clipToBox", obj);
69: getScriptProxy().addScript(script);
70: }
71:
72: /**
73: * Clips this rectangle to the bounds of {l1, t1, w1, h1}.
74: * @param l1
75: * @param t1
76: * @param w1
77: * @param h1
78: */
79: public void clipTo(int l1, int t1, int w1, int h1) {
80: ScriptBuffer script = new ScriptBuffer();
81: script.appendCall(getContextPath() + "clipTo", l1, t1, w1, h1);
82: getScriptProxy().addScript(script);
83: }
84:
85: }
|