001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 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.markup.generic;
032:
033: import java.util.*;
034:
035: import de.ug2t.channel.markup.html.renderer.*;
036: import de.ug2t.connector.*;
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.*;
039: import de.ug2t.unifiedGui.interfaces.*;
040:
041: public final class MuGenericEventChannel extends MuGenericComponent
042: implements IUnEventChannel {
043: private IKeView pem_view = new HtmlEventChannelRenderer();
044: private String pem_keyFilter = null;
045: private boolean pem_disp2Parent = true;
046: private boolean pem_refreshParent = false;
047: private int pem_type;
048:
049: /**
050: * @param xName
051: * @param xTplGetter
052: * @param xTplName
053: * @param xAppl
054: * @throws Exception
055: */
056: public MuGenericEventChannel(String xName, int xType,
057: ACoDataGetter xTplGetter, Object xTplName,
058: MuGenericApplication xAppl) throws Exception {
059: super (xName, xTplGetter, xTplName, xAppl);
060: this .pcmf_setEventOnChange(true);
061: this .pcmf_setView(pem_view);
062: this .pem_type = xType;
063: }
064:
065: public MuGenericEventChannel(String xName, String xKeyFilter,
066: ACoDataGetter xTplGetter, Object xTplName,
067: MuGenericApplication xAppl) throws Exception {
068: super (xName, xTplGetter, xTplName, xAppl);
069: this .pcmf_setEventOnChange(true);
070: this .pcmf_setView(pem_view);
071: this .pem_type = IUnEventChannel.EVENT_KEYACTION;
072: this .pem_keyFilter = xKeyFilter;
073: }
074:
075: /**
076: * <p>
077: * Does...
078: * </p>
079: * <p>
080: *
081: * @return a Type with
082: * </p>
083: * <p>
084: * @param
085: * </p>
086: */
087: public int pcmf_getType() {
088: return (this .pem_type);
089: }
090:
091: public Object pcmf_execView() {
092: try {
093: if (this .pcmf_isHidden() && !this .pcmf_getRenderIfHidden())
094: return (((MuGenericApplication) this .pcmf_getAppl())
095: .pcmf_getRenderer().pcmf_wrapMarkup("", this ));
096: else
097: return (((MuGenericApplication) this .pcmf_getAppl())
098: .pcmf_getRenderer()
099: .pcmf_wrapMarkup(pdm_NodeView.pcmf_output(this )
100: .toString(), this ));
101: } catch (Exception e) {
102: KeLog.pcmf_logException("ug2t", this , e);
103: return ("ERROR");
104: }
105: };
106:
107: public void pcmf_dispatchEvent() throws Exception {
108: pdm_isRefreshed = false;
109:
110: IUnGuiEventListener l_listener = null;
111: Iterator l_it = null;
112:
113: if (this .pdm_listeners == null)
114: return;
115:
116: l_it = pdm_listeners.iterator();
117: while (l_it.hasNext()) {
118: l_listener = (IUnGuiEventListener) l_it.next();
119: if (l_listener instanceof IUnSynchronizedGuiEventListener
120: && ((IUnSynchronizedGuiEventListener) l_listener)
121: .pcmf_synchronize()) {
122: try {
123: UnEventDispatcher.pcmf_startSingleProcessing();
124:
125: if (this .pem_disp2Parent)
126: l_listener.pcmf_execListener((UnComponent) this
127: .pcmf_getParentNode());
128: else
129: l_listener.pcmf_execListener(this );
130:
131: UnEventDispatcher.pcmf_endSingleProcessing();
132: } catch (Exception e) {
133: UnEventDispatcher.pcmf_endSingleProcessing();
134: throw (e);
135: } catch (Throwable e) {
136: UnEventDispatcher.pcmf_endSingleProcessing();
137: KeLog.pcmf_logThrowable("ug2t", this , e);
138: }
139: } else {
140: if (this .pem_disp2Parent)
141: l_listener.pcmf_execListener((UnComponent) this
142: .pcmf_getParentNode());
143: else
144: l_listener.pcmf_execListener(this );
145: }
146: }
147: ;
148: return;
149: };
150:
151: public String pcmf_getKeyFilter() {
152: return (this .pem_keyFilter);
153: }
154:
155: public void pcmf_receiveEvent() {
156: this .pem_disp2Parent = false;
157: }
158:
159: public boolean pcmf_isReceiveEvent() {
160: return (this .pem_disp2Parent);
161: }
162:
163: public boolean pcmf_isRefreshParent() {
164: return (this .pem_refreshParent);
165: }
166:
167: public void pcmf_refreshParent() {
168: this .pem_refreshParent = true;
169: }
170:
171: public void pcmf_setKeyFilter(String xFilter) {
172: this.pem_keyFilter = xFilter;
173: }
174: }
|