1 | public class TestPreferencesPanel {↵ | | 1 | public class TestOraclePluginPreferencesPanel {↵
|
|
2 | /**↵ | | 2 | /**↵
|
3 | * @param args↵ | | 3 | * @param args↵
|
4 | */↵ | | 4 | */↵
|
5 | public static void main(String[] args) throws Exception {↵ | | 5 | public static void main(String[] args) throws Exception {↵
|
6 | JFrame f = new JFrame();↵ | | 6 | JFrame f = new JFrame();↵
|
| | | 7 | // TODO move to new standard location and rewrite test to be less static↵
|
7 | f.getContentPane().setLayout(new BorderLayout());↵ | | 8 | f.getContentPane().setLayout(new BorderLayout());↵
|
8 | ApplicationArguments.initialize(new String[0]);↵ | | 9 | ApplicationArguments.initialize(new String[0]);↵
|
9 | PreferencesManager.initialize(new DummyPlugin());↵ | | 10 | ↵
|
10 | DBCopyPreferenceBean bean = PreferencesManager.get↵ | | 11 | final PluginQueryTokenizerPreferencesManager prefsManager = ↵
|
| | | 12 | new PluginQueryTokenizerPreferencesManager();↵
|
11 | Preferences();↵ | | 13 | prefsManager.initialize(new DummyPlugin(), new OraclePreferenceBean());↵
|
12 | final PreferencesPanel p = new ↵ | | 14 | final PluginQueryTokenizerPreferencesPanel p = ↵
|
13 | PreferencesPanel(bean);↵ | | 15 | new OraclePluginPreferencesPanel(prefsManager);↵
|
14 | JScrollPane sp = new JScrollPane(p);↵ | | 16 | JScrollPane sp = new JScrollPane(p);↵
|
15 | f.getContentPane().add(sp, BorderLayout.CENTER);↵ | | 17 | f.getContentPane().add(sp, BorderLayout.CENTER);↵
|
16 | JButton button = new JButton("Save");↵ | | 18 | JButton button = new JButton("Save");↵
|
17 | button.addActionListener(new ActionListener() {↵ | | 19 | button.addActionListener(new ActionListener() {↵
|
18 | public void actionPerformed(ActionEvent e) {↵ | | 20 | public void actionPerformed(ActionEvent e) {↵
|
19 | p.applyChanges();↵ | | 21 | p.applyChanges();↵
|
20 | PreferencesManager.unload();↵ | | 22 | prefsManager.unload();↵
|
21 | }↵ | | 23 | }↵
|
22 | });↵ | | 24 | });↵
|
23 | JButton exitButton = new JButton("Exit");↵ | | 25 | JButton exitButton = new JButton("Exit");↵
|
24 | exitButton.addActionListener(new ActionListener() {↵ | | 26 | exitButton.addActionListener(new ActionListener() {↵
|
25 | public void actionPerformed(ActionEvent e) {↵ | | 27 | public void actionPerformed(ActionEvent e) {↵
|
26 | System.exit(0);↵ | | 28 | System.exit(0);↵
|
27 | }↵ | | 29 | }↵
|
28 | });↵ | | 30 | });↵
|
29 | JPanel buttonPanel = new JPanel();↵ | | 31 | JPanel buttonPanel = new JPanel();↵
|
30 | buttonPanel.add(button);↵ | | 32 | buttonPanel.add(button);↵
|
31 | buttonPanel.add(exitButton);↵ | | 33 | buttonPanel.add(exitButton);↵
|
32 | f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);↵ | | 34 | f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);↵
|
33 | f.setBounds(200, 50,700, 700);↵ | | 35 | f.setBounds(200, 50,700, 700);↵
|
34 | f.setVisible(true) | | 36 | f.setVisible(true)
|