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 HoSrvGenericCheckBox extends AHoSrvGenericComponent
038: implements IUnCheckBox, IUnSyncComponent {
039: private String pem_string = null;
040: private IUnImage pem_icon = null;
041: private int pem_accKey = 0;
042:
043: public HoSrvGenericCheckBox(String xValue, String xString,
044: IUnApplication xAppl, String xClass) throws Exception {
045: super (xValue);
046: this .pcmf_setAppl(xAppl);
047: this .pcmf_setLocalValue(xValue);
048: this .pem_string = xString;
049:
050: if (xClass == null)
051: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingCheckBox";
052: else
053: pdm_clientClass = xClass;
054:
055: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
056: "");
057:
058: if (this .pdm_session.pcmf_isInTransaction()) {
059: ScXmlScript.pcmf_createPBody(l_remCall);
060: } else {
061: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
062: ScXmlScript.pcmf_addProc(l_remCall, null);
063: }
064: ;
065: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
066: this .pdm_clientClass, "global");
067: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
068: "java.lang.String");
069: ScXmlScript.pcmf_addDeclPar(l_remCall, xString, "false",
070: "java.lang.String");
071: ScXmlScript.pcmf_addDeclPar(l_remCall,
072: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
073: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
074:
075: ScXmlScript.pcmf_endAll(l_remCall);
076:
077: this .pdm_session.pcmf_call(l_remCall.toString(), this );
078:
079: return;
080: };
081:
082: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
083: AHoSrvGenericComponent l_obj = new HoSrvGenericCheckBox(this
084: .pcmf_getName(), this .pem_string, this .pcmf_getAppl(),
085: this .pdm_clientClass);
086: l_obj.pcmf_setGlobal(true);
087: this .pcmf_setGlobal(true);
088: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
089: l_obj.pcmf_setRefFrom(this );
090: this .pcmf_addRef(l_obj);
091:
092: return l_obj;
093: };
094:
095: public void pcmf_setIcon(IUnImage xIcon) {
096: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
097: "");
098:
099: if (this .pdm_session.pcmf_isInTransaction()) {
100: ScXmlScript.pcmf_createPBody(l_remCall);
101: } else {
102: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
103: ScXmlScript.pcmf_addProc(l_remCall, null);
104: }
105: ;
106: ScXmlScript.pcmf_addCall(l_remCall, null, this
107: .pcmf_getRemName(), "pcmf_setIcon");
108: ScXmlScript.pcmf_addCallPar(l_remCall, xIcon
109: .pcmf_getUnComponent().pcmf_getRemName(), "true",
110: "de.ug2t.unifiedGui.interfaces.IUnImage");
111: ScXmlScript.pcmf_endAll(l_remCall);
112:
113: this .pdm_session.pcmf_call(l_remCall.toString(), this );
114:
115: if (this .pem_icon != null)
116: this .pem_icon.pcmf_detach();
117:
118: this .pem_icon = xIcon;
119: this .pem_icon.pcmf_attach();
120: }
121:
122: public IUnImage pcmf_getIcon() {
123: return (this .pem_icon);
124: };
125:
126: public String pcmf_getLabel() {
127: return (pem_string);
128: };
129:
130: public void pcmf_setLabel(String xLabel) {
131: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
132: "");
133:
134: if (this .pdm_session.pcmf_isInTransaction()) {
135: ScXmlScript.pcmf_createPBody(l_remCall);
136: } else {
137: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
138: ScXmlScript.pcmf_addProc(l_remCall, null);
139: }
140: ;
141: ScXmlScript.pcmf_addCall(l_remCall, null, this
142: .pcmf_getRemName(), "pcmf_setLabel");
143: ScXmlScript.pcmf_addCallPar(l_remCall, xLabel, "false",
144: "java.lang.String");
145: ScXmlScript.pcmf_endAll(l_remCall);
146:
147: this .pdm_session.pcmf_call(l_remCall.toString(), this );
148:
149: this .pem_string = xLabel;
150: };
151:
152: private boolean pem_readOnly = false;
153:
154: public void pcmf_setReadOnly(boolean xReadOnly) {
155: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
156: "");
157:
158: if (this .pdm_session.pcmf_isInTransaction()) {
159: ScXmlScript.pcmf_createPBody(l_remCall);
160: } else {
161: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
162: ScXmlScript.pcmf_addProc(l_remCall, null);
163: }
164: ;
165: ScXmlScript.pcmf_addCall(l_remCall, null, this
166: .pcmf_getRemName(), "pcmf_setReadOnly");
167: ScXmlScript.pcmf_addCallPar(l_remCall, Boolean
168: .toString(xReadOnly), "false", "boolean");
169: ScXmlScript.pcmf_endAll(l_remCall);
170:
171: this .pdm_session.pcmf_call(l_remCall.toString(), this );
172: this .pem_readOnly = xReadOnly;
173: }
174:
175: public boolean pcmf_isReadOnly() {
176: return (this .pem_readOnly);
177: }
178:
179: public void pcmf_delete() throws Exception {
180: if (this .pdm_deleted == true)
181: return;
182:
183: if (this .pem_icon != null) {
184: this .pem_icon.pcmf_detach();
185: this .pem_icon.pcmf_getUnComponent().pcmf_delete();
186: }
187:
188: super .pcmf_delete();
189: }
190:
191: private int pem_syncCnt = 0;
192:
193: public Object pcmf_getValueToSync() {
194: return (this .pcmf_getValue());
195: }
196:
197: public void pcmf_setSynced() {
198: this .pem_syncCnt++;
199: }
200:
201: public void pcmf_unSync() {
202: this .pem_syncCnt--;
203: if (this .pem_syncCnt < 0)
204: this .pem_syncCnt = 0;
205: }
206:
207: public boolean pcmf_isSynced() {
208: if (this .pem_syncCnt == 0)
209: return (false);
210: else
211: return (true);
212: }
213:
214: public void pcmf_setKeyAccess(int xKey) {
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_setKeyAccess");
227: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xKey),
228: "false", "int");
229: ScXmlScript.pcmf_endAll(l_remCall);
230:
231: this .pdm_session.pcmf_call(l_remCall.toString(), this );
232:
233: this .pem_accKey = xKey;
234: };
235:
236: public int pcmf_getAccKey() {
237: return (this.pem_accKey);
238: }
239: }
|