01: package net.sourceforge.squirrel_sql.client.session.event;
02:
03: /*
04: * Copyright (C) 2003-2004 Colin Bell
05: * colbell@users.sourceforge.net
06: *
07: * Modifications Copyright (C) 2003-2004 Jason Height
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.1 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; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: */
23: import java.util.EventObject;
24:
25: import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
26: import net.sourceforge.squirrel_sql.client.session.ISession;
27: import net.sourceforge.squirrel_sql.client.session.mainpanel.SQLPanel;
28:
29: /**
30: * This class is an event fired for SQLPanel events.
31: *
32: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
33: */
34: public class SQLPanelEvent extends EventObject {
35: /** The session. */
36: private final ISession _session;
37:
38: /**
39: * Ctor.
40: *
41: * @param session The session this is occuring in.
42: * @param source The <CODE>SQLPanel</CODE> that change has happened to.
43: *
44: * @throws IllegalArgumentException
45: * Thrown if <TT>null</TT> <TT>ISession</TT> or <TT>SQLPanel/TT>
46: * passed.
47: */
48: public SQLPanelEvent(ISession session, SQLPanel source) {
49: super (checkParams(session, source));
50: _session = session;
51: }
52:
53: /**
54: * Return the <CODE>ISession</CODE>.
55: */
56: public ISession getSession() {
57: return _session;
58: }
59:
60: /**
61: * Retrieve the SQL panel that thsi event is associated with.
62: *
63: * @return The SQL panel this event is associated with.
64: */
65: public ISQLPanelAPI getSQLPanel() {
66: return ((SQLPanel) getSource()).getSQLPanelAPI();
67: }
68:
69: private static SQLPanel checkParams(ISession session,
70: SQLPanel source) {
71: if (session == null) {
72: throw new IllegalArgumentException("ISession == null");
73: }
74: if (source == null) {
75: throw new IllegalArgumentException("SQLPanel == null");
76: }
77: return source;
78: }
79: }
|