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 class HoSrvGenericEditor extends AHoSrvGenericComponent
041: implements IUnTextArea, IUnSyncComponent {
042: private String pem_mime = null;
043: private String pem_validSigns = null;
044: private int pem_xScroll = 0;
045: private int pem_yScroll = 0;
046: private boolean pem_scroll = true;
047:
048: public HoSrvGenericEditor(String xName, String xValue,
049: String xMime, IUnApplication xAppl, String xClass)
050: throws Exception {
051: super (xName);
052: this .pcmf_setAppl(xAppl);
053: this .pem_mime = xMime;
054:
055: this .pcmf_setLocalValue(xValue);
056:
057: if (xClass == null)
058: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingEditor";
059: else
060: pdm_clientClass = xClass;
061:
062: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
063: "");
064:
065: if (this .pdm_session.pcmf_isInTransaction()) {
066: ScXmlScript.pcmf_createPBody(l_remCall);
067: } else {
068: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
069: ScXmlScript.pcmf_addProc(l_remCall, null);
070: }
071: ;
072: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
073: this .pdm_clientClass, "global");
074: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
075: "java.lang.String");
076: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
077: "java.lang.String");
078: ScXmlScript.pcmf_addDeclPar(l_remCall, xMime, "false",
079: "java.lang.String");
080: ScXmlScript.pcmf_addDeclPar(l_remCall,
081: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
082: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
083:
084: ScXmlScript.pcmf_endAll(l_remCall);
085:
086: this .pdm_session.pcmf_call(l_remCall.toString(), this );
087:
088: return;
089: };
090:
091: public int pcmf_getCols() {
092: return (0);
093: };
094:
095: public int pcmf_getRows() {
096: return (0);
097: };
098:
099: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
100: AHoSrvGenericComponent l_obj = new HoSrvGenericEditor(this
101: .pcmf_getName(), this .pcmf_getValue().toString(),
102: this .pem_mime, this .pcmf_getAppl(),
103: this .pdm_clientClass);
104: l_obj.pcmf_setGlobal(true);
105: this .pcmf_setGlobal(true);
106: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
107: l_obj.pcmf_setRefFrom(this );
108: this .pcmf_addRef(l_obj);
109:
110: return l_obj;
111: };
112:
113: public void pcmf_scrollXRel(int xPx) {
114: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
115: "");
116:
117: if (this .pdm_session.pcmf_isInTransaction()) {
118: ScXmlScript.pcmf_createPBody(l_remCall);
119: } else {
120: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
121: ScXmlScript.pcmf_addProc(l_remCall, null);
122: }
123: ;
124: ScXmlScript.pcmf_addCall(l_remCall, null, this
125: .pcmf_getRemName(), "pcmf_scrollXRel");
126: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPx),
127: "false", "int");
128: ScXmlScript.pcmf_endAll(l_remCall);
129:
130: this .pdm_session.pcmf_call(l_remCall.toString(), this );
131:
132: return;
133: }
134:
135: public void pcmf_scrollXAbs(int xPx) {
136: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
137: "");
138:
139: if (this .pdm_session.pcmf_isInTransaction()) {
140: ScXmlScript.pcmf_createPBody(l_remCall);
141: } else {
142: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
143: ScXmlScript.pcmf_addProc(l_remCall, null);
144: }
145: ;
146: ScXmlScript.pcmf_addCall(l_remCall, null, this
147: .pcmf_getRemName(), "pcmf_scrollXAbs");
148: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPx),
149: "false", "int");
150: ScXmlScript.pcmf_endAll(l_remCall);
151:
152: this .pdm_session.pcmf_call(l_remCall.toString(), this );
153:
154: return;
155: }
156:
157: public void pcmf_scrollYRel(int xPy) {
158: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
159: "");
160:
161: if (this .pdm_session.pcmf_isInTransaction()) {
162: ScXmlScript.pcmf_createPBody(l_remCall);
163: } else {
164: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
165: ScXmlScript.pcmf_addProc(l_remCall, null);
166: }
167: ;
168: ScXmlScript.pcmf_addCall(l_remCall, null, this
169: .pcmf_getRemName(), "pcmf_scrollYRel");
170: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPy),
171: "false", "int");
172: ScXmlScript.pcmf_endAll(l_remCall);
173:
174: this .pdm_session.pcmf_call(l_remCall.toString(), this );
175:
176: return;
177: }
178:
179: public void pcmf_scrollYAbs(int xPy) {
180: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
181: "");
182:
183: if (this .pdm_session.pcmf_isInTransaction()) {
184: ScXmlScript.pcmf_createPBody(l_remCall);
185: } else {
186: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
187: ScXmlScript.pcmf_addProc(l_remCall, null);
188: }
189: ;
190: ScXmlScript.pcmf_addCall(l_remCall, null, this
191: .pcmf_getRemName(), "pcmf_scrollYAbs");
192: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPy),
193: "false", "int");
194: ScXmlScript.pcmf_endAll(l_remCall);
195:
196: this .pdm_session.pcmf_call(l_remCall.toString(), this );
197:
198: return;
199: }
200:
201: public void pcmf_setScroll(boolean xScroll) {
202: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
203: "");
204:
205: if (this .pdm_session.pcmf_isInTransaction()) {
206: ScXmlScript.pcmf_createPBody(l_remCall);
207: } else {
208: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
209: ScXmlScript.pcmf_addProc(l_remCall, null);
210: }
211: ;
212: ScXmlScript.pcmf_addCall(l_remCall, null, this
213: .pcmf_getRemName(), "pcmf_setScroll");
214: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
215: .toString(xScroll), "false", "boolean");
216: ScXmlScript.pcmf_endAll(l_remCall);
217:
218: this .pdm_session.pcmf_call(l_remCall.toString(), this );
219:
220: this .pem_scroll = xScroll;
221:
222: return;
223: }
224:
225: public boolean pcmf_getScroll() {
226: return (this .pem_scroll);
227: };
228:
229: public int pcmf_getXScroll() {
230: return (this .pem_xScroll);
231: }
232:
233: public int pcmf_getYScroll() {
234: return (this .pem_yScroll);
235: }
236:
237: private boolean pem_readOnly = false;
238:
239: public void pcmf_setReadOnly(boolean xReadOnly) {
240: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
241: "");
242:
243: if (this .pdm_session.pcmf_isInTransaction()) {
244: ScXmlScript.pcmf_createPBody(l_remCall);
245: } else {
246: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
247: ScXmlScript.pcmf_addProc(l_remCall, null);
248: }
249: ;
250: ScXmlScript.pcmf_addCall(l_remCall, null, this
251: .pcmf_getRemName(), "pcmf_setReadOnly");
252: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
253: .toString(xReadOnly), "false", "boolean");
254: ScXmlScript.pcmf_endAll(l_remCall);
255:
256: this .pdm_session.pcmf_call(l_remCall.toString(), this );
257: this .pem_readOnly = xReadOnly;
258: }
259:
260: public boolean pcmf_isReadOnly() {
261: return (this .pem_readOnly);
262: }
263:
264: private int pem_syncCnt = 0;
265:
266: public Object pcmf_getValueToSync() {
267: return (this .pcmf_getValue());
268: }
269:
270: public void pcmf_setSynced() {
271: this .pem_syncCnt++;
272: }
273:
274: public void pcmf_unSync() {
275: this .pem_syncCnt--;
276: if (this .pem_syncCnt < 0)
277: this .pem_syncCnt = 0;
278: }
279:
280: public boolean pcmf_isSynced() {
281: if (this .pem_syncCnt == 0)
282: return (false);
283: else
284: return (true);
285: }
286:
287: public void pcmf_setInputFilter(String xSigns) {
288: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
289: "");
290:
291: if (this .pdm_session.pcmf_isInTransaction()) {
292: ScXmlScript.pcmf_createPBody(l_remCall);
293: } else {
294: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
295: ScXmlScript.pcmf_addProc(l_remCall, null);
296: }
297: ;
298: ScXmlScript.pcmf_addCall(l_remCall, null, this
299: .pcmf_getRemName(), "pcmf_setInputFilter");
300: ScXmlScript.pcmf_addCallPar(l_remCall, xSigns, "false",
301: "java.lang.String");
302: ScXmlScript.pcmf_endAll(l_remCall);
303:
304: this .pdm_session.pcmf_call(l_remCall.toString(), this );
305:
306: this .pem_validSigns = xSigns;
307: }
308:
309: public void pcmf_removeInputFilter() {
310: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
311: "");
312:
313: if (this .pdm_session.pcmf_isInTransaction()) {
314: ScXmlScript.pcmf_createPBody(l_remCall);
315: } else {
316: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
317: ScXmlScript.pcmf_addProc(l_remCall, null);
318: }
319: ;
320: ScXmlScript.pcmf_addCall(l_remCall, null, this
321: .pcmf_getRemName(), "pcmf_removeInputFilter");
322: ScXmlScript.pcmf_endAll(l_remCall);
323:
324: this .pdm_session.pcmf_call(l_remCall.toString(), this );
325:
326: this .pem_validSigns = null;
327: }
328:
329: public String pcmf_getInputFilter() {
330: return (this .pem_validSigns);
331: }
332:
333: public void pcmf_setCaretPosition(int xPos) {
334: this .pcmf_setSelectionInterval(new SelectionInterval(xPos, 0));
335: }
336:
337: public void pcmf_setSelectionInterval(SelectionInterval xIntervall) {
338: if (xIntervall == null) {
339: this .pcmf_unSelect();
340: return;
341: }
342: ;
343: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
344: "");
345:
346: if (this .pdm_session.pcmf_isInTransaction()) {
347: ScXmlScript.pcmf_createPBody(l_remCall);
348: } else {
349: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
350: ScXmlScript.pcmf_addProc(l_remCall, null);
351: }
352: ;
353: ScXmlScript.pcmf_addCall(l_remCall, null, this
354: .pcmf_getRemName(), "pcmf_setSelectionIntervall");
355: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
356: .toString(xIntervall.pcm_begin), "false", "int");
357: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
358: .toString(xIntervall.pcm_len), "false", "int");
359: ScXmlScript.pcmf_endAll(l_remCall);
360:
361: this .pdm_session.pcmf_call(l_remCall.toString(), this );
362: }
363:
364: public void pcmf_setSelected() {
365: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
366: "");
367:
368: if (this .pdm_session.pcmf_isInTransaction()) {
369: ScXmlScript.pcmf_createPBody(l_remCall);
370: } else {
371: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
372: ScXmlScript.pcmf_addProc(l_remCall, null);
373: }
374: ;
375: ScXmlScript.pcmf_addCall(l_remCall, null, this
376: .pcmf_getRemName(), "pcmf_setSelected");
377: ScXmlScript.pcmf_endAll(l_remCall);
378:
379: this .pdm_session.pcmf_call(l_remCall.toString(), this );
380: }
381:
382: public void pcmf_unSelect() {
383: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
384: "");
385:
386: if (this .pdm_session.pcmf_isInTransaction()) {
387: ScXmlScript.pcmf_createPBody(l_remCall);
388: } else {
389: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
390: ScXmlScript.pcmf_addProc(l_remCall, null);
391: }
392: ;
393: ScXmlScript.pcmf_addCall(l_remCall, null, this
394: .pcmf_getRemName(), "pcmf_unSelect");
395: ScXmlScript.pcmf_endAll(l_remCall);
396:
397: this .pdm_session.pcmf_call(l_remCall.toString(), this );
398: }
399:
400: public void pcmf_setScrollInfo(int xX, int xY) {
401: if (xX != this .pem_xScroll || xY != this .pem_yScroll) {
402: this .pem_xScroll = xX;
403: this .pem_yScroll = xY;
404:
405: Iterator l_it = this .pcmf_getSubIterator();
406: while (l_it.hasNext()) {
407: Object l_obj = l_it.next();
408: if (l_obj instanceof IUnEventChannel) {
409: if (((IUnEventChannel) l_obj).pcmf_getType() == IUnEventChannel.EVENT_SCROLL) {
410: IUnEventChannel l_ch = (IUnEventChannel) l_obj;
411: l_ch
412: .pcmf_getUnComponent()
413: .pcmf_setValue(
414: IUnEventChannel.EVENTs[IUnEventChannel.EVENT_SCROLL]
415: + ":" + xX + "," + xY);
416: l_ch.pcmf_getUnComponent().pcmf_setRefresh();
417:
418: if (l_ch.pcmf_isRefreshParent())
419: ((UnComponent) l_ch.pcmf_getUnComponent()
420: .pcmf_getParentNode())
421: .pcmf_setRefresh();
422:
423: try {
424: if (l_ch.pcmf_getUnComponent()
425: .pcmf_isSubmit())
426: l_ch.pcmf_getUnComponent()
427: .pcmf_dispatchEvent();
428: } catch (Exception e) {
429: KeLog.pcmf_logException("ug2t", this , e);
430: KeLog.pcmf_log("ug2t",
431: "error dispatch scroll event",
432: this, KeLog.ERROR);
433: }
434: }
435: break;
436: }
437: }
438: }
439: }
440: };
|