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 de.ug2t.channel.markup.html.renderer.*;
034: import de.ug2t.connector.*;
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.*;
037: import de.ug2t.unifiedGui.interfaces.*;
038:
039: class MuGenericMenuListener implements IUnGuiEventListener {
040: public void pcmf_execListener(UnComponent xParam) {
041: MuGenericMenu l_menu = (MuGenericMenu) xParam;
042: Object l_clicked = l_menu.pcmf_getValue();
043:
044: if (l_clicked instanceof UnMenuFunction) {
045: Object l_ret = ((UnMenuFunction) l_clicked)
046: .pcmf_execObj(xParam);
047: if (l_ret == null)
048: KeLog.pcmf_log("ug2t",
049: "calling disabled menuItem (no function executed): "
050: + l_clicked, this , KeLog.MESSAGE);
051: else
052: KeLog.pcmf_log("ug2t",
053: "calling menuItem: " + l_clicked, this ,
054: KeLog.MESSAGE);
055: }
056: ;
057:
058: return;
059: };
060: };
061:
062: public final class MuGenericMenu extends MuGenericComponent implements
063: IUnMenu, IKePoolable {
064: protected KeTreeNode pdm_root = null;
065: private IKeView pem_view = new HtmlMenuRenderer();
066: private static MuGenericMenuListener pem_stdListener = new MuGenericMenuListener();
067:
068: /**
069: * <p>
070: * Does...
071: * </p>
072: * <p>
073: *
074: * @return a Type with
075: * </p>
076: * <p>
077: * @param
078: * </p>
079: */
080: public MuGenericMenu(String xName, KeTreeNode xRoot,
081: ACoDataGetter xTplGetter, Object xTplName,
082: MuGenericApplication xAppl) throws Exception {
083: super (xName, xTplGetter, xTplName, xAppl);
084:
085: if (xRoot == null)
086: pdm_root = this ;
087: else
088: this .pdm_root = xRoot;
089:
090: this .pcmf_setBgColor(this .pdm_kit.getDEF_BG());
091:
092: this .pcmf_setView(pem_view);
093: this .pcmf_setValue(xName);
094: this .pcmf_addListener(pem_stdListener);
095: this .pcmf_setEventOnChange(true);
096: this .pcmf_setBgColor("#D8D8D8");
097:
098: pdm_root.pcmf_hideLevel(1);
099:
100: return;
101: };
102:
103: // @@
104:
105: public void pcmf_setValue(Object xObj) {
106: if (xObj instanceof KeTreeElement == false && xObj != null)
107: xObj = KeRegisteredObject
108: .pcmf_getObjByName(xObj.toString());
109:
110: pdm_Element = xObj;
111:
112: return;
113: };
114:
115: public KeTreeNode pcmf_getRoot() {
116: return (this .pdm_root);
117: }
118:
119: public void pcmf_commitMenu() {
120: pdm_root.pcmf_hideLevel(1);
121: this .pcmf_setPropChanged(true);
122:
123: return;
124: }
125:
126: public KeTreeNode pcmf_setRoot(KeTreeNode xRoot) {
127: if (xRoot == this .pdm_root)
128: return (xRoot);
129:
130: KeTreeNode l_node = this .pdm_root;
131: this .pdm_root = xRoot;
132:
133: this .pcmf_setPropChanged(true);
134:
135: return (l_node);
136: };
137:
138: public KeTreeNode pcmf_getToggled() {
139: return (null);
140: };
141:
142: public void pcmf_commitTree() {
143: this .pcmf_setPropChanged(true);
144:
145: return;
146: }
147:
148: public void pcmf_setMenuWidth(int xWi) {
149: if (this .pem_view instanceof HtmlJsMenuRenderer)
150: ((HtmlJsMenuRenderer) this .pem_view).pcmf_setMenuWidth(xWi);
151: }
152:
153: // @@
154: }
|