Add stub for creating the preferences panel.
[jSite.git] / src / de / todesbaum / jsite / gui / PreferencesPage.java
1 /*
2  * jSite - PreferencesPage.java -
3  * Copyright © 2009 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package de.todesbaum.jsite.gui;
21
22 import java.awt.BorderLayout;
23 import java.awt.event.ActionEvent;
24
25 import javax.swing.AbstractAction;
26 import javax.swing.Action;
27 import javax.swing.JPanel;
28
29 import de.todesbaum.jsite.i18n.I18n;
30 import de.todesbaum.jsite.i18n.I18nContainer;
31 import de.todesbaum.util.swing.TWizard;
32 import de.todesbaum.util.swing.TWizardPage;
33
34 /**
35  * Page that shows some preferences that are valid for the complete application.
36  *
37  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
38  */
39 public class PreferencesPage extends TWizardPage {
40
41         /** Action that chooses a new temp directory. */
42         private Action chooseTempDirectoryAction;
43
44         /**
45          * Creates a new “preferences” page.
46          *
47          * @param wizard
48          *            The wizard this page belongs to
49          */
50         public PreferencesPage(TWizard wizard) {
51                 super(wizard);
52                 pageInit();
53                 setHeading(I18n.getMessage("jsite.preferences.heading"));
54                 setDescription(I18n.getMessage("jsite.preferences.description"));
55                 I18nContainer.getInstance().registerRunnable(new Runnable() {
56
57                         /**
58                          * {@inheritDoc}
59                          */
60                         @Override
61                         public void run() {
62                                 setHeading(I18n.getMessage("jsite.preferences.heading"));
63                                 setDescription(I18n.getMessage("jsite.preferences.description"));
64                         }
65                 });
66         }
67
68         /**
69          * Initializes this page.
70          */
71         private void pageInit() {
72                 createActions();
73                 setLayout(new BorderLayout(12, 12));
74                 add(createPreferencesPanel(), BorderLayout.CENTER);
75         }
76
77         /**
78          * Creates all actions.
79          */
80         private void createActions() {
81                 chooseTempDirectoryAction = new AbstractAction(I18n.getMessage("jsite.preferences.choose-temp-directory")) {
82
83                         @Override
84                         @SuppressWarnings("synthetic-access")
85                         public void actionPerformed(ActionEvent e) {
86                                 chooseTempDirectory();
87                         }
88                 };
89
90                 I18nContainer.getInstance().registerRunnable(new Runnable() {
91
92                         @Override
93                         @SuppressWarnings("synthetic-access")
94                         public void run() {
95                                 chooseTempDirectoryAction.putValue(Action.NAME, I18n.getMessage("jsite.preferences.choose-temp-directory"));
96                         }
97                 });
98         }
99
100         /**
101          * Creates the panel containing all preferences.
102          *
103          * @return The preferences panel
104          */
105         private JPanel createPreferencesPanel() {
106                 JPanel preferencesPanel = new JPanel(new BorderLayout(12, 12));
107                 return preferencesPanel;
108         }
109
110         /**
111          * Lets the user choose a new temp directory.
112          */
113         private void chooseTempDirectory() {
114                 /* TODO */
115         }
116
117 }