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: * Renders text along an arbitrary line.
024: * @author Joe Walker [joe at getahead dot org]
025: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
026: */
027: public class TextLine extends jsx3.vector.Shape {
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 TextLine(Context context, String extension,
034: ScriptProxy scriptProxy) {
035: super (context, extension, scriptProxy);
036: }
037:
038: /**
039: * The instance initializer.
040: * @param x1
041: * @param y1
042: * @param x2
043: * @param y2
044: * @param text the text to display on the text path
045: */
046: public TextLine(int x1, int y1, int x2, int y2, String text) {
047: super ((Context) null, (String) null, (ScriptProxy) null);
048: ScriptBuffer script = new ScriptBuffer();
049: script.appendCall("new TextLine", x1, y1, x2, y2, text);
050: setInitScript(script);
051: }
052:
053: /**
054: * Returns the text field.
055: * @param callback text
056: */
057: @SuppressWarnings("unchecked")
058: public void getText(
059: org.directwebremoting.proxy.Callback<String> callback) {
060: ScriptBuffer script = new ScriptBuffer();
061: String callbackPrefix = "";
062:
063: if (callback != null) {
064: callbackPrefix = "var reply = ";
065: }
066:
067: script
068: .appendCall(callbackPrefix + getContextPath()
069: + "getText");
070:
071: if (callback != null) {
072: String key = org.directwebremoting.extend.CallbackHelper
073: .saveCallback(callback, String.class);
074: script
075: .appendCall("__System.activateCallback", key,
076: "reply");
077: }
078:
079: getScriptProxy().addScript(script);
080: }
081:
082: /**
083: * Sets the text field, the text to display on the text path.
084: * @param text the new value for text
085: */
086: public void setText(String text) {
087: ScriptBuffer script = new ScriptBuffer();
088: script.appendCall(getContextPath() + "setText", text);
089: getScriptProxy().addScript(script);
090: }
091:
092: /**
093: * Returns the color field.
094: * @param callback color
095: */
096: @SuppressWarnings("unchecked")
097: public void getColor(
098: org.directwebremoting.proxy.Callback<String> callback) {
099: ScriptBuffer script = new ScriptBuffer();
100: String callbackPrefix = "";
101:
102: if (callback != null) {
103: callbackPrefix = "var reply = ";
104: }
105:
106: script.appendCall(callbackPrefix + getContextPath()
107: + "getColor");
108:
109: if (callback != null) {
110: String key = org.directwebremoting.extend.CallbackHelper
111: .saveCallback(callback, String.class);
112: script
113: .appendCall("__System.activateCallback", key,
114: "reply");
115: }
116:
117: getScriptProxy().addScript(script);
118: }
119:
120: /**
121: * Returns the fontFamily field.
122: * @param callback fontFamily
123: */
124: @SuppressWarnings("unchecked")
125: public void getFontFamily(
126: org.directwebremoting.proxy.Callback<String> callback) {
127: ScriptBuffer script = new ScriptBuffer();
128: String callbackPrefix = "";
129:
130: if (callback != null) {
131: callbackPrefix = "var reply = ";
132: }
133:
134: script.appendCall(callbackPrefix + getContextPath()
135: + "getFontFamily");
136:
137: if (callback != null) {
138: String key = org.directwebremoting.extend.CallbackHelper
139: .saveCallback(callback, String.class);
140: script
141: .appendCall("__System.activateCallback", key,
142: "reply");
143: }
144:
145: getScriptProxy().addScript(script);
146: }
147:
148: /**
149: * Returns the fontsize field.
150: * @param callback fontsize
151: */
152: @SuppressWarnings("unchecked")
153: public void getFontSize(
154: org.directwebremoting.proxy.Callback<String> callback) {
155: ScriptBuffer script = new ScriptBuffer();
156: String callbackPrefix = "";
157:
158: if (callback != null) {
159: callbackPrefix = "var reply = ";
160: }
161:
162: script.appendCall(callbackPrefix + getContextPath()
163: + "getFontSize");
164:
165: if (callback != null) {
166: String key = org.directwebremoting.extend.CallbackHelper
167: .saveCallback(callback, String.class);
168: script
169: .appendCall("__System.activateCallback", key,
170: "reply");
171: }
172:
173: getScriptProxy().addScript(script);
174: }
175:
176: /**
177: * Returns the fontStyle field.
178: * @param callback fontStyle
179: */
180: @SuppressWarnings("unchecked")
181: public void getFontStyle(
182: org.directwebremoting.proxy.Callback<String> callback) {
183: ScriptBuffer script = new ScriptBuffer();
184: String callbackPrefix = "";
185:
186: if (callback != null) {
187: callbackPrefix = "var reply = ";
188: }
189:
190: script.appendCall(callbackPrefix + getContextPath()
191: + "getFontStyle");
192:
193: if (callback != null) {
194: String key = org.directwebremoting.extend.CallbackHelper
195: .saveCallback(callback, String.class);
196: script
197: .appendCall("__System.activateCallback", key,
198: "reply");
199: }
200:
201: getScriptProxy().addScript(script);
202: }
203:
204: /**
205: * Returns the fontWeight field.
206: * @param callback fontWeight
207: */
208: @SuppressWarnings("unchecked")
209: public void getFontWeight(
210: org.directwebremoting.proxy.Callback<String> callback) {
211: ScriptBuffer script = new ScriptBuffer();
212: String callbackPrefix = "";
213:
214: if (callback != null) {
215: callbackPrefix = "var reply = ";
216: }
217:
218: script.appendCall(callbackPrefix + getContextPath()
219: + "getFontWeight");
220:
221: if (callback != null) {
222: String key = org.directwebremoting.extend.CallbackHelper
223: .saveCallback(callback, String.class);
224: script
225: .appendCall("__System.activateCallback", key,
226: "reply");
227: }
228:
229: getScriptProxy().addScript(script);
230: }
231:
232: /**
233: * Returns the textAlign field.
234: * @param callback textAlign
235: */
236: @SuppressWarnings("unchecked")
237: public void getTextAlign(
238: org.directwebremoting.proxy.Callback<String> callback) {
239: ScriptBuffer script = new ScriptBuffer();
240: String callbackPrefix = "";
241:
242: if (callback != null) {
243: callbackPrefix = "var reply = ";
244: }
245:
246: script.appendCall(callbackPrefix + getContextPath()
247: + "getTextAlign");
248:
249: if (callback != null) {
250: String key = org.directwebremoting.extend.CallbackHelper
251: .saveCallback(callback, String.class);
252: script
253: .appendCall("__System.activateCallback", key,
254: "reply");
255: }
256:
257: getScriptProxy().addScript(script);
258: }
259:
260: /**
261: * Returns the textDecoration field.
262: * @param callback textDecoration
263: */
264: @SuppressWarnings("unchecked")
265: public void getTextDecoration(
266: org.directwebremoting.proxy.Callback<String> callback) {
267: ScriptBuffer script = new ScriptBuffer();
268: String callbackPrefix = "";
269:
270: if (callback != null) {
271: callbackPrefix = "var reply = ";
272: }
273:
274: script.appendCall(callbackPrefix + getContextPath()
275: + "getTextDecoration");
276:
277: if (callback != null) {
278: String key = org.directwebremoting.extend.CallbackHelper
279: .saveCallback(callback, String.class);
280: script
281: .appendCall("__System.activateCallback", key,
282: "reply");
283: }
284:
285: getScriptProxy().addScript(script);
286: }
287:
288: /**
289: * Sets the color field.
290: * @param color the new value for color
291: */
292: public void setColor(String color) {
293: ScriptBuffer script = new ScriptBuffer();
294: script.appendCall(getContextPath() + "setColor", color);
295: getScriptProxy().addScript(script);
296: }
297:
298: /**
299: * Sets the fontFamily field.
300: * @param fontFamily the new value for fontFamily
301: */
302: public void setFontFamily(String fontFamily) {
303: ScriptBuffer script = new ScriptBuffer();
304: script.appendCall(getContextPath() + "setFontFamily",
305: fontFamily);
306: getScriptProxy().addScript(script);
307: }
308:
309: /**
310: * Sets the fontsize field.
311: * @param fontSize the new value for fontsize
312: */
313: public void setFontSize(String fontSize) {
314: ScriptBuffer script = new ScriptBuffer();
315: script.appendCall(getContextPath() + "setFontSize", fontSize);
316: getScriptProxy().addScript(script);
317: }
318:
319: /**
320: * Sets the fontsize field.
321: * @param fontSize the new value for fontsize
322: */
323: public void setFontSize(int fontSize) {
324: ScriptBuffer script = new ScriptBuffer();
325: script.appendCall(getContextPath() + "setFontSize", fontSize);
326: getScriptProxy().addScript(script);
327: }
328:
329: /**
330: * Sets the fontStyle field.
331: * @param fontStyle the new value for fontStyle
332: */
333: public void setFontStyle(String fontStyle) {
334: ScriptBuffer script = new ScriptBuffer();
335: script.appendCall(getContextPath() + "setFontStyle", fontStyle);
336: getScriptProxy().addScript(script);
337: }
338:
339: /**
340: * Sets the fontWeight field.
341: * @param fontWeight the new value for fontWeight
342: */
343: public void setFontWeight(String fontWeight) {
344: ScriptBuffer script = new ScriptBuffer();
345: script.appendCall(getContextPath() + "setFontWeight",
346: fontWeight);
347: getScriptProxy().addScript(script);
348: }
349:
350: /**
351: * Sets the textAlign field.
352: * @param textAlign the new value for textAlign
353: */
354: public void setTextAlign(String textAlign) {
355: ScriptBuffer script = new ScriptBuffer();
356: script.appendCall(getContextPath() + "setTextAlign", textAlign);
357: getScriptProxy().addScript(script);
358: }
359:
360: /**
361: * Sets the textDecoration field.
362: * @param textDecoration the new value for textDecoration
363: */
364: public void setTextDecoration(String textDecoration) {
365: ScriptBuffer script = new ScriptBuffer();
366: script.appendCall(getContextPath() + "setTextDecoration",
367: textDecoration);
368: getScriptProxy().addScript(script);
369: }
370:
371: }
|