01: package net.sourceforge.squirrel_sql.client.session.action;
02:
03: /*
04: * Copyright (C) 2003-2004 Maury Hammel
05: * mjhammel@users.sourceforge.net
06: *
07: * Adapted from SessionPropertiesCommand.java by Colin Bell.
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 net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
24: import net.sourceforge.squirrel_sql.fw.util.ICommand;
25:
26: import net.sourceforge.squirrel_sql.client.IApplication;
27: import net.sourceforge.squirrel_sql.client.gui.WindowManager;
28: import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
29: import net.sourceforge.squirrel_sql.client.session.ISession;
30:
31: /**
32: * This <CODE>ICommand</CODE> displays a dialog box that allows the user to
33: * enter a 'where' clause or an 'order by' clause used when getting data via
34: * the 'Contents' tab.
35: *
36: * @author <A HREF="mailto:mjhammel@users.sourceforge.net">Maury Hammel</A>
37: *
38: * TODO: Change name to ContentsTabFilterCommand
39: */
40: public class SQLFilterCommand implements ICommand {
41: /** The object tree containing the object tto be filtered. */
42: private final IObjectTreeAPI _objectTree;
43:
44: /** The object we are filtering. */
45: private final IDatabaseObjectInfo _objectInfo;
46:
47: /**
48: * Creates a new instance of SQLFilterCommand.
49: *
50: * @param objectTree The object tree containing the table we are
51: * filtering
52: * @param objectInfo The table to be filtered.
53: */
54: public SQLFilterCommand(IObjectTreeAPI objectTree,
55: IDatabaseObjectInfo objectInfo) {
56: super ();
57: if (objectInfo == null) {
58: throw new IllegalArgumentException(
59: "Null IDatabaseObjectInfo passed");
60: }
61: if (objectTree == null) {
62: throw new IllegalArgumentException(
63: "Null IObjectTreeAPI passed");
64: }
65: _objectTree = objectTree;
66: _objectInfo = objectInfo;
67: }
68:
69: /**
70: * Display the SQL Filter dialog.
71: */
72: public void execute() {
73: if (_objectTree != null) {
74: final ISession session = _objectTree.getSession();
75: final IApplication app = session.getApplication();
76: final WindowManager winMgr = app.getWindowManager();
77: winMgr.showSQLFilterDialog(_objectTree, _objectInfo);
78: }
79: }
80: }
|