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.oracle.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.oracle.prefs.OraclePluginPreferencesPanel;
34: import net.sourceforge.squirrel_sql.plugins.oracle.prefs.OraclePreferenceBean;
35:
36: public class TestOraclePluginPreferencesPanel {
37:
38: /**
39: * @param args
40: */
41: public static void main(String[] args) throws Exception {
42: JFrame f = new JFrame();
43: // TODO move to new standard location and rewrite test to be less static
44: f.getContentPane().setLayout(new BorderLayout());
45: ApplicationArguments.initialize(new String[0]);
46: final PluginQueryTokenizerPreferencesManager prefsManager = new PluginQueryTokenizerPreferencesManager();
47: prefsManager.initialize(new DummyPlugin(),
48: new OraclePreferenceBean());
49: final PluginQueryTokenizerPreferencesPanel p = new OraclePluginPreferencesPanel(
50: prefsManager);
51: JScrollPane sp = new JScrollPane(p);
52: f.getContentPane().add(sp, BorderLayout.CENTER);
53: JButton button = new JButton("Save");
54: button.addActionListener(new ActionListener() {
55: public void actionPerformed(ActionEvent e) {
56: p.applyChanges();
57: prefsManager.unload();
58: }
59: });
60: JButton exitButton = new JButton("Exit");
61: exitButton.addActionListener(new ActionListener() {
62: public void actionPerformed(ActionEvent e) {
63: System.exit(0);
64: }
65: });
66: JPanel buttonPanel = new JPanel();
67: buttonPanel.add(button);
68: buttonPanel.add(exitButton);
69: f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
70: f.setBounds(200, 50, 700, 700);
71: f.setVisible(true);
72:
73: }
74:
75: }
|