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 final class HoSrvGenericEventChannel extends
041: AHoSrvGenericComponent implements IUnEventChannel {
042: private int pem_type;
043: private String pem_keyFilter = "";
044: private boolean pem_disp2Parent = true;
045: private boolean pem_refreshParent = false;
046:
047: /**
048: * @param xName
049: * @throws Exception
050: */
051: public HoSrvGenericEventChannel(String xName, int xType,
052: IUnApplication xAppl, String xClass) throws Exception {
053: super (xName);
054: this .pcmf_setAppl(xAppl);
055: this .pcmf_setEventOnChange(true);
056:
057: this .pcmf_setLocalValue("");
058: this .pem_type = xType;
059:
060: if (xClass == null)
061: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingEventChannel";
062: else
063: pdm_clientClass = xClass;
064:
065: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
066: "");
067:
068: if (this .pdm_session.pcmf_isInTransaction()) {
069: ScXmlScript.pcmf_createPBody(l_remCall);
070: } else {
071: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
072: ScXmlScript.pcmf_addProc(l_remCall, null);
073: }
074: ;
075: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
076: this .pdm_clientClass, "global");
077: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
078: "java.lang.String");
079: ScXmlScript.pcmf_addDeclPar(l_remCall, Integer.toString(xType),
080: "false", "int");
081:
082: ScXmlScript.pcmf_endAll(l_remCall);
083:
084: this .pdm_session.pcmf_call(l_remCall.toString(), this );
085:
086: return;
087: }
088:
089: public HoSrvGenericEventChannel(String xName, String xKeyFilter,
090: IUnApplication xAppl, String xClass) throws Exception {
091: super (xName);
092: this .pcmf_setAppl(xAppl);
093: this .pcmf_setEventOnChange(true);
094:
095: this .pcmf_setLocalValue("");
096: this .pem_type = IUnEventChannel.EVENT_KEYACTION;
097: this .pem_keyFilter = xKeyFilter;
098:
099: if (xClass == null)
100: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingEventChannel";
101: else
102: pdm_clientClass = xClass;
103:
104: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
105: "");
106:
107: if (this .pdm_session.pcmf_isInTransaction()) {
108: ScXmlScript.pcmf_createPBody(l_remCall);
109: } else {
110: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
111: ScXmlScript.pcmf_addProc(l_remCall, null);
112: }
113: ;
114: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
115: this .pdm_clientClass, "global");
116: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
117: "java.lang.String");
118: ScXmlScript.pcmf_addDeclPar(l_remCall, xKeyFilter, "false",
119: "java.lang.String");
120:
121: ScXmlScript.pcmf_endAll(l_remCall);
122:
123: this .pdm_session.pcmf_call(l_remCall.toString(), this );
124:
125: return;
126: }
127:
128: /**
129: * <p>
130: * Does...
131: * </p>
132: * <p>
133: *
134: * @return a Type with
135: * </p>
136: * <p>
137: * @param
138: * </p>
139: */
140: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
141: throw (new UnsupportedOperationException());
142: }
143:
144: public int pcmf_getType() {
145: return (this .pem_type);
146: }
147:
148: public void pcmf_dispatchEvent() throws Exception {
149: pdm_isRefreshed = false;
150:
151: IUnGuiEventListener l_listener = null;
152: Iterator l_it = null;
153:
154: if (this .pdm_listeners == null)
155: return;
156:
157: l_it = pdm_listeners.iterator();
158: while (l_it.hasNext()) {
159: l_listener = (IUnGuiEventListener) l_it.next();
160: if (l_listener instanceof IUnSynchronizedGuiEventListener
161: && ((IUnSynchronizedGuiEventListener) l_listener)
162: .pcmf_synchronize()) {
163: try {
164: UnEventDispatcher.pcmf_startSingleProcessing();
165:
166: if (this .pem_disp2Parent)
167: l_listener.pcmf_execListener((UnComponent) this
168: .pcmf_getParentNode());
169: else
170: l_listener.pcmf_execListener(this );
171:
172: UnEventDispatcher.pcmf_endSingleProcessing();
173: } catch (Exception e) {
174: UnEventDispatcher.pcmf_endSingleProcessing();
175: throw (e);
176: } catch (Throwable e) {
177: UnEventDispatcher.pcmf_endSingleProcessing();
178: KeLog.pcmf_logThrowable("ug2t", this , e);
179: }
180: } else {
181: if (this .pem_disp2Parent)
182: l_listener.pcmf_execListener((UnComponent) this
183: .pcmf_getParentNode());
184: else
185: l_listener.pcmf_execListener(this );
186: }
187: }
188: ;
189: return;
190: };
191:
192: public String pcmf_getKeyFilter() {
193: return (this .pem_keyFilter);
194: }
195:
196: public void pcmf_receiveEvent() {
197: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
198: "");
199:
200: if (this .pdm_session.pcmf_isInTransaction()) {
201: ScXmlScript.pcmf_createPBody(l_remCall);
202: } else {
203: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
204: ScXmlScript.pcmf_addProc(l_remCall, null);
205: }
206: ;
207: ScXmlScript.pcmf_addCall(l_remCall, null, this
208: .pcmf_getRemName(), "pcmf_receiveEvent");
209: ScXmlScript.pcmf_endAll(l_remCall);
210:
211: this .pdm_session.pcmf_call(l_remCall.toString(), this );
212:
213: this .pem_disp2Parent = false;
214: }
215:
216: public boolean pcmf_isReceiveEvent() {
217: return (this .pem_disp2Parent);
218: }
219:
220: public boolean pcmf_isRefreshParent() {
221: return (this .pem_refreshParent);
222: }
223:
224: public void pcmf_refreshParent() {
225: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
226: "");
227:
228: if (this .pdm_session.pcmf_isInTransaction()) {
229: ScXmlScript.pcmf_createPBody(l_remCall);
230: } else {
231: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
232: ScXmlScript.pcmf_addProc(l_remCall, null);
233: }
234: ;
235: ScXmlScript.pcmf_addCall(l_remCall, null, this
236: .pcmf_getRemName(), "pcmf_refreshParent");
237: ScXmlScript.pcmf_endAll(l_remCall);
238:
239: this .pdm_session.pcmf_call(l_remCall.toString(), this );
240:
241: this .pem_refreshParent = true;
242: }
243:
244: public void pcmf_setKeyFilter(String xFilter) {
245: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
246: "");
247:
248: if (this .pdm_session.pcmf_isInTransaction()) {
249: ScXmlScript.pcmf_createPBody(l_remCall);
250: } else {
251: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
252: ScXmlScript.pcmf_addProc(l_remCall, null);
253: }
254: ;
255:
256: ScXmlScript.pcmf_addCall(l_remCall, null, this
257: .pcmf_getRemName(), "pcmf_setKeyFilter");
258: ScXmlScript.pcmf_addCallPar(l_remCall, xFilter, "false",
259: "java.lang.String");
260: ScXmlScript.pcmf_endAll(l_remCall);
261:
262: this.pdm_session.pcmf_call(l_remCall.toString(), this);
263:
264: this.pem_keyFilter = xFilter;
265: }
266: }
|