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 de.ug2t.kernel.*;
034: import de.ug2t.unifiedGui.*;
035: import de.ug2t.unifiedGui.interfaces.*;
036: import de.ug2t.xmlScript.*;
037:
038: final class HoTreeMenuListener implements IUnGuiEventListener {
039: public void pcmf_execListener(UnComponent xParam) {
040: HoSrvGenericMenu l_menu = (HoSrvGenericMenu) xParam;
041: Object l_clicked = KeRegisteredObject.pcmf_getObjByName(l_menu
042: .toString());
043:
044: KeLog.pcmf_log("ug2t", "calling menuItem: " + l_clicked, this ,
045: KeLog.MESSAGE);
046:
047: if (l_clicked instanceof UnMenuFunction) {
048: ((UnMenuFunction) l_clicked).pcmf_execObj(xParam);
049: l_menu.pdm_active = (UnMenuFunction) l_clicked;
050: }
051: ;
052:
053: xParam.pcmf_setValue(l_clicked);
054:
055: return;
056: };
057: };
058:
059: public final class HoSrvGenericMenu extends AHoSrvGenericComponent
060: implements IUnMenu {
061: protected UnMenuFunction pdm_active;
062:
063: private KeTreeNode pem_root = null;
064:
065: public HoSrvGenericMenu(String xName, KeTreeNode xRoot,
066: IUnApplication xAppl, String xClass) throws Exception {
067: super (xName);
068: this .pcmf_setAppl(xAppl);
069: this .pcmf_setLocalValue("0");
070: this .pcmf_setEventOnChange(true);
071:
072: if (xRoot == null)
073: this .pem_root = this ;
074: else
075: this .pem_root = xRoot;
076:
077: if (xClass == null)
078: pdm_clientClass = "de.ug2t.channel.ho.client.swing.HoSwingMenu";
079: else
080: pdm_clientClass = xClass;
081:
082: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
083: "");
084: // Deklaration
085: if (this .pdm_session.pcmf_isInTransaction()) {
086: ScXmlScript.pcmf_createPBody(l_remCall);
087: } else {
088: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
089: ScXmlScript.pcmf_addProc(l_remCall, null);
090: }
091: ;
092: ScXmlScript.pcmf_addDecl(l_remCall, this .pcmf_getRemName(),
093: this .pdm_clientClass, "global");
094: ScXmlScript.pcmf_addDeclPar(l_remCall, xName, "false",
095: "java.lang.String");
096:
097: if (xRoot == null)
098: ScXmlScript.pcmf_addDeclPar(l_remCall, "null", "true",
099: "de.ug2t.kernel.KeTreeNode");
100: else
101: ScXmlScript.pcmf_addDeclPar(l_remCall, xRoot
102: .pcmf_getRemName(), "true",
103: "de.ug2t.kernel.KeTreeNode");
104:
105: ScXmlScript.pcmf_addDeclPar(l_remCall,
106: ((HoSrvGenericApplication) xAppl).pcmf_getRemName(),
107: "true", "de.ug2t.unifiedGui.interfaces.IUnApplication");
108: ScXmlScript.pcmf_endAll(l_remCall);
109:
110: this .pdm_session.pcmf_call(l_remCall.toString(), this );
111: this .pcmf_enableSubmit();
112:
113: this .pcmf_addListener(new HoTreeMenuListener());
114:
115: return;
116: };
117:
118: public AHoSrvGenericComponent pcmf_buildRefObj() throws Exception {
119: AHoSrvGenericComponent l_obj = new HoSrvGenericMenu(this
120: .pcmf_getName(), this .pem_root, this .pcmf_getAppl(),
121: this .pdm_clientClass);
122: if (this .pcmf_isSubmit() == false)
123: l_obj.pcmf_disableSubmit();
124:
125: l_obj.pcmf_setGlobal(true);
126: this .pcmf_setGlobal(true);
127: l_obj.pcmf_setAutoEcho(this .pcmf_doAutoEcho());
128: l_obj.pcmf_setRefFrom(this );
129: this .pcmf_addRef(l_obj);
130:
131: return (l_obj);
132: };
133:
134: public void pcmf_commitMenu() {
135: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
136: "");
137:
138: if (this .pdm_session.pcmf_isInTransaction()) {
139: ScXmlScript.pcmf_createPBody(l_remCall);
140: } else {
141: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
142: ScXmlScript.pcmf_addProc(l_remCall, null);
143: }
144: ;
145: ScXmlScript.pcmf_addCall(l_remCall, null, this
146: .pcmf_getRemName(), "pcmf_commitMenu");
147: ScXmlScript.pcmf_endAll(l_remCall);
148:
149: this .pdm_session.pcmf_call(l_remCall.toString(), this );
150:
151: return;
152: };
153:
154: public KeTreeNode pcmf_setRoot(KeTreeNode xRoot) {
155: KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper(
156: "");
157:
158: if (this .pdm_session.pcmf_isInTransaction()) {
159: ScXmlScript.pcmf_createPBody(l_remCall);
160: } else {
161: ScXmlScript.pcmf_createxScriptString(l_remCall, null);
162: ScXmlScript.pcmf_addProc(l_remCall, null);
163: }
164: ;
165: ScXmlScript.pcmf_addCall(l_remCall, null, this
166: .pcmf_getRemName(), "pcmf_setRoot");
167: ScXmlScript.pcmf_addCallPar(l_remCall, xRoot.pcmf_getRemName(),
168: "true", "de.ug2t.kernel.KeTreeNode");
169: ScXmlScript.pcmf_endAll(l_remCall);
170:
171: this .pdm_session.pcmf_call(l_remCall.toString(), this );
172:
173: KeTreeNode l_node = this .pem_root;
174: this .pem_root = xRoot;
175:
176: return (l_node);
177: };
178:
179: public void pcmf_setMenuWidth(int xWi) {
180: // Does nothing
181: KeLog.pcmf_log("ug2t", "pcmf_setMenuWidth is not implemented",
182: this, KeLog.DEBUG);
183: }
184: }
|