01: /*
02: * Copyright (C) 2005 Rob Manning
03: * manningr@users.sourceforge.net
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19: package net.sourceforge.squirrel_sql.plugins.mssql.gui;
20:
21: import java.awt.BorderLayout;
22: import java.awt.event.ActionEvent;
23: import java.awt.event.ActionListener;
24:
25: import javax.swing.JButton;
26: import javax.swing.JFrame;
27: import javax.swing.JPanel;
28: import javax.swing.JScrollPane;
29:
30: import net.sourceforge.squirrel_sql.client.ApplicationArguments;
31: import net.sourceforge.squirrel_sql.client.plugin.PluginQueryTokenizerPreferencesManager;
32: import net.sourceforge.squirrel_sql.client.plugin.gui.PluginQueryTokenizerPreferencesPanel;
33: import net.sourceforge.squirrel_sql.plugins.mssql.prefs.MSSQLPreferenceBean;
34: import net.sourceforge.squirrel_sql.plugins.mssql.prefs.PreferencesManager;
35: import net.sourceforge.squirrel_sql.plugins.oracle.gui.DummyPlugin;
36:
37: public class TestPreferencesPanel {
38:
39: /**
40: * @param args
41: */
42: public static void main(String[] args) throws Exception {
43: JFrame f = new JFrame();
44: f.getContentPane().setLayout(new BorderLayout());
45: ApplicationArguments.initialize(new String[0]);
46:
47: final PluginQueryTokenizerPreferencesManager prefsManager = new PluginQueryTokenizerPreferencesManager();
48: prefsManager.initialize(new DummyPlugin(),
49: new MSSQLPreferenceBean());
50: final PluginQueryTokenizerPreferencesPanel p = new PluginQueryTokenizerPreferencesPanel(
51: prefsManager, "MS SQL-Server", false);
52: JScrollPane sp = new JScrollPane(p);
53: f.getContentPane().add(sp, BorderLayout.CENTER);
54: JButton button = new JButton("Save");
55: button.addActionListener(new ActionListener() {
56: public void actionPerformed(ActionEvent e) {
57: p.applyChanges();
58: PreferencesManager.unload();
59: }
60: });
61: JButton exitButton = new JButton("Exit");
62: exitButton.addActionListener(new ActionListener() {
63: public void actionPerformed(ActionEvent e) {
64: System.exit(0);
65: }
66: });
67: JPanel buttonPanel = new JPanel();
68: buttonPanel.add(button);
69: buttonPanel.add(exitButton);
70: f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
71: f.setBounds(200, 50, 700, 700);
72: f.setVisible(true);
73: }
74:
75: }
|