01: /*
02: * The contents of this file are subject to the Mozilla Public License
03: * Version 1.1 (the "License"); you may not use this file except in
04: * compliance with the License. You may obtain a copy of the License at
05: * http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
09: * License for the specific language governing rights and limitations
10: * under the License.
11: *
12: * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
13: *
14: * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
15: * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
16: *
17: * Contributor(s):
18: * Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
19: *
20: * If you didn't download this code from the following link, you should check
21: * if you aren't using an obsolete version: http://www.isqlviewer.com
22: */
23: package org.isqlviewer.swing.action;
24:
25: import java.lang.reflect.Method;
26: import java.util.EventListener;
27: import java.util.EventObject;
28:
29: /**
30: * Class for storing event delegation information.
31: * <p>
32: * This class stores the essential information to reflect swing event information back to the appropriate listeners
33: * using the swing event manager.
34: *
35: * @author Mark A. Kobold <mkobold at isqlviewer dot com>
36: * @version 1.0
37: */
38: class EventTask {
39:
40: private Class<? extends EventListener> eventClass = null;
41: private String eventMethod = null;
42: private EventObject eventObject = null;
43:
44: public EventTask(Class<? extends EventListener> eventClass,
45: String eventMethod, EventObject eventObject) {
46:
47: this .eventClass = eventClass;
48: this .eventMethod = eventMethod;
49: this .eventObject = eventObject;
50: }
51:
52: public Class<? extends EventListener> getEventClass() {
53:
54: return eventClass;
55: }
56:
57: public String getEventMethod() {
58:
59: return eventMethod;
60: }
61:
62: public EventObject getEventObject() {
63:
64: return eventObject;
65: }
66:
67: public Method getMethod() {
68:
69: Class[] parameters = new Class[] { eventObject.getClass() };
70: try {
71: return eventClass.getMethod(eventMethod, parameters);
72: } catch (SecurityException error) {
73: error.printStackTrace();
74: } catch (NoSuchMethodException error) {
75: error.printStackTrace();
76: }
77: return null;
78: }
79: }
|