001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * LGPL Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.channel.ho.server.generic;
032:
033: import java.util.*;
034:
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.*;
037: import de.ug2t.unifiedGui.interfaces.*;
038: import de.ug2t.xmlScript.*;
039:
040: public final class HoSrvGenericTextArea extends AHoSrvGenericComponent
041: implements IUnTextArea, IUnSyncComponent {
042: private int pem_cols = 0;
043: private int pem_rows = 0;
044: private String pem_validSigns = null;
045: private int pem_xScroll = 0;
046: private int pem_yScroll = 0;
047:
048: public HoSrvGenericTextArea(String xName, int xCols, int xRows,
049: String xValue, IUnApplication xAppl, String xClass)
050: throws Exception {
051: super (xName);
052: this .pcmf_setAppl(xAppl);
053:
054: this .pcmf_setLocalValue(xValue);
055: this .pem_cols = xCols;
056: this .pem_rows = xRows;
057:
058: if (xClass == null)
059: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingTextArea";
060: else
061: pdm_clientClass = xClass;
062:
063: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
064: "");
065:
066: if (this .pdm_session.pcmf_isInTransaction()) {
067: ScXmlScript.pcmf_createPBody(l_remCall);
068: } else {
069: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
070: ScXmlScript.pcmf_addProc(l_remCall, null);
071: }
072: ;
073: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
074: this .pdm_clientClass, "global");
075: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
076: "java.lang.String");
077: ScXmlScript.pcmf_addDeclPar(l_remCall, Integer.toString(xCols),
078: "false", "int");
079: ScXmlScript.pcmf_addDeclPar(l_remCall, Integer.toString(xRows),
080: "false", "int");
081: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
082: "java.lang.String");
083: ScXmlScript.pcmf_addDeclPar(l_remCall,
084: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
085: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
086:
087: ScXmlScript.pcmf_endAll(l_remCall);
088:
089: this .pdm_session.pcmf_call(l_remCall.toString(), this );
090:
091: return;
092: };
093:
094: public int pcmf_getCols() {
095: return (this .pem_cols);
096: };
097:
098: public int pcmf_getRows() {
099: return (this .pem_rows);
100: };
101:
102: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
103: AHoSrvGenericComponent l_obj = new HoSrvGenericTextArea(this
104: .pcmf_getName(), this .pem_cols, this .pem_rows, this
105: .pcmf_getValue().toString(), this .pcmf_getAppl(),
106: this .pdm_clientClass);
107: l_obj.pcmf_setGlobal(true);
108: this .pcmf_setGlobal(true);
109: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
110: l_obj.pcmf_setRefFrom(this );
111: this .pcmf_addRef(l_obj);
112:
113: return l_obj;
114: };
115:
116: public void pcmf_scrollXRel(int xPx) {
117: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
118: "");
119:
120: if (this .pdm_session.pcmf_isInTransaction()) {
121: ScXmlScript.pcmf_createPBody(l_remCall);
122: } else {
123: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
124: ScXmlScript.pcmf_addProc(l_remCall, null);
125: }
126: ;
127: ScXmlScript.pcmf_addCall(l_remCall, null, this
128: .pcmf_getRemName(), "pcmf_scrollXRel");
129: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPx),
130: "false", "int");
131: ScXmlScript.pcmf_endAll(l_remCall);
132:
133: this .pdm_session.pcmf_call(l_remCall.toString(), this );
134:
135: return;
136: }
137:
138: public void pcmf_scrollXAbs(int xPx) {
139: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
140: "");
141:
142: if (this .pdm_session.pcmf_isInTransaction()) {
143: ScXmlScript.pcmf_createPBody(l_remCall);
144: } else {
145: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
146: ScXmlScript.pcmf_addProc(l_remCall, null);
147: }
148: ;
149: ScXmlScript.pcmf_addCall(l_remCall, null, this
150: .pcmf_getRemName(), "pcmf_scrollXAbs");
151: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPx),
152: "false", "int");
153: ScXmlScript.pcmf_endAll(l_remCall);
154:
155: this .pdm_session.pcmf_call(l_remCall.toString(), this );
156:
157: return;
158: }
159:
160: public void pcmf_scrollYRel(int xPy) {
161: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
162: "");
163:
164: if (this .pdm_session.pcmf_isInTransaction()) {
165: ScXmlScript.pcmf_createPBody(l_remCall);
166: } else {
167: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
168: ScXmlScript.pcmf_addProc(l_remCall, null);
169: }
170: ;
171: ScXmlScript.pcmf_addCall(l_remCall, null, this
172: .pcmf_getRemName(), "pcmf_scrollYRel");
173: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPy),
174: "false", "int");
175: ScXmlScript.pcmf_endAll(l_remCall);
176:
177: this .pdm_session.pcmf_call(l_remCall.toString(), this );
178:
179: return;
180: }
181:
182: public void pcmf_scrollYAbs(int xPy) {
183: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
184: "");
185:
186: if (this .pdm_session.pcmf_isInTransaction()) {
187: ScXmlScript.pcmf_createPBody(l_remCall);
188: } else {
189: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
190: ScXmlScript.pcmf_addProc(l_remCall, null);
191: }
192: ;
193: ScXmlScript.pcmf_addCall(l_remCall, null, this
194: .pcmf_getRemName(), "pcmf_scrollYAbs");
195: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPy),
196: "false", "int");
197: ScXmlScript.pcmf_endAll(l_remCall);
198:
199: this .pdm_session.pcmf_call(l_remCall.toString(), this );
200:
201: return;
202: }
203:
204: public int pcmf_getXScroll() {
205: return (this .pem_xScroll);
206: }
207:
208: public int pcmf_getYScroll() {
209: return (this .pem_yScroll);
210: }
211:
212: private boolean pem_readOnly = false;
213:
214: public void pcmf_setReadOnly(boolean xReadOnly) {
215: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
216: "");
217:
218: if (this .pdm_session.pcmf_isInTransaction()) {
219: ScXmlScript.pcmf_createPBody(l_remCall);
220: } else {
221: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
222: ScXmlScript.pcmf_addProc(l_remCall, null);
223: }
224: ;
225: ScXmlScript.pcmf_addCall(l_remCall, null, this
226: .pcmf_getRemName(), "pcmf_setReadOnly");
227: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
228: .toString(xReadOnly), "false", "boolean");
229: ScXmlScript.pcmf_endAll(l_remCall);
230:
231: this .pdm_session.pcmf_call(l_remCall.toString(), this );
232: this .pem_readOnly = xReadOnly;
233: }
234:
235: public boolean pcmf_isReadOnly() {
236: return (this .pem_readOnly);
237: }
238:
239: private int pem_syncCnt = 0;
240:
241: public Object pcmf_getValueToSync() {
242: return (this .pcmf_getValue());
243: }
244:
245: public void pcmf_setSynced() {
246: this .pem_syncCnt++;
247: }
248:
249: public void pcmf_unSync() {
250: this .pem_syncCnt--;
251: if (this .pem_syncCnt < 0)
252: this .pem_syncCnt = 0;
253: }
254:
255: public boolean pcmf_isSynced() {
256: if (this .pem_syncCnt == 0)
257: return (false);
258: else
259: return (true);
260: }
261:
262: public void pcmf_setInputFilter(String xSigns) {
263: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
264: "");
265:
266: if (this .pdm_session.pcmf_isInTransaction()) {
267: ScXmlScript.pcmf_createPBody(l_remCall);
268: } else {
269: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
270: ScXmlScript.pcmf_addProc(l_remCall, null);
271: }
272: ;
273: ScXmlScript.pcmf_addCall(l_remCall, null, this
274: .pcmf_getRemName(), "pcmf_setInputFilter");
275: ScXmlScript.pcmf_addCallPar(l_remCall, xSigns, "false",
276: "java.lang.String");
277: ScXmlScript.pcmf_endAll(l_remCall);
278:
279: this .pdm_session.pcmf_call(l_remCall.toString(), this );
280:
281: this .pem_validSigns = xSigns;
282: }
283:
284: public void pcmf_removeInputFilter() {
285: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
286: "");
287:
288: if (this .pdm_session.pcmf_isInTransaction()) {
289: ScXmlScript.pcmf_createPBody(l_remCall);
290: } else {
291: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
292: ScXmlScript.pcmf_addProc(l_remCall, null);
293: }
294: ;
295: ScXmlScript.pcmf_addCall(l_remCall, null, this
296: .pcmf_getRemName(), "pcmf_removeInputFilter");
297: ScXmlScript.pcmf_endAll(l_remCall);
298:
299: this .pdm_session.pcmf_call(l_remCall.toString(), this );
300:
301: this .pem_validSigns = null;
302: }
303:
304: public String pcmf_getInputFilter() {
305: return (this .pem_validSigns);
306: }
307:
308: public void pcmf_setSelected() {
309: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
310: "");
311:
312: if (this .pdm_session.pcmf_isInTransaction()) {
313: ScXmlScript.pcmf_createPBody(l_remCall);
314: } else {
315: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
316: ScXmlScript.pcmf_addProc(l_remCall, null);
317: }
318: ;
319: ScXmlScript.pcmf_addCall(l_remCall, null, this
320: .pcmf_getRemName(), "pcmf_setSelected");
321: ScXmlScript.pcmf_endAll(l_remCall);
322:
323: this .pdm_session.pcmf_call(l_remCall.toString(), this );
324: }
325:
326: public void pcmf_setCaretPosition(int xPos) {
327: this .pcmf_setSelectionInterval(new SelectionInterval(xPos, 0));
328: }
329:
330: public void pcmf_setSelectionInterval(SelectionInterval xIntervall) {
331: if (xIntervall == null) {
332: this .pcmf_unSelect();
333: return;
334: }
335: ;
336: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
337: "");
338:
339: if (this .pdm_session.pcmf_isInTransaction()) {
340: ScXmlScript.pcmf_createPBody(l_remCall);
341: } else {
342: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
343: ScXmlScript.pcmf_addProc(l_remCall, null);
344: }
345: ;
346: ScXmlScript.pcmf_addCall(l_remCall, null, this
347: .pcmf_getRemName(), "pcmf_setSelectionIntervall");
348: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
349: .toString(xIntervall.pcm_begin), "false", "int");
350: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
351: .toString(xIntervall.pcm_len), "false", "int");
352: ScXmlScript.pcmf_endAll(l_remCall);
353:
354: this .pdm_session.pcmf_call(l_remCall.toString(), this );
355: }
356:
357: public void pcmf_unSelect() {
358: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
359: "");
360:
361: if (this .pdm_session.pcmf_isInTransaction()) {
362: ScXmlScript.pcmf_createPBody(l_remCall);
363: } else {
364: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
365: ScXmlScript.pcmf_addProc(l_remCall, null);
366: }
367: ;
368: ScXmlScript.pcmf_addCall(l_remCall, null, this
369: .pcmf_getRemName(), "pcmf_unSelect");
370: ScXmlScript.pcmf_endAll(l_remCall);
371:
372: this .pdm_session.pcmf_call(l_remCall.toString(), this );
373: }
374:
375: public void pcmf_setScrollInfo(int xX, int xY) {
376: if (xX != this .pem_xScroll || xY != this .pem_yScroll) {
377: this .pem_xScroll = xX;
378: this .pem_yScroll = xY;
379:
380: Iterator l_it = this .pcmf_getSubIterator();
381: while (l_it.hasNext()) {
382: Object l_obj = l_it.next();
383: if (l_obj instanceof IUnEventChannel) {
384: if (((IUnEventChannel) l_obj).pcmf_getType() == IUnEventChannel.EVENT_SCROLL) {
385: IUnEventChannel l_ch = (IUnEventChannel) l_obj;
386: l_ch
387: .pcmf_getUnComponent()
388: .pcmf_setValue(
389: IUnEventChannel.EVENTs[IUnEventChannel.EVENT_SCROLL]
390: + ":" + xX + "," + xY);
391: l_ch.pcmf_getUnComponent().pcmf_setRefresh();
392:
393: if (l_ch.pcmf_isRefreshParent())
394: ((UnComponent) l_ch.pcmf_getUnComponent()
395: .pcmf_getParentNode())
396: .pcmf_setRefresh();
397:
398: try {
399: if (l_ch.pcmf_getUnComponent()
400: .pcmf_isSubmit())
401: l_ch.pcmf_getUnComponent()
402: .pcmf_dispatchEvent();
403: } catch (Exception e) {
404: KeLog.pcmf_logException("ug2t", this , e);
405: KeLog.pcmf_log("ug2t",
406: "error dispatch scroll event",
407: this, KeLog.ERROR);
408: }
409: }
410: break;
411: }
412: }
413: }
414: }
415: };
|