01: // @@
02: // @@
03: /*
04: * Wi.Ser Framework
05: *
06: * Version: 1.8.1, 20-September-2007
07: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library located in LGPL.txt in the
21: * license directory; if not, write to the
22: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23: * Boston, MA 02111-1307, USA.
24: *
25: * If this agreement does not cover your requirements, please contact us
26: * via email to get detailed information about the commercial license
27: * or our service offerings!
28: *
29: */
30: // @@
31: package de.ug2t.unifiedGui.listener;
32:
33: import de.ug2t.kernel.*;
34: import de.ug2t.unifiedGui.*;
35: import de.ug2t.unifiedGui.interfaces.*;
36:
37: public class UnObjRemoveListener implements IUnGuiEventListener {
38: private String pem_parent;
39: private String pem_child;
40: private boolean pem_useReg;
41:
42: public UnObjRemoveListener(String xParent, String xChild,
43: boolean xUseRegistry) {
44: this .pem_parent = xParent;
45: this .pem_child = xChild;
46: this .pem_useReg = xUseRegistry;
47:
48: return;
49: }
50:
51: public UnObjRemoveListener(String xParent, String xChild) {
52: this .pem_parent = xParent;
53: this .pem_child = xChild;
54: this .pem_useReg = true;
55:
56: return;
57: }
58:
59: public UnObjRemoveListener(String xParent) {
60: this .pem_parent = xParent;
61: this .pem_child = null;
62: this .pem_useReg = true;
63:
64: return;
65: }
66:
67: public void pcmf_execListener(UnComponent xParam) throws Exception {
68: UnComponent l_parent;
69: UnComponent l_child;
70:
71: if (this .pem_useReg) {
72: l_parent = (UnComponent) KeRegisteredObject
73: .pcmf_getObjByName(pem_parent);
74: l_child = (UnComponent) KeRegisteredObject
75: .pcmf_getObjByName(pem_child);
76: } else {
77: l_parent = (UnComponent) xParam.pcmf_getAppl()
78: .pcmf_getUnComponent().pcmf_getByPath(pem_parent);
79: l_child = (UnComponent) xParam.pcmf_getAppl()
80: .pcmf_getUnComponent().pcmf_getByPath(pem_child);
81: }
82: if (l_parent != null && l_child != null)
83: l_parent.pcmf_removeNode(l_child.pcmf_getName());
84: else if (l_parent != null && l_child == null)
85: l_parent.pcmf_removeNode(((UnComponent) l_parent
86: .pcmf_getAllSubs().get(0)).pcmf_getName());
87: else
88: KeLog.pcmf_log(xParam.pcmf_getAppl().pcmf_getUnComponent()
89: .pcmf_getName(), "cannot find parent or child: "
90: + pem_parent + ", " + pem_child, this, KeLog.ERROR);
91: }
92: }
|