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.interfaces.*;
037: import de.ug2t.xmlScript.*;
038:
039: /**
040: * @author Dirk
041: *
042: * date: 20.01.2005
043: *
044: * <p>
045: * Purpose:
046: * </p>
047: */
048: public final class HoSrvGenericSlider extends AHoSrvGenericComponent
049: implements IUnSlider {
050: private int pem_direction = IUnSlider.SLIDE_HORIZONTAL;
051:
052: /**
053: * @param xName
054: * @param xSess
055: * @throws Exception
056: */
057: public HoSrvGenericSlider(String xName, int xDirection,
058: IUnApplication xAppl, String xClass) throws Exception {
059: super (xName);
060:
061: this .pcmf_setAppl(xAppl);
062: this .pcmf_setLocalValue("");
063: this .pem_direction = xDirection;
064:
065: if (xClass == null)
066: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingSlider";
067: else
068: pdm_clientClass = xClass;
069:
070: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
071: "");
072:
073: if (this .pdm_session.pcmf_isInTransaction()) {
074: ScXmlScript.pcmf_createPBody(l_remCall);
075: } else {
076: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
077: ScXmlScript.pcmf_addProc(l_remCall, null);
078: }
079: ;
080: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
081: this .pdm_clientClass, "global");
082: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
083: "java.lang.String");
084: ScXmlScript.pcmf_addDeclPar(l_remCall, Integer
085: .toString(xDirection), "false", "int");
086: ScXmlScript.pcmf_addDeclPar(l_remCall,
087: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
088: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
089:
090: ScXmlScript.pcmf_endAll(l_remCall);
091:
092: this .pdm_session.pcmf_call(l_remCall.toString(), this );
093: this .pcmf_enableSubmit();
094:
095: return;
096: }
097:
098: /**
099: * <p>
100: * Does...
101: * </p>
102: * <p>
103: *
104: * @return a Type with
105: * </p>
106: * <p>
107: * @param
108: * </p>
109: */
110: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
111: AHoSrvGenericComponent l_obj = new HoSrvGenericSlider(this
112: .pcmf_getName(), this .pem_direction, this
113: .pcmf_getAppl(), this .pdm_clientClass);
114: l_obj.pcmf_setGlobal(true);
115: this .pcmf_setGlobal(true);
116: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
117: l_obj.pcmf_setRefFrom(this );
118: this .pcmf_addRef(l_obj);
119:
120: return l_obj;
121: }
122:
123: /**
124: * <p>
125: * Does...
126: * </p>
127: * <p>
128: *
129: * @return a Type with
130: * </p>
131: * <p>
132: * @param
133: * </p>
134: */
135: public void pcmf_setRange(int xMinVal, int xMaxVal, int xSteps) {
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_setRange");
148: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
149: .toString(xMinVal), "false", "int");
150: ScXmlScript.pcmf_addCallPar(l_remCall, Integer
151: .toString(xMaxVal), "false", "int");
152: ScXmlScript.pcmf_addCallPar(l_remCall,
153: Integer.toString(xSteps), "false", "int");
154: ScXmlScript.pcmf_endAll(l_remCall);
155:
156: this .pdm_session.pcmf_call(l_remCall.toString(), this );
157: }
158:
159: /**
160: * <p>
161: * Does...
162: * </p>
163: * <p>
164: *
165: * @return a Type with
166: * </p>
167: * <p>
168: * @param
169: * </p>
170: */
171: public void pcmf_setRange(Map xValues) {
172: this .pcmf_removeAllValues();
173:
174: Iterator l_it = xValues.keySet().iterator();
175: while (l_it.hasNext()) {
176: Object l_objk = l_it.next();
177: Object l_obj = xValues.get(l_objk);
178: if (l_obj instanceof AHoSrvGenericComponent)
179: this .pcmf_addValueObj(l_objk.toString(),
180: (AHoSrvGenericComponent) l_obj);
181: else
182: this .pcmf_addValue(l_objk.toString(), l_obj.toString());
183: }
184:
185: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
186: "");
187:
188: if (this .pdm_session.pcmf_isInTransaction()) {
189: ScXmlScript.pcmf_createPBody(l_remCall);
190: } else {
191: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
192: ScXmlScript.pcmf_addProc(l_remCall, null);
193: }
194: ;
195: ScXmlScript.pcmf_addCall(l_remCall, null, this
196: .pcmf_getRemName(), "pcmf_setRange");
197: ScXmlScript.pcmf_endAll(l_remCall);
198:
199: this .pdm_session.pcmf_call(l_remCall.toString(), this );
200:
201: return;
202: }
203:
204: /**
205: * <p>
206: * Does...
207: * </p>
208: * <p>
209: *
210: * @return a Type with
211: * </p>
212: * <p>
213: * @param
214: * </p>
215: */
216: private void pcmf_removeAllValues() {
217: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
218: "");
219:
220: if (this .pdm_session.pcmf_isInTransaction()) {
221: ScXmlScript.pcmf_createPBody(l_remCall);
222: } else {
223: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
224: ScXmlScript.pcmf_addProc(l_remCall, null);
225: }
226: ;
227: ScXmlScript.pcmf_addCall(l_remCall, null, this
228: .pcmf_getRemName(), "pcmf_removeAllValues");
229: ScXmlScript.pcmf_endAll(l_remCall);
230:
231: this .pdm_session.pcmf_call(l_remCall.toString(), this );
232:
233: return;
234: }
235:
236: /**
237: * <p>
238: * Does...
239: * </p>
240: * <p>
241: *
242: * @return a Type with
243: * </p>
244: * <p>
245: * @param
246: * </p>
247: */
248: private void pcmf_addValue(String xKey, String xValue) {
249: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
250: "");
251:
252: if (this .pdm_session.pcmf_isInTransaction()) {
253: ScXmlScript.pcmf_createPBody(l_remCall);
254: } else {
255: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
256: ScXmlScript.pcmf_addProc(l_remCall, null);
257: }
258: ;
259: ScXmlScript.pcmf_addCall(l_remCall, null, this
260: .pcmf_getRemName(), "pcmf_addValue");
261: ScXmlScript.pcmf_addCallPar(l_remCall, xKey, "false",
262: "java.lang.String");
263: ScXmlScript.pcmf_addCallPar(l_remCall, xValue, "false",
264: "java.lang.String");
265: ScXmlScript.pcmf_endAll(l_remCall);
266:
267: this .pdm_session.pcmf_call(l_remCall.toString(), this );
268:
269: return;
270: }
271:
272: private void pcmf_addValueObj(String xKey,
273: AHoSrvGenericComponent xValue) {
274: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
275: "");
276:
277: if (this .pdm_session.pcmf_isInTransaction()) {
278: ScXmlScript.pcmf_createPBody(l_remCall);
279: } else {
280: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
281: ScXmlScript.pcmf_addProc(l_remCall, null);
282: }
283: ;
284: ScXmlScript.pcmf_addCall(l_remCall, null, this
285: .pcmf_getRemName(), "pcmf_addValueObj");
286: ScXmlScript.pcmf_addCallPar(l_remCall, xKey, "false",
287: "java.lang.String");
288: ScXmlScript.pcmf_addCallPar(l_remCall,
289: xValue.pcmf_getRemName(), "true",
290: "de.ug2t.channel.ho.client.swing.HoSwingComponent");
291: ScXmlScript.pcmf_endAll(l_remCall);
292:
293: this .pdm_session.pcmf_call(l_remCall.toString(), this );
294:
295: return;
296: }
297:
298: public void pcmf_commitSlider() {
299: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
300: "");
301:
302: if (this .pdm_session.pcmf_isInTransaction()) {
303: ScXmlScript.pcmf_createPBody(l_remCall);
304: } else {
305: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
306: ScXmlScript.pcmf_addProc(l_remCall, null);
307: }
308: ;
309: ScXmlScript.pcmf_addCall(l_remCall, null, this
310: .pcmf_getRemName(), "pcmf_setRange");
311: ScXmlScript.pcmf_endAll(l_remCall);
312:
313: this .pdm_session.pcmf_call(l_remCall.toString(), this );
314:
315: return;
316: }
317:
318: public void pcmf_addValueItem(String xName, Object xValue) {
319: if (xValue instanceof AHoSrvGenericComponent)
320: this .pcmf_addValueObj(xName,
321: (AHoSrvGenericComponent) xValue);
322: else
323: this.pcmf_addValue(xName, xValue.toString());
324: }
325: }
|