01: package net.sourceforge.squirrel_sql.client.session.action;
02:
03: /*
04: * Copyright (C) 2003-2004 Maury Hammel
05: *
06: * Modifications Copyright (C) 2003-2004 Jason Height
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation; either
11: * version 2.1 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public
19: * License along with this library; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: */
22: import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
23: import net.sourceforge.squirrel_sql.fw.util.ICommand;
24:
25: import net.sourceforge.squirrel_sql.client.IApplication;
26: import net.sourceforge.squirrel_sql.client.gui.WindowManager;
27: import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
28:
29: /**
30: * This <CODE>ICommand</CODE> displays a dialog box that allows the user to
31: * enter a 'where' clause or an 'order by' clause used when getting data via
32: * the 'Contents' tab.
33: *
34: * Adapted from EditWhereColsCommand.java by Maury Hammel
35: *
36: * @author <A HREF="mailto:mjhammel@users.sourceforge.net">Maury Hammel</A>
37: */
38: public class EditWhereColsCommand implements ICommand {
39: /** Application API. */
40: final IApplication _app;
41:
42: /** The object treeidentifying the table for us to limit the columns. */
43: private final IObjectTreeAPI _tree;
44:
45: /**
46: * A variable to contain a reference to the list of database objects and
47: * information about them.
48: */
49: private final IDatabaseObjectInfo _objectInfo;
50:
51: public EditWhereColsCommand(IApplication app, IObjectTreeAPI tree,
52: IDatabaseObjectInfo objectInfo) {
53: super ();
54: if (app == null) {
55: throw new IllegalArgumentException("IApplication == null");
56: }
57: if (tree == null) {
58: throw new IllegalArgumentException("IObjectTreeAPI == null");
59: }
60: if (objectInfo == null) {
61: throw new IllegalArgumentException(
62: "IDatabaseObjectInfo == null");
63: }
64: _app = app;
65: _tree = tree;
66: _objectInfo = objectInfo;
67: }
68:
69: /**
70: * Display thedialog.
71: */
72: public void execute() {
73: if (_tree != null) {
74: final WindowManager winMgr = _app.getWindowManager();
75: winMgr.showEditWhereColsDialog(_tree, _objectInfo);
76: }
77: }
78: }
|