--- /dev/null
+/*
+ * jSite - PreferencesPage.java -
+ * Copyright © 2009 David Roden
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package de.todesbaum.jsite.gui;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
+import de.todesbaum.util.swing.TWizard;
+import de.todesbaum.util.swing.TWizardPage;
+
+/**
+ * Page that shows some preferences that are valid for the complete application.
+ *
+ * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
+ */
+public class PreferencesPage extends TWizardPage {
+
+ /** Action that chooses a new temp directory. */
+ private Action chooseTempDirectoryAction;
+
+ /**
+ * Creates a new “preferences” page.
+ *
+ * @param wizard
+ * The wizard this page belongs to
+ */
+ public PreferencesPage(TWizard wizard) {
+ super(wizard);
+ pageInit();
+ setHeading(I18n.getMessage("jsite.preferences.heading"));
+ setDescription(I18n.getMessage("jsite.preferences.description"));
+ I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ setHeading(I18n.getMessage("jsite.preferences.heading"));
+ setDescription(I18n.getMessage("jsite.preferences.description"));
+ }
+ });
+ }
+
+ /**
+ * Initializes this page.
+ */
+ private void pageInit() {
+ createActions();
+ }
+
+ /**
+ * Creates all actions.
+ */
+ private void createActions() {
+ chooseTempDirectoryAction = new AbstractAction(I18n.getMessage("jsite.preferences.choose-temp-directory")) {
+
+ @Override
+ @SuppressWarnings("synthetic-access")
+ public void actionPerformed(ActionEvent e) {
+ chooseTempDirectory();
+ }
+ };
+
+ I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+ @Override
+ @SuppressWarnings("synthetic-access")
+ public void run() {
+ chooseTempDirectoryAction.putValue(Action.NAME, I18n.getMessage("jsite.preferences.choose-temp-directory"));
+ }
+ });
+ }
+
+ /**
+ * Lets the user choose a new temp directory.
+ */
+ private void chooseTempDirectory() {
+ /* TODO */
+ }
+
+}
import de.todesbaum.jsite.application.UpdateListener;
import de.todesbaum.jsite.gui.NodeManagerListener;
import de.todesbaum.jsite.gui.NodeManagerPage;
+import de.todesbaum.jsite.gui.PreferencesPage;
import de.todesbaum.jsite.gui.ProjectFilesPage;
import de.todesbaum.jsite.gui.ProjectInsertPage;
import de.todesbaum.jsite.gui.ProjectPage;
PAGE_PROJECT_FILES,
/** The project insert page. */
- PAGE_INSERT_PROJECT
+ PAGE_INSERT_PROJECT,
+
+ /** The preferences page. */
+ PAGE_PREFERENCES
}
projectInsertPage.setName("page.project.insert");
projectInsertPage.setFreenetInterface(freenetInterface);
pages.put(PageType.PAGE_INSERT_PROJECT, projectInsertPage);
+
+ PreferencesPage preferencesPage = new PreferencesPage(wizard);
+ preferencesPage.setName("page.preferences");
+ pages.put(PageType.PAGE_PREFERENCES, preferencesPage);
}
/**
* Shows a dialog with general preferences.
*/
private void optionsPreferences() {
-
+ showPage(PageType.PAGE_PREFERENCES);
}
/**