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.awt.event.*;
034:
035: import javax.swing.*;
036:
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.interfaces.*;
039: import de.ug2t.unifiedGui.views.*;
040:
041: final class HoSwingEnhJMenuItem extends JMenuItem {
042: protected KeTreeNode pdm_myNode;
043: protected IUnMenu pdm_menu;
044:
045: public HoSwingEnhJMenuItem(String xName, KeTreeNode xNode,
046: IUnMenu xMenu) {
047: super (xName);
048:
049: if (xNode.pcmf_getValue() instanceof HoSwingImage)
050: super
051: .setIcon(((JLabel) ((HoSwingImage) xNode
052: .pcmf_getValue()).pcmf_getRealSwingObj())
053: .getIcon());
054: else {
055: UnIconValueView l_view = (UnIconValueView) xNode
056: .pcmf_getView();
057: if (l_view != null)
058: l_view.pcmf_applyStdView(this );
059: }
060: this .pdm_myNode = xNode;
061: this .pdm_menu = xMenu;
062:
063: if (xNode.pcmf_isDisabled() == true)
064: super .setEnabled(false);
065:
066: ActionListener l = new ActionListener() {
067: public void actionPerformed(ActionEvent ev) {
068: try {
069: String l_objName = HoSwingEnhJMenuItem.this .pdm_menu
070: .pcmf_getUnComponent().pcmf_getObjName();
071:
072: // Lokale Listener aufrufen
073: HoSwingEnhJMenuItem.this .pdm_menu
074: .pcmf_getUnComponent().pcmf_setValue(
075: HoSwingEnhJMenuItem.this .pdm_myNode
076: .pcmf_getObjName());
077: HoSwingEnhJMenuItem.this .pdm_menu
078: .pcmf_getUnComponent().pcmf_setRefresh();
079: HoSwingEnhJMenuItem.this .pdm_menu
080: .pcmf_getUnComponent().pcmf_dispatchEvent();
081:
082: // Werte setzen um diese zum Server zu übertragen
083: ((HoSwingPage) HoSwingEnhJMenuItem.this .pdm_menu
084: .pcmf_getUnComponent().pcmf_getAppl()
085: .pcmf_getActive()).pcmf_setSubmitValue(
086: l_objName,
087: HoSwingEnhJMenuItem.this .pdm_myNode
088: .pcmf_getObjName());
089: if (HoSwingEnhJMenuItem.this .pdm_menu
090: .pcmf_getUnComponent().pcmf_isSubmit() == true)
091: ((HoSwingPage) HoSwingEnhJMenuItem.this .pdm_menu
092: .pcmf_getUnComponent().pcmf_getAppl()
093: .pcmf_getActive()).pcmf_submit();
094: } catch (Exception e) {
095: KeLog.pcmf_logException("ug2t", this, e);
096: }
097: ;
098: };
099: };
100:
101: this.addActionListener(l);
102: };
103: };
|