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.unifiedGui;
032:
033: import de.ug2t.channel.ho.*;
034: import de.ug2t.kernel.*;
035: import de.ug2t.unifiedGui.interfaces.*;
036: import de.ug2t.xmlScript.*;
037:
038: class UnMenuFctWrapper implements IKeExecutable {
039: private IUnGuiEventListener pem_listener;
040:
041: public UnMenuFctWrapper(IUnGuiEventListener xLi) {
042: this .pem_listener = xLi;
043: }
044:
045: public Object pcmf_execObj(Object xObj) {
046: try {
047: if (this .pem_listener instanceof IUnSynchronizedGuiEventListener
048: && ((IUnSynchronizedGuiEventListener) this .pem_listener)
049: .pcmf_synchronize()) {
050: try {
051: UnEventDispatcher.pcmf_startSingleProcessing();
052: this .pem_listener
053: .pcmf_execListener((UnComponent) xObj);
054: UnEventDispatcher.pcmf_endSingleProcessing();
055: } catch (Exception e) {
056: UnEventDispatcher.pcmf_endSingleProcessing();
057: throw (e);
058: } catch (Throwable e) {
059: UnEventDispatcher.pcmf_endSingleProcessing();
060: KeLog.pcmf_logThrowable("ug2t", this , e);
061: }
062: } else {
063: this .pem_listener.pcmf_execListener((UnComponent) xObj);
064: }
065: } catch (Exception e) {
066: KeLog.pcmf_logException("ug2t", this , e);
067: KeLog.pcmf_log("ug2t", "error during listener call", this ,
068: KeLog.ERROR);
069: }
070: return (xObj);
071: }
072:
073: };
074:
075: /**
076: * @author Dirk
077: *
078: * date: 03.04.2004 project: WiSer-Framework
079: *
080: * <p>
081: * This class is used to connect menues with listeners. Normally it is not
082: * necessary to use it.
083: * </p>
084: */
085: public final class UnMenuFunction extends HoGenericTreeNode implements
086: IUnKeyAccess {
087: private IKeExecutable pem_preFct = null;
088: private IKeExecutable pem_postFct = null;
089: private IKeExecutable pem_fct = null;
090: private int pem_accCode = ' ';
091:
092: public UnMenuFunction(String xName, IKeExecutable xPre,
093: IKeExecutable xPost, IKeExecutable xFct) throws Exception {
094: super (xName);
095:
096: this .pem_preFct = xPre;
097: this .pem_postFct = xPost;
098: this .pem_fct = xFct;
099:
100: return;
101: };
102:
103: public UnMenuFunction(String xName, IKeExecutable xFct)
104: throws Exception {
105: super (xName);
106:
107: this .pem_preFct = null;
108: this .pem_postFct = null;
109: this .pem_fct = xFct;
110:
111: return;
112: };
113:
114: public UnMenuFunction(String xName, IUnGuiEventListener xFct)
115: throws Exception {
116: super (xName);
117:
118: this .pem_preFct = null;
119: this .pem_postFct = null;
120: this .pem_fct = new UnMenuFctWrapper(xFct);
121:
122: return;
123: };
124:
125: public Object pcmf_execObj(Object xObj) {
126: if (this .pcmf_isDisabled())
127: return (null);
128:
129: if (this .pem_postFct != null)
130: this .pem_postFct.pcmf_execObj(xObj);
131: if (this .pem_preFct != null)
132: this .pem_preFct.pcmf_execObj(xObj);
133: if (this .pem_fct != null)
134: this .pem_fct.pcmf_execObj(xObj);
135:
136: return (this );
137: }
138:
139: public int pcmf_getAccKey() {
140: return (this .pem_accCode);
141: }
142:
143: public void pcmf_setKeyAccess(int xKey) {
144: this .pem_accCode = xKey;
145:
146: if (pdm_session != null) {
147: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
148: "");
149:
150: if (this .pdm_session.pcmf_isInTransaction()) {
151: ScXmlScript.pcmf_createPBody(l_remCall);
152: } else {
153: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
154: ScXmlScript.pcmf_addProc(l_remCall, null);
155: }
156: ;
157: ScXmlScript.pcmf_addCall(l_remCall, null, this
158: .pcmf_getRemName(), "pcmf_setAdditionalInfo");
159: ScXmlScript
160: .pcmf_addCallPar(l_remCall, Character
161: .toString((char) xKey), "false",
162: "java.lang.Object");
163: ScXmlScript.pcmf_endAll(l_remCall);
164:
165: this.pdm_session.pcmf_call(l_remCall.toString(), this);
166: }
167: ;
168: };
169: }
|