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.channel.ho.*;
036: import de.ug2t.kernel.*;
037: import de.ug2t.unifiedGui.*;
038: import de.ug2t.unifiedGui.interfaces.*;
039: import de.ug2t.xmlScript.*;
040:
041: public final class HoSrvGenericRadioPanel extends
042: AHoSrvGenericContainer implements IUnRadioPanel {
043: private HashMap pem_values = new HashMap();
044:
045: public HoSrvGenericRadioPanel(String xName, String xValue,
046: String xString, IUnApplication xAppl, String xClass)
047: throws Exception {
048: super (xName);
049: this .pcmf_setAppl(xAppl);
050: this .pcmf_setLocalValue(xValue);
051: pem_values.put(xValue, xString);
052:
053: if (xClass == null)
054: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingRadioPanel";
055: else
056: pdm_clientClass = xClass;
057:
058: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
059: "");
060:
061: if (this .pdm_session.pcmf_isInTransaction()) {
062: ScXmlScript.pcmf_createPBody(l_remCall);
063: } else {
064: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
065: ScXmlScript.pcmf_addProc(l_remCall, null);
066: }
067: ;
068: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
069: this .pdm_clientClass, "global");
070: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
071: "java.lang.String");
072: ScXmlScript.pcmf_addDeclPar(l_remCall, xValue, "false",
073: "java.lang.String");
074: ScXmlScript.pcmf_addDeclPar(l_remCall, xString, "false",
075: "java.lang.String");
076: ScXmlScript.pcmf_addDeclPar(l_remCall,
077: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
078: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
079:
080: ScXmlScript.pcmf_endAll(l_remCall);
081:
082: this .pdm_session.pcmf_call(l_remCall.toString(), this );
083:
084: return;
085: };
086:
087: public KeTreeNode pcmf_addValue(String xValue, String xString) {
088: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
089: "");
090: HoGenericTreeNode l_gobj = null;
091: try {
092: l_gobj = new HoGenericTreeNode(xString);
093: l_gobj.pcmf_setValue(xString);
094: this .pcmf_addNode(xValue, l_gobj);
095: } catch (Exception e) {
096: KeLog.pcmf_logException("ug2t", this , e);
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_addValue");
108: ScXmlScript.pcmf_addCallPar(l_remCall, xValue, "false",
109: "java.lang.String");
110: ScXmlScript.pcmf_addCallPar(l_remCall, xString, "false",
111: "java.lang.String");
112: ScXmlScript.pcmf_endAll(l_remCall);
113:
114: this .pdm_session.pcmf_call(l_remCall.toString(), this );
115:
116: pem_values.put(xValue, xString);
117:
118: return (l_gobj);
119: };
120:
121: public void pcmf_removeAllValues() {
122: this .pem_values.clear();
123: this .pcmf_clearAndRelease();
124:
125: return;
126: };
127:
128: public void pcmf_removeValue(String xValue) {
129: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
130: "");
131:
132: if (this .pdm_session.pcmf_isInTransaction()) {
133: ScXmlScript.pcmf_createPBody(l_remCall);
134: } else {
135: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
136: ScXmlScript.pcmf_addProc(l_remCall, null);
137: }
138: ;
139: ScXmlScript.pcmf_addCall(l_remCall, null, this
140: .pcmf_getRemName(), "pcmf_removeValue");
141: ScXmlScript.pcmf_addCallPar(l_remCall, xValue, "false",
142: "java.lang.String");
143: ScXmlScript.pcmf_endAll(l_remCall);
144:
145: this .pdm_session.pcmf_call(l_remCall.toString(), this );
146:
147: KeTreeNode l_node = this .pcmf_removeNode(xValue);
148: if (l_node != null)
149: l_node.pcmf_releaseSubs();
150:
151: pem_values.remove(xValue);
152: };
153:
154: public HashMap pcmf_getValues() {
155: return (pem_values);
156: };
157:
158: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
159: Object l_key = null;
160: AHoSrvGenericComponent l_obj = null;
161: Iterator l_it = this .pcmf_getValues().keySet().iterator();
162: while (l_it.hasNext()) {
163: l_key = l_it.next();
164: if (l_obj == null) {
165: l_obj = new HoSrvGenericRadioPanel(this .pcmf_getName(),
166: l_key.toString(), this .pcmf_getValues().get(
167: l_key.toString()).toString(), this
168: .pcmf_getAppl(), this .pdm_clientClass);
169: continue;
170: }
171: ;
172:
173: ((HoSrvGenericRadioPanel) l_obj).pcmf_addValue(l_key
174: .toString(), this .pcmf_getValues().get(
175: l_key.toString()).toString());
176: }
177: ;
178:
179: l_obj.pcmf_setGlobal(true);
180: this .pcmf_setGlobal(true);
181: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
182: l_obj.pcmf_setRefFrom(this );
183: this .pcmf_addRef(l_obj);
184:
185: return l_obj;
186: };
187:
188: public UnComponent pcmf_setPosition(UnComponent xObj, int xPos,
189: int yPos, int xWidth, int xHeigth, int xAlign) {
190: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
191: "");
192:
193: if (this .pdm_session.pcmf_isInTransaction()) {
194: ScXmlScript.pcmf_createPBody(l_remCall);
195: } else {
196: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
197: ScXmlScript.pcmf_addProc(l_remCall, null);
198: }
199: ;
200: ScXmlScript.pcmf_addCall(l_remCall, null, this
201: .pcmf_getRemName(), "pcmf_setPosition");
202: ScXmlScript.pcmf_addCallPar(l_remCall, xObj.pcmf_getRemName(),
203: "true", "de.ug2t.kernel.KeTreeNode");
204: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(xPos),
205: "false", "int");
206: ScXmlScript.pcmf_addCallPar(l_remCall, Integer.toString(yPos),
207: "false", "int");
208: ScXmlScript.pcmf_addCallPar(l_remCall,
209: Integer.toString(xWidth), "false", "int");
210: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
211: .toString(xHeigth), "false", "int");
212: ScXmlScript.pcmf_addCallPar(l_remCall,
213: Integer.toString(xAlign), "false", "int");
214: ScXmlScript.pcmf_endAll(l_remCall);
215:
216: this .pdm_session.pcmf_call(l_remCall.toString(), this );
217:
218: return (this );
219: };
220:
221: public void pcmf_delete() throws Exception {
222: if (this .pdm_deleted == true)
223: return;
224:
225: Iterator l_it = new ArrayList(this .pcmf_getAllSubs())
226: .iterator();
227: KeTreeNode l_sub = null;
228: while (l_it.hasNext()) {
229: l_sub = (KeTreeNode) l_it.next();
230: if (l_sub.pcmf_getRemName() != null)
231: this .pcmf_removeNode(l_sub);
232: }
233:
234: super .pcmf_delete();
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: }
|