/**
* @author <a href="mailto:droden@gmail.com">David Roden </a>
- * @version $Id: Main.java 464 2006-04-04 21:53:33Z bombe $
+ * @version $Id$
*/
public class Main implements ActionListener, ListSelectionListener, WizardListener, NodeManagerListener {
private static boolean debug = false;
- private Configuration configuration = new Configuration();
+ private Configuration configuration;
private Freenet7Interface freenetInterface = new Freenet7Interface();
protected Icon jSiteIcon;
private final Map<PageType, TWizardPage> pages = new HashMap<PageType, TWizardPage>();
private Main() {
+ this(null);
+ }
+
+ private Main(String configFilename) {
+ if (configFilename != null) {
+ configuration = new Configuration(configFilename);
+ } else {
+ configuration = new Configuration();
+ }
Locale.setDefault(configuration.getLocale());
I18n.setLocale(configuration.getLocale());
if (!configuration.createLockFile()) {
manageNodeAction = new AbstractAction(I18n.getMessage("jsite.menu.nodes.manage-nodes")) {
public void actionPerformed(ActionEvent actionEvent) {
showPage(PageType.PAGE_NODE_MANAGER);
+ wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
+ wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
}
};
aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) {
((ProjectFilesPage) pages.get(PageType.PAGE_PROJECT_FILES)).setProject(project);
((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).setProject(project);
showPage(PageType.PAGE_PROJECT_FILES);
+ wizard.setNextName(I18n.getMessage("jsite.project-files.insert-now"));
wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
} else if ("page.project.files".equals(pageName)) {
ProjectPage projectPage = (ProjectPage) pages.get(PageType.PAGE_PROJECTS);
JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-node-running"), null, JOptionPane.ERROR_MESSAGE);
return;
}
+ configuration.save();
+ wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
showPage(PageType.PAGE_INSERT_PROJECT);
nodeMenu.setEnabled(false);
} else if ("page.project.insert".equals(pageName)) {
wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
} else if ("page.project.files".equals(pageName)) {
showPage(PageType.PAGE_PROJECTS);
+ wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
wizard.setPreviousName((String) manageNodeAction.getValue(Action.NAME));
} else if ("page.project.insert".equals(pageName)) {
showPage(PageType.PAGE_PROJECT_FILES);
//
// MAIN METHOD
//
-
public static void main(String[] args) {
- System.setProperty("swing.plaf.metal.userFont", "Tahoma");
- System.setProperty("swing.plaf.metal.controlFont", "Tahoma");
- System.setProperty("swing.aatext", "true");
- debug = (args.length > 0) && (args[0].equals("--debug"));
- new Main();
+ String configFilename = null;
+ boolean nextIsConfigFilename = false;
+ for (String argument: args) {
+ if (nextIsConfigFilename) {
+ configFilename = argument;
+ nextIsConfigFilename = false;
+ }
+ if ("--help".equals(argument)) {
+ printHelp();
+ return;
+ } else if ("--debug".equals(argument)) {
+ debug = true;
+ } else if ("--config-file".equals(argument)) {
+ nextIsConfigFilename = true;
+ }
+ }
+ if (nextIsConfigFilename) {
+ System.out.println("--config-file needs parameter!");
+ return;
+ }
+ new Main(configFilename);
}
+ private static void printHelp() {
+ System.out.println("--help\tshows this cruft");
+ System.out.println("--debug\tenables some debug output");
+ System.out.println("--config-file <file>\tuse specified configuration file");
+ }
+
}