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 de.ug2t.kernel.*;
034: import de.ug2t.unifiedGui.interfaces.*;
035: import de.ug2t.xmlScript.*;
036:
037: public final class HoSrvGenericInputField extends
038: AHoSrvGenericComponent implements IUnInputField,
039: IUnSyncComponent {
040: private int pem_maxLen = 0;
041: private int pem_maxSize = 0;
042: private boolean pem_isPwd = false;
043: private String pem_validSigns = null;
044:
045: public HoSrvGenericInputField(String xName, int xSize, int xLen,
046: String xValue, boolean xPwd, IUnApplication xAppl,
047: String xClass) throws Exception {
048: super (xName);
049: this .pcmf_setAppl(xAppl);
050:
051: this .pcmf_setLocalValue(xValue);
052: this .pem_maxLen = xLen;
053: this .pem_maxSize = xSize;
054: this .pem_isPwd = xPwd;
055:
056: if (xClass == null)
057: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingInputField";
058: else
059: pdm_clientClass = xClass;
060:
061: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
062: "");
063:
064: if (this .pdm_session.pcmf_isInTransaction()) {
065: ScXmlScript.pcmf_createPBody(l_remCall);
066: } else {
067: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
068: ScXmlScript.pcmf_addProc(l_remCall, null);
069: }
070: ;
071: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
072: this .pdm_clientClass, "global");
073: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
074: "java.lang.String");
075: ScXmlScript.pcmf_addDeclPar(l_remCall, Integer.toString(xSize),
076: "false", "int");
077: ScXmlScript.pcmf_addDeclPar(l_remCall, Integer.toString(xLen),
078: "false", "int");
079: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
080: "java.lang.String");
081: ScXmlScript.pcmf_addDeclPar(l_remCall, xPwd ? "true" : "false",
082: "false", "boolean");
083: ScXmlScript.pcmf_addDeclPar(l_remCall, ((KeTreeNode) xAppl)
084: .pcmf_getRemName(), "true",
085: "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: private int pem_syncCnt = 0;
095:
096: public Object pcmf_getValueToSync() {
097: return (this .pcmf_getValue());
098: }
099:
100: public void pcmf_setSynced() {
101: this .pem_syncCnt++;
102: }
103:
104: public void pcmf_unSync() {
105: this .pem_syncCnt--;
106: if (this .pem_syncCnt < 0)
107: this .pem_syncCnt = 0;
108: }
109:
110: public boolean pcmf_isSynced() {
111: if (this .pem_syncCnt == 0)
112: return (false);
113: else
114: return (true);
115: }
116:
117: public int pcmf_getMaxLen() {
118: return (pem_maxLen);
119: };
120:
121: public int pcmf_getSize() {
122: return (pem_maxSize);
123: };
124:
125: public String pcmf_getInputFilter() {
126: return (this .pem_validSigns);
127: }
128:
129: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
130: AHoSrvGenericComponent l_obj = new HoSrvGenericInputField(this
131: .pcmf_getName(), this .pem_maxSize, this .pem_maxLen,
132: this .pcmf_getValue().toString(), this .pem_isPwd, this
133: .pcmf_getAppl(), this .pdm_clientClass);
134: l_obj.pcmf_setGlobal(true);
135: this .pcmf_setGlobal(true);
136: l_obj.pcmf_setRefFrom(this );
137: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
138: this .pcmf_addRef(l_obj);
139:
140: return l_obj;
141: };
142:
143: private boolean pem_readOnly = false;
144:
145: public void pcmf_setReadOnly(boolean xReadOnly) {
146: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
147: "");
148:
149: if (this .pdm_session.pcmf_isInTransaction()) {
150: ScXmlScript.pcmf_createPBody(l_remCall);
151: } else {
152: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
153: ScXmlScript.pcmf_addProc(l_remCall, null);
154: }
155: ;
156: ScXmlScript.pcmf_addCall(l_remCall, null, this
157: .pcmf_getRemName(), "pcmf_setReadOnly");
158: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
159: .toString(xReadOnly), "false", "boolean");
160: ScXmlScript.pcmf_endAll(l_remCall);
161:
162: this .pdm_session.pcmf_call(l_remCall.toString(), this );
163: this .pem_readOnly = xReadOnly;
164: }
165:
166: public boolean pcmf_isReadOnly() {
167: return (this .pem_readOnly);
168: }
169:
170: public boolean pcmf_isPwd() {
171: return (this .pem_isPwd);
172: }
173:
174: private int pem_talign = IUnInputField.TEXT_ALIGN_WEST;
175:
176: public void pcmf_setTextAlign(int xAlign) {
177: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
178: "");
179:
180: if (this .pdm_session.pcmf_isInTransaction()) {
181: ScXmlScript.pcmf_createPBody(l_remCall);
182: } else {
183: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
184: ScXmlScript.pcmf_addProc(l_remCall, null);
185: }
186: ;
187: ScXmlScript.pcmf_addCall(l_remCall, null, this
188: .pcmf_getRemName(), "pcmf_setTextAlign");
189: ScXmlScript.pcmf_addCallPar(l_remCall,
190: Integer.toString(xAlign), "false", "int");
191: ScXmlScript.pcmf_endAll(l_remCall);
192:
193: this .pdm_session.pcmf_call(l_remCall.toString(), this );
194:
195: this .pem_talign = xAlign;
196: }
197:
198: public int pcmf_getTextAlign() {
199: return (this .pem_talign);
200: }
201:
202: public void pcmf_setCaretPosition(int xPos) {
203: this .pcmf_setSelectionInterval(new SelectionInterval(xPos, 0));
204: }
205:
206: public void pcmf_setSelectionInterval(SelectionInterval xIntervall) {
207: if (xIntervall == null) {
208: this .pcmf_unSelect();
209: return;
210: }
211: ;
212: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
213: "");
214:
215: if (this .pdm_session.pcmf_isInTransaction()) {
216: ScXmlScript.pcmf_createPBody(l_remCall);
217: } else {
218: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
219: ScXmlScript.pcmf_addProc(l_remCall, null);
220: }
221: ;
222: ScXmlScript.pcmf_addCall(l_remCall, null, this
223: .pcmf_getRemName(), "pcmf_setSelectionIntervall");
224: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
225: .toString(xIntervall.pcm_begin), "false", "int");
226: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
227: .toString(xIntervall.pcm_len), "false", "int");
228: ScXmlScript.pcmf_endAll(l_remCall);
229:
230: this .pdm_session.pcmf_call(l_remCall.toString(), this );
231: }
232:
233: public void pcmf_setSelected() {
234: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
235: "");
236:
237: if (this .pdm_session.pcmf_isInTransaction()) {
238: ScXmlScript.pcmf_createPBody(l_remCall);
239: } else {
240: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
241: ScXmlScript.pcmf_addProc(l_remCall, null);
242: }
243: ;
244: ScXmlScript.pcmf_addCall(l_remCall, null, this
245: .pcmf_getRemName(), "pcmf_setSelected");
246: ScXmlScript.pcmf_endAll(l_remCall);
247:
248: this .pdm_session.pcmf_call(l_remCall.toString(), this );
249: }
250:
251: public void pcmf_unSelect() {
252: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
253: "");
254:
255: if (this .pdm_session.pcmf_isInTransaction()) {
256: ScXmlScript.pcmf_createPBody(l_remCall);
257: } else {
258: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
259: ScXmlScript.pcmf_addProc(l_remCall, null);
260: }
261: ;
262: ScXmlScript.pcmf_addCall(l_remCall, null, this
263: .pcmf_getRemName(), "pcmf_unSelect");
264: ScXmlScript.pcmf_endAll(l_remCall);
265:
266: this .pdm_session.pcmf_call(l_remCall.toString(), this );
267: }
268:
269: public void pcmf_setInputFilter(String xSigns) {
270: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
271: "");
272:
273: if (this .pdm_session.pcmf_isInTransaction()) {
274: ScXmlScript.pcmf_createPBody(l_remCall);
275: } else {
276: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
277: ScXmlScript.pcmf_addProc(l_remCall, null);
278: }
279: ;
280: ScXmlScript.pcmf_addCall(l_remCall, null, this
281: .pcmf_getRemName(), "pcmf_setInputFilter");
282: ScXmlScript.pcmf_addCallPar(l_remCall, xSigns, "false",
283: "java.lang.String");
284: ScXmlScript.pcmf_endAll(l_remCall);
285:
286: this .pdm_session.pcmf_call(l_remCall.toString(), this );
287:
288: this .pem_validSigns = xSigns;
289: }
290:
291: public void pcmf_removeInputFilter() {
292: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
293: "");
294:
295: if (this .pdm_session.pcmf_isInTransaction()) {
296: ScXmlScript.pcmf_createPBody(l_remCall);
297: } else {
298: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
299: ScXmlScript.pcmf_addProc(l_remCall, null);
300: }
301: ;
302: ScXmlScript.pcmf_addCall(l_remCall, null, this
303: .pcmf_getRemName(), "pcmf_removeInputFilter");
304: ScXmlScript.pcmf_endAll(l_remCall);
305:
306: this.pdm_session.pcmf_call(l_remCall.toString(), this);
307:
308: this.pem_validSigns = null;
309: }
310: };
|