01: package net.sourceforge.squirrel_sql.plugins.favs;
02:
03: /*
04: * Copyright (C) 2001 Colin Bell
05: * colbell@users.sourceforge.net
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21: import java.awt.BorderLayout;
22: import java.awt.Container;
23: import java.awt.Dimension;
24: import java.awt.Frame;
25:
26: import javax.swing.JDialog;
27: import javax.swing.JScrollPane;
28: import javax.swing.JSplitPane;
29:
30: import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
31: import net.sourceforge.squirrel_sql.fw.util.StringManager;
32: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
33: import net.sourceforge.squirrel_sql.client.IApplication;
34:
35: class OrganizeSavedQueriesDialog extends JDialog {
36:
37: private static final StringManager s_stringMgr = StringManagerFactory
38: .getStringManager(OrganizeSavedQueriesDialog.class);
39:
40: private IApplication _app;
41: private FoldersCache _cache;
42:
43: private JSplitPane _mainSplitPane = new JSplitPane();
44: private QueryTree _queryTree;// = new QueryTree();
45:
46: private static interface i18n {
47: // i18n[favs.savedQueries=Saved Queries]
48: String TITLE = s_stringMgr.getString("favs.savedQueries");
49: }
50:
51: public OrganizeSavedQueriesDialog(IApplication app,
52: FoldersCache cache, Frame owner)
53: throws IllegalArgumentException {
54: super (owner, i18n.TITLE, true);
55: if (app == null) {
56: throw new IllegalArgumentException(
57: "Null IApplication passed");
58: }
59: if (cache == null) {
60: throw new IllegalArgumentException(
61: "Null FoldersCache passed");
62: }
63:
64: _app = app;
65: _cache = cache;
66:
67: createUserInterface();
68: setDefaultCloseOperation(DISPOSE_ON_CLOSE);
69: }
70:
71: private void createUserInterface() {
72: final Container contentPane = getContentPane();
73: setVisible(false);
74:
75: _queryTree = new QueryTree(_app, _cache);
76:
77: _mainSplitPane.setOneTouchExpandable(true);
78: _mainSplitPane.setContinuousLayout(true);
79:
80: _queryTree.setPreferredSize(new Dimension(200, 200));
81: _mainSplitPane
82: .add(new JScrollPane(_queryTree), JSplitPane.LEFT);
83: // _mainSplitPane.add(getDesktopPane(), JSplitPane.RIGHT);
84:
85: contentPane.setLayout(new BorderLayout());
86: contentPane.add(_mainSplitPane, BorderLayout.CENTER);
87:
88: //setBounds(new Rectangle(600, 400));
89: pack();
90: GUIUtils.centerWithinParent(this );
91: setResizable(false);
92: }
93: }
|