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.client.swing;
032:
033: import java.util.*;
034:
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.*;
037: import de.ug2t.unifiedGui.interfaces.*;
038:
039: public final class HoSwingEventChannel extends UnComponent implements
040: IUnEventChannel {
041: private int pem_type;
042: private String pem_keyFilter = "";
043: private boolean pem_disp2Parent = true;
044: private boolean pem_refreshParent = false;
045:
046: /**
047: * @param xName
048: * @throws Exception
049: */
050: public HoSwingEventChannel(String xName, int xType)
051: throws Exception {
052: super (xName);
053: this .pem_type = xType;
054: this .pcmf_setEventOnChange(true);
055: }
056:
057: public HoSwingEventChannel(String xName, String xKeyFilter)
058: throws Exception {
059: super (xName);
060: this .pem_type = IUnEventChannel.EVENT_KEYACTION;
061: this .pem_keyFilter = xKeyFilter;
062: this .pcmf_setEventOnChange(true);
063: }
064:
065: public int pcmf_getType() {
066: return (this .pem_type);
067: }
068:
069: public void pcmf_dispatchEvent() throws Exception {
070: pdm_isRefreshed = false;
071:
072: IUnGuiEventListener l_listener = null;
073: Iterator l_it = null;
074:
075: if (this .pdm_listeners == null)
076: return;
077:
078: l_it = pdm_listeners.iterator();
079: while (l_it.hasNext()) {
080: l_listener = (IUnGuiEventListener) l_it.next();
081: if (l_listener instanceof IUnSynchronizedGuiEventListener
082: && ((IUnSynchronizedGuiEventListener) l_listener)
083: .pcmf_synchronize()) {
084: try {
085: UnEventDispatcher.pcmf_startSingleProcessing();
086:
087: if (this .pem_disp2Parent)
088: l_listener.pcmf_execListener((UnComponent) this
089: .pcmf_getParentNode());
090: else
091: l_listener.pcmf_execListener(this );
092:
093: UnEventDispatcher.pcmf_endSingleProcessing();
094: } catch (Exception e) {
095: UnEventDispatcher.pcmf_endSingleProcessing();
096: throw (e);
097: } catch (Throwable e) {
098: UnEventDispatcher.pcmf_endSingleProcessing();
099: KeLog.pcmf_logThrowable("ug2t", this , e);
100: }
101: } else {
102: if (this .pem_disp2Parent)
103: l_listener.pcmf_execListener((UnComponent) this
104: .pcmf_getParentNode());
105: else
106: l_listener.pcmf_execListener(this );
107: }
108: }
109: ;
110: return;
111: };
112:
113: public String pcmf_getKeyFilter() {
114: return (this .pem_keyFilter);
115: }
116:
117: public void pcmf_receiveEvent() {
118: this .pem_disp2Parent = false;
119: }
120:
121: public boolean pcmf_isReceiveEvent() {
122: return (this .pem_disp2Parent);
123: }
124:
125: public boolean pcmf_isRefreshParent() {
126: return (this .pem_refreshParent);
127: }
128:
129: public void pcmf_refreshParent() {
130: this .pem_refreshParent = true;
131: }
132:
133: public void pcmf_setKeyFilter(String xFilter) {
134: this.pem_keyFilter = xFilter;
135: }
136: }
|