version 0.4.9.3: 0.4.9.3
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 5 Oct 2007 17:08:00 +0000 (17:08 +0000)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 5 Oct 2007 17:08:00 +0000 (17:08 +0000)
change language on-the-fly
add missing french translations

src/de/todesbaum/jsite/gui/NodeManagerPage.java
src/de/todesbaum/jsite/gui/ProjectFilesPage.java
src/de/todesbaum/jsite/gui/ProjectInsertPage.java
src/de/todesbaum/jsite/gui/ProjectPage.java
src/de/todesbaum/jsite/i18n/I18n.java
src/de/todesbaum/jsite/i18n/I18nContainer.java [new file with mode: 0644]
src/de/todesbaum/jsite/i18n/jSite_fr.properties
src/de/todesbaum/jsite/main/Main.java
src/de/todesbaum/jsite/main/Version.java
src/de/todesbaum/util/swing/TWizardPage.java

index 2c23dc5..9418b67 100644 (file)
@@ -55,6 +55,7 @@ import javax.swing.text.Document;
 
 import de.todesbaum.jsite.application.Node;
 import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.swing.TLabel;
 import de.todesbaum.util.swing.TWizard;
 import de.todesbaum.util.swing.TWizardPage;
@@ -66,21 +67,27 @@ import de.todesbaum.util.swing.TWizardPage;
 public class NodeManagerPage extends TWizardPage implements ListSelectionListener, DocumentListener, ChangeListener {
 
        private List<NodeManagerListener> nodeManagerListeners = new ArrayList<NodeManagerListener>();
-       private TWizard wizard;
 
-       private Action addNodeAction;
-       private Action deleteNodeAction;
+       protected Action addNodeAction;
+       protected Action deleteNodeAction;
        private DefaultListModel nodeListModel;
        private JList nodeList;
        private JTextField nodeNameTextField;
        private JTextField nodeHostnameTextField;
        private JSpinner nodePortSpinner;
 
-       public NodeManagerPage() {
-               super();
+       public NodeManagerPage(final TWizard wizard) {
+               super(wizard);
                pageInit();
                setHeading(I18n.getMessage("jsite.node-manager.heading"));
                setDescription(I18n.getMessage("jsite.node-manager.description"));
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               setHeading(I18n.getMessage("jsite.node-manager.heading"));
+                               setDescription(I18n.getMessage("jsite.node-manager.description"));
+                       }
+               });
        }
        
        public void addNodeManagerListener(NodeManagerListener nodeManagerListener) {
@@ -112,6 +119,14 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene
                        }
                };
                deleteNodeAction.setEnabled(false);
+
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               addNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.node-manager.add-node"));
+                               deleteNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.node-manager.delete-node"));
+                       }
+               });
        }
 
        private void pageInit() {
@@ -147,17 +162,31 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene
                JPanel nodeInformationPanel = new JPanel(new GridBagLayout());
                centerPanel.add(nodeInformationPanel, BorderLayout.PAGE_START);
                nodeInformationPanel.add(buttonPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
-               nodeInformationPanel.add(new JLabel("<html><b>" + I18n.getMessage("jsite.node-manager.node-information") + "</b></html>"), new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 0, 0, 0), 0, 0));
-               nodeInformationPanel.add(new TLabel(I18n.getMessage("jsite.node-manager.name"), KeyEvent.VK_N, nodeNameTextField), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final JLabel nodeInformationLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.node-manager.node-information") + "</b></html>");
+               nodeInformationPanel.add(nodeInformationLabel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 0, 0, 0), 0, 0));
+               final TLabel nodeNameLabel = new TLabel(I18n.getMessage("jsite.node-manager.name") + ":", KeyEvent.VK_N, nodeNameTextField);
+               nodeInformationPanel.add(nodeNameLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                nodeInformationPanel.add(nodeNameTextField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
-               nodeInformationPanel.add(new TLabel(I18n.getMessage("jsite.node-manager.hostname"), KeyEvent.VK_H, nodeHostnameTextField), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel nodeHostnameLabel = new TLabel(I18n.getMessage("jsite.node-manager.hostname") + ":", KeyEvent.VK_H, nodeHostnameTextField);
+               nodeInformationPanel.add(nodeHostnameLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                nodeInformationPanel.add(nodeHostnameTextField, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
-               nodeInformationPanel.add(new TLabel(I18n.getMessage("jsite.node-manager.port"), KeyEvent.VK_P, nodePortSpinner), new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel nodePortLabel = new TLabel(I18n.getMessage("jsite.node-manager.port") + ":", KeyEvent.VK_P, nodePortSpinner);
+               nodeInformationPanel.add(nodePortLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                nodeInformationPanel.add(nodePortSpinner, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
 
                setLayout(new BorderLayout(12, 12));
                add(new JScrollPane(nodeList), BorderLayout.LINE_START);
                add(centerPanel, BorderLayout.CENTER);
+
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               nodeInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.node-manager.node-information") + "</b></html>");
+                               nodeNameLabel.setText(I18n.getMessage("jsite.node-manager.name") + ":");
+                               nodeHostnameLabel.setText(I18n.getMessage("jsite.node-manager.hostname") + ":");
+                               nodePortLabel.setText(I18n.getMessage("jsite.node-manager.port") + ":");
+                       }
+               });
        }
        
        /**
@@ -165,8 +194,10 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene
         */
        @Override
        public void pageAdded(TWizard wizard) {
-               this.wizard = wizard;
-               wizard.setNextEnabled(nodeListModel.getSize() > 0);
+               this.wizard.setNextEnabled(nodeListModel.getSize() > 0);
+               this.wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
+               this.wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
+               this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
        }
 
        public void setNodes(Node[] nodes) {
index c1a8eae..d8bac9c 100644 (file)
@@ -64,6 +64,7 @@ import javax.swing.text.Document;
 import de.todesbaum.jsite.application.FileOption;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.mime.DefaultMIMETypes;
 import de.todesbaum.util.swing.TLabel;
 import de.todesbaum.util.swing.TWizard;
@@ -75,14 +76,12 @@ import de.todesbaum.util.swing.TWizardPage;
  */
 public class ProjectFilesPage extends TWizardPage implements ActionListener, ListSelectionListener, DocumentListener, FileScannerListener, ChangeListener {
 
-       protected TWizard wizard;
-
        protected Project project;
 
-       private Action scanAction;
-       private Action editContainerAction;
-       private Action addContainerAction;
-       private Action deleteContainerAction;
+       protected Action scanAction;
+       protected Action editContainerAction;
+       protected Action addContainerAction;
+       protected Action deleteContainerAction;
 
        protected JList projectFileList;
        private JCheckBox defaultFileCheckBox;
@@ -94,8 +93,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
        private JSpinner replaceEditionRangeSpinner;
        private JCheckBox replacementCheckBox;
 
-       public ProjectFilesPage() {
-               super();
+       public ProjectFilesPage(final TWizard wizard) {
+               super(wizard);
                pageInit();
        }
 
@@ -141,12 +140,28 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                };
                deleteContainerAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project-files.action.delete-container.tooltip"));
                deleteContainerAction.setEnabled(false);
+
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               scanAction.putValue(Action.NAME, I18n.getMessage("jsite.project-files.action.rescan"));
+                               scanAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project-files.action.rescan.tooltip"));
+                               addContainerAction.putValue(Action.NAME, I18n.getMessage("jsite.project-files.action.add-container"));
+                               addContainerAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project-files.action.add-container.tooltip"));
+                               editContainerAction.putValue(Action.NAME, I18n.getMessage("jsite.project-files.action.edit-container"));
+                               editContainerAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project-files.action.edit-container.tooltip"));
+                               deleteContainerAction.putValue(Action.NAME, I18n.getMessage("jsite.project-files.action.delete-container"));
+                               deleteContainerAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project-files.action.delete-container.tooltip"));
+                       }
+               });
        }
 
        @Override
        public void pageAdded(TWizard wizard) {
-               this.wizard = wizard;
                actionScan();
+               this.wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
+               this.wizard.setNextName(I18n.getMessage("jsite.project-files.insert-now"));
+               this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
        }
 
        private JComponent createProjectFilesPanel() {
@@ -166,7 +181,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
 
                fileOptionsPanel.add(new JButton(scanAction), new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
 
-               fileOptionsPanel.add(new JLabel("<html><b>" + I18n.getMessage("jsite.project-files.file-options") + "</b></html>"), new GridBagConstraints(0, 1, 5, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
+               final JLabel fileOptionsLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project-files.file-options") + "</b></html>");
+               fileOptionsPanel.add(fileOptionsLabel, new GridBagConstraints(0, 1, 5, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
 
                defaultFileCheckBox = new JCheckBox(I18n.getMessage("jsite.project-files.default"));
                defaultFileCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.default.tooltip"));
@@ -190,7 +206,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                fileOptionsCustomKeyTextField.setEnabled(false);
                fileOptionsCustomKeyTextField.getDocument().addDocumentListener(this);
 
-               fileOptionsPanel.add(new TLabel(I18n.getMessage("jsite.project-files.custom-key"), KeyEvent.VK_K, fileOptionsCustomKeyTextField), new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel customKeyLabel = new TLabel(I18n.getMessage("jsite.project-files.custom-key") + ":", KeyEvent.VK_K, fileOptionsCustomKeyTextField);
+               fileOptionsPanel.add(customKeyLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                fileOptionsPanel.add(fileOptionsCustomKeyTextField, new GridBagConstraints(1, 4, 4, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                fileOptionsMIMETypeComboBox = new JComboBox(DefaultMIMETypes.getAllMIMETypes());
@@ -199,7 +216,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                fileOptionsMIMETypeComboBox.addActionListener(this);
                fileOptionsMIMETypeComboBox.setEnabled(false);
 
-               fileOptionsPanel.add(new TLabel(I18n.getMessage("jsite.project-files.mime-type"), KeyEvent.VK_M, fileOptionsMIMETypeComboBox), new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel mimeTypeLabel = new TLabel(I18n.getMessage("jsite.project-files.mime-type") + ":", KeyEvent.VK_M, fileOptionsMIMETypeComboBox);
+               fileOptionsPanel.add(mimeTypeLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                fileOptionsPanel.add(fileOptionsMIMETypeComboBox, new GridBagConstraints(1, 5, 4, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                containerComboBoxModel = new DefaultComboBoxModel();
@@ -209,7 +227,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                fileOptionsContainerComboBox.addActionListener(this);
                fileOptionsContainerComboBox.setEnabled(false);
 
-               fileOptionsPanel.add(new TLabel(I18n.getMessage("jsite.project-files.container"), KeyEvent.VK_C, fileOptionsContainerComboBox), new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel containerLabel = new TLabel(I18n.getMessage("jsite.project-files.container") + ":", KeyEvent.VK_C, fileOptionsContainerComboBox);
+               fileOptionsPanel.add(containerLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                fileOptionsPanel.add(fileOptionsContainerComboBox, new GridBagConstraints(1, 6, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                fileOptionsPanel.add(new JButton(addContainerAction), new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                fileOptionsPanel.add(new JButton(editContainerAction), new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
@@ -230,18 +249,47 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                replaceEditionRangeSpinner.setToolTipText(I18n.getMessage("jsite.project-files.replacement.edition-range.tooltip"));
                replaceEditionRangeSpinner.addChangeListener(this);
                replaceEditionRangeSpinner.setEnabled(false);
-               fileOptionsReplacementPanel.add(new JLabel(I18n.getMessage("jsite.project-files.replacement.edition-range")));
+               final JLabel editionRangeLabel = new JLabel(I18n.getMessage("jsite.project-files.replacement.edition-range"));
+               fileOptionsReplacementPanel.add(editionRangeLabel);
                fileOptionsReplacementPanel.add(replaceEditionRangeSpinner);
 
                fileOptionsPanel.add(fileOptionsReplacementPanel, new GridBagConstraints(0, 7, 5, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
 
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               fileOptionsLabel.setText("<html><b>" + I18n.getMessage("jsite.project-files.file-options") + "</b></html>");
+                               defaultFileCheckBox.setText(I18n.getMessage("jsite.project-files.default"));
+                               defaultFileCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.default.tooltip"));
+                               fileOptionsInsertCheckBox.setText(I18n.getMessage("jsite.project-files.insert"));
+                               fileOptionsInsertCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.insert.tooltip"));
+                               fileOptionsCustomKeyTextField.setToolTipText(I18n.getMessage("jsite.project-files.custom-key.tooltip"));
+                               customKeyLabel.setText(I18n.getMessage("jsite.project-files.custom-key") + ":");
+                               fileOptionsMIMETypeComboBox.setToolTipText(I18n.getMessage("jsite.project-files.mime-type.tooltip"));
+                               mimeTypeLabel.setText(I18n.getMessage("jsite.project-files.mime-type") + ":");
+                               fileOptionsContainerComboBox.setToolTipText(I18n.getMessage("jsite.project-files.container.tooltip"));
+                               containerLabel.setText(I18n.getMessage("jsite.project-files.container") + ":");
+                               replacementCheckBox.setText(I18n.getMessage("jsite.project-files.replacement"));
+                               replacementCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.replacement.tooltip"));
+                               replaceEditionRangeSpinner.setToolTipText(I18n.getMessage("jsite.project-files.replacement.edition-range.tooltip"));
+                               editionRangeLabel.setText(I18n.getMessage("jsite.project-files.replacement.edition-range"));
+                       }
+               });
+
                return projectFilesPanel;
        }
 
-       public void setProject(Project project) {
+       public void setProject(final Project project) {
                this.project = project;
                setHeading(MessageFormat.format(I18n.getMessage("jsite.project-files.heading"), project.getName()));
                setDescription(I18n.getMessage("jsite.project-files.description"));
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               setHeading(MessageFormat.format(I18n.getMessage("jsite.project-files.heading"), project.getName()));
+                               setDescription(I18n.getMessage("jsite.project-files.description"));
+                       }
+               });
        }
 
        private List<String> getProjectFiles() {
index 2641fb0..98d29c8 100644 (file)
@@ -51,6 +51,7 @@ import de.todesbaum.jsite.application.InsertListener;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.application.ProjectInserter;
 import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.swing.TWizard;
 import de.todesbaum.util.swing.TWizardPage;
 
@@ -60,21 +61,27 @@ import de.todesbaum.util.swing.TWizardPage;
  */
 public class ProjectInsertPage extends TWizardPage implements InsertListener, ClipboardOwner {
 
-       protected TWizard wizard;
        protected ProjectInserter projectInserter;
 
        protected Action copyURIAction;
        protected JTextField requestURITextField;
        protected JLabel startTimeLabel;
        protected JProgressBar progressBar;
-       protected long startTime;
+       protected long startTime = 0;
 
-       public ProjectInsertPage() {
-               super();
+       public ProjectInsertPage(final TWizard wizard) {
+               super(wizard);
                createActions();
                pageInit();
                setHeading(I18n.getMessage("jsite.insert.heading"));
                setDescription(I18n.getMessage("jsite.insert.description"));
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               setHeading(I18n.getMessage("jsite.insert.heading"));
+                               setDescription(I18n.getMessage("jsite.insert.description"));
+                       }
+               });
                projectInserter = new ProjectInserter();
                projectInserter.addInsertListener(this);
        }
@@ -88,6 +95,14 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl
                copyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
                copyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
                copyURIAction.setEnabled(false);
+
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               copyURIAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.copy-uri"));
+                               copyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
+                       }
+               });
        }
 
        private void pageInit() {
@@ -107,15 +122,34 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl
                progressBar.setStringPainted(true);
                progressBar.setValue(0);
 
-               projectInsertPanel.add(new JLabel("<html><b>" + I18n.getMessage("jsite.insert.project-information") + "</b></html>"), new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
-               projectInsertPanel.add(new JLabel(I18n.getMessage("jsite.insert.request-uri") + ":"), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
+               final JLabel projectInformationLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.insert.project-information") + "</b></html>");
+               projectInsertPanel.add(projectInformationLabel, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+               final JLabel requestURILabel = new JLabel(I18n.getMessage("jsite.insert.request-uri") + ":");
+               projectInsertPanel.add(requestURILabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
                projectInsertPanel.add(requestURITextField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
-               projectInsertPanel.add(new JLabel(I18n.getMessage("jsite.insert.start-time") + ":"), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
+               final JLabel startTimeLeftLabel = new JLabel(I18n.getMessage("jsite.insert.start-time") + ":");
+               projectInsertPanel.add(startTimeLeftLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
                projectInsertPanel.add(startTimeLabel, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
-               projectInsertPanel.add(new JLabel(I18n.getMessage("jsite.insert.progress") + ":"), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
+               final JLabel progressLabel = new JLabel(I18n.getMessage("jsite.insert.progress") + ":");
+               projectInsertPanel.add(progressLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 18, 0, 0), 0, 0));
                projectInsertPanel.add(progressBar, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                projectInsertPanel.add(new JButton(copyURIAction), new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
 
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.insert.project-information") + "</b></html>");
+                               requestURILabel.setText(I18n.getMessage("jsite.insert.request-uri") + ":");
+                               startTimeLeftLabel.setText(I18n.getMessage("jsite.insert.start-time") + ":");
+                               if (startTime != 0) {
+                                       startTimeLabel.setText(DateFormat.getDateTimeInstance().format(new Date(startTime)));
+                               } else {
+                                       startTimeLabel.setText("");
+                               }
+                               progressLabel.setText(I18n.getMessage("jsite.insert.progress") + ":");
+                       }
+               });
+
                return projectInsertPanel;
        }
 
@@ -124,10 +158,14 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl
         */
        @Override
        public void pageAdded(TWizard wizard) {
-               this.wizard = wizard;
-               wizard.setPreviousEnabled(false);
+               this.wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
+               this.wizard.setPreviousEnabled(false);
+               this.wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
+               this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
+       }
+
+       public void startInsert() {
                wizard.setNextEnabled(false);
-               wizard.setQuitEnabled(false);
                copyURIAction.setEnabled(false);
                progressBar.setValue(0);
                progressBar.setFont(progressBar.getFont().deriveFont(Font.PLAIN));
index 086493c..9f5c969 100644 (file)
@@ -58,6 +58,7 @@ import javax.swing.text.Document;
 import de.todesbaum.jsite.application.Freenet7Interface;
 import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.swing.SortedListModel;
 import de.todesbaum.util.swing.TLabel;
 import de.todesbaum.util.swing.TWizard;
@@ -71,12 +72,12 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
 
        private Freenet7Interface freenetInterface;
 
-       private Action projectLocalPathBrowseAction;
-       private Action projectAddAction;
-       private Action projectDeleteAction;
-       private Action projectCloneAction;
-       private Action projectCopyURIAction;
-       private Action projectGenerateKeyAction;
+       protected Action projectLocalPathBrowseAction;
+       protected Action projectAddAction;
+       protected Action projectDeleteAction;
+       protected Action projectCloneAction;
+       protected Action projectCopyURIAction;
+       protected Action projectGenerateKeyAction;
 
        private JFileChooser pathChooser;
        private SortedListModel projectListModel;
@@ -88,12 +89,20 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
        private JTextField projectPrivateKeyTextField;
        private JTextField projectPathTextField;
 
-       public ProjectPage() {
-               super();
+       public ProjectPage(final TWizard wizard) {
+               super(wizard);
                setLayout(new BorderLayout(12, 12));
                dialogInit();
                setHeading(I18n.getMessage("jsite.project.heading"));
                setDescription(I18n.getMessage("jsite.project.description"));
+               
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               setHeading(I18n.getMessage("jsite.project.heading"));
+                               setDescription(I18n.getMessage("jsite.project.description"));
+                       }
+               });
        }
 
        protected void dialogInit() {
@@ -117,7 +126,10 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
        public void pageAdded(TWizard wizard) {
                super.pageAdded(wizard);
                projectList.clearSelection();
-               wizard.setNextEnabled(false);
+               this.wizard.setPreviousName(I18n.getMessage("jsite.menu.nodes.manage-nodes"));
+               this.wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
+               this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
+               this.wizard.setNextEnabled(false);
        }
 
        /**
@@ -171,8 +183,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
                projectCloneAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_L);
                projectCloneAction.setEnabled(false);
-               
+
                projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+
                        public void actionPerformed(ActionEvent actionEvent) {
                                actionCopyURI();
                        }
@@ -180,8 +193,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
                projectCopyURIAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
                projectCopyURIAction.setEnabled(false);
-               
+
                projectGenerateKeyAction = new AbstractAction(I18n.getMessage("jsite.project.action.generate-new-key")) {
+
                        public void actionPerformed(ActionEvent actionEvent) {
                                actionGenerateNewKey();
                        }
@@ -189,6 +203,24 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
                projectGenerateKeyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_G);
                projectGenerateKeyAction.setEnabled(false);
+               
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse"));
+                               projectLocalPathBrowseAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.browse.tooltip"));
+                               projectAddAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.add-project"));
+                               projectAddAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.add-project.tooltip"));
+                               projectDeleteAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.delete-project"));
+                               projectDeleteAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.delete-project.tooltip"));
+                               projectCloneAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.clone-project"));
+                               projectCloneAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.clone-project.tooltip"));
+                               projectCopyURIAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.copy-uri"));
+                               projectCopyURIAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.copy-uri.tooltip"));
+                               projectGenerateKeyAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.generate-new-key"));
+                               projectGenerateKeyAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.project.action.generate-new-key.tooltip"));
+                       }
+               });
        }
 
        private JComponent createInformationPanel() {
@@ -206,14 +238,16 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                informationPanel.add(functionButtons, BorderLayout.PAGE_START);
                informationPanel.add(informationTable, BorderLayout.CENTER);
 
-               informationTable.add(new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>"), new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+               final JLabel projectInformationLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
+               informationTable.add(projectInformationLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
 
                projectNameTextField = new JTextField();
                projectNameTextField.getDocument().putProperty("name", "project.name");
                projectNameTextField.getDocument().addDocumentListener(this);
                projectNameTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.name") + ":", KeyEvent.VK_N, projectNameTextField), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectNameLabel = new TLabel(I18n.getMessage("jsite.project.project.name") + ":", KeyEvent.VK_N, projectNameTextField);
+               informationTable.add(projectNameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectNameTextField, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectDescriptionTextField = new JTextField();
@@ -221,7 +255,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectDescriptionTextField.getDocument().addDocumentListener(this);
                projectDescriptionTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.description") + ":", KeyEvent.VK_D, projectDescriptionTextField), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectDescriptionLabel = new TLabel(I18n.getMessage("jsite.project.project.description") + ":", KeyEvent.VK_D, projectDescriptionTextField);
+               informationTable.add(projectDescriptionLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectDescriptionTextField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectLocalPathTextField = new JTextField();
@@ -229,18 +264,21 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectLocalPathTextField.getDocument().addDocumentListener(this);
                projectLocalPathTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.local-path") + ":", KeyEvent.VK_L, projectLocalPathTextField), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectLocalPathLabel = new TLabel(I18n.getMessage("jsite.project.project.local-path") + ":", KeyEvent.VK_L, projectLocalPathTextField);
+               informationTable.add(projectLocalPathLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectLocalPathTextField, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                informationTable.add(new JButton(projectLocalPathBrowseAction), new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
-               informationTable.add(new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>"), new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
+               final JLabel projectAddressLabel = new JLabel("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>");
+               informationTable.add(projectAddressLabel, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
 
                projectPublicKeyTextField = new JTextField(27);
                projectPublicKeyTextField.getDocument().putProperty("name", "project.publickey");
                projectPublicKeyTextField.getDocument().addDocumentListener(this);
                projectPublicKeyTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.public-key") + ":", KeyEvent.VK_U, projectPublicKeyTextField), new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectPublicKeyLabel = new TLabel(I18n.getMessage("jsite.project.project.public-key") + ":", KeyEvent.VK_U, projectPublicKeyTextField);
+               informationTable.add(projectPublicKeyLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectPublicKeyTextField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
                informationTable.add(new JButton(projectGenerateKeyAction), new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
@@ -249,7 +287,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectPrivateKeyTextField.getDocument().addDocumentListener(this);
                projectPrivateKeyTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.private-key") + ":", KeyEvent.VK_R, projectPrivateKeyTextField), new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectPrivateKeyLabel = new TLabel(I18n.getMessage("jsite.project.project.private-key") + ":", KeyEvent.VK_R, projectPrivateKeyTextField);
+               informationTable.add(projectPrivateKeyLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectPrivateKeyTextField, new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                projectPathTextField = new JTextField();
@@ -257,7 +296,21 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                projectPathTextField.getDocument().addDocumentListener(this);
                projectPathTextField.setEnabled(false);
 
-               informationTable.add(new TLabel(I18n.getMessage("jsite.project.project.path") + ":", KeyEvent.VK_P, projectPathTextField), new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               final TLabel projectPathLabel = new TLabel(I18n.getMessage("jsite.project.project.path") + ":", KeyEvent.VK_P, projectPathTextField);
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+
+                       public void run() {
+                               projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
+                               projectNameLabel.setText(I18n.getMessage("jsite.project.project.name") + ":");
+                               projectDescriptionLabel.setText(I18n.getMessage("jsite.project.project.description") + ":");
+                               projectLocalPathLabel.setText(I18n.getMessage("jsite.project.project.local-path") + ":");
+                               projectAddressLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.address") + "</b></html>");
+                               projectPublicKeyLabel.setText(I18n.getMessage("jsite.project.project.public-key") + ":");
+                               projectPrivateKeyLabel.setText(I18n.getMessage("jsite.project.project.private-key") + ":");
+                               projectPathLabel.setText(I18n.getMessage("jsite.project.project.path") + ":");
+                       }
+               });
+               informationTable.add(projectPathLabel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
                informationTable.add(projectPathTextField, new GridBagConstraints(1, 7, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
 
                return informationPanel;
index ccda88b..32dd06b 100644 (file)
@@ -56,7 +56,11 @@ public class I18n {
                try {
                        return getResourceBundle().getString(key);
                } catch (MissingResourceException mre1) {
-                       return getResourceBundle(defaultLocale).getString(key);
+                       try {
+                               return getResourceBundle(defaultLocale).getString(key);
+                       } catch (MissingResourceException mre2) {
+                               return key;
+                       }
                }
        }
 
diff --git a/src/de/todesbaum/jsite/i18n/I18nContainer.java b/src/de/todesbaum/jsite/i18n/I18nContainer.java
new file mode 100644 (file)
index 0000000..1926ae5
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * jSite-remote - I18nContainer.java Copyright © 2007 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.i18n;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author David Roden &lt;droden@gmail.com&gt;
+ * @version $Id$
+ */
+public class I18nContainer implements Iterable<Runnable> {
+
+       private static final I18nContainer singleton = new I18nContainer();
+       private final List<Runnable> i18nRunnables = Collections.synchronizedList(new ArrayList<Runnable>());
+       private final List<Runnable> i18nPostRunnables = Collections.synchronizedList(new ArrayList<Runnable>());
+
+       public static I18nContainer getInstance() {
+               return singleton;
+       }
+
+       public void registerRunnable(Runnable i18nRunnable) {
+               i18nRunnables.add(i18nRunnable);
+       }
+
+       public void registerPostRunnable(Runnable i18nPostRunnable) {
+               i18nPostRunnables.add(i18nPostRunnable);
+       }
+
+       public Iterator<Runnable> iterator() {
+               List<Runnable> allRunnables = new ArrayList<Runnable>();
+               allRunnables.addAll(i18nRunnables);
+               allRunnables.addAll(i18nPostRunnables);
+               return allRunnables.iterator();
+       }
+
+}
index 6f6d617..f460700 100644 (file)
@@ -128,4 +128,4 @@ jsite.project-files.index-not-html=<html><b>Le fichier principal n'est pas un fi
 jsite.project-files.no-node-running=<html><b>Ce noeud n'est pas actif!</b><br><br>Vous ne pouvez pas utiliser jSite sans noeud actif.<br>Veuillez démarrer votre noeud et réessayer.</html>
 jsite.project-files.no-custom-key=<html><b>Pas de clef existante spécifiée pour ce fichier</b><br><br>Vous avez spécifier de ne pas insérer <code>{0}</code><br> mais n'avez pas spécifier de clef ou rediriger!</html>
 jsite.project-files.no-node-selected=<html><b>Pas de noeud sélectionné</b><br><br>Sélectionnez un noeud dans le menu!</html>
-
+jsite.project-files.insert-now=Insérer
index 78f5097..bfb5ef3 100644 (file)
@@ -52,6 +52,7 @@ import de.todesbaum.jsite.gui.ProjectFilesPage;
 import de.todesbaum.jsite.gui.ProjectInsertPage;
 import de.todesbaum.jsite.gui.ProjectPage;
 import de.todesbaum.jsite.i18n.I18n;
+import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.image.IconLoader;
 import de.todesbaum.util.swing.TWizard;
 import de.todesbaum.util.swing.TWizardPage;
@@ -73,9 +74,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        }
 
        private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH };
-       private Map<Locale, Action> languageActions = new HashMap<Locale, Action>();
-       private Action manageNodeAction;
-       private Action aboutAction;
+       protected Map<Locale, Action> languageActions = new HashMap<Locale, Action>();
+       protected Action manageNodeAction;
+       protected Action aboutAction;
        protected TWizard wizard;
        protected JMenu nodeMenu;
        private Node selectedNode;
@@ -100,8 +101,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                wizard = new TWizard();
                createActions();
                wizard.setJMenuBar(createMenuBar());
-               wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
-               wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
                wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
                wizard.setPreviousEnabled(false);
                wizard.setNextEnabled(true);
@@ -111,7 +110,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
 
                initPages();
                showPage(PageType.PAGE_PROJECTS);
-               wizard.setPreviousName((String) manageNodeAction.getValue(Action.NAME));
        }
 
        private void createActions() {
@@ -136,11 +134,18 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                                JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), Version.getVersion()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
                        }
                };
+               
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+                       public void run() {
+                               manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
+                               aboutAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.help.about"));
+                       }
+               });
        }
 
        private JMenuBar createMenuBar() {
                JMenuBar menuBar = new JMenuBar();
-               JMenu languageMenu = new JMenu(I18n.getMessage("jsite.menu.languages"));
+               final JMenu languageMenu = new JMenu(I18n.getMessage("jsite.menu.languages"));
                menuBar.add(languageMenu);
                ButtonGroup languageButtonGroup = new ButtonGroup();
                for (Locale locale: SUPPORTED_LOCALES) {
@@ -163,31 +168,43 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                panel.setOpaque(false);
                menuBar.add(panel);
 
-               JMenu helpMenu = new JMenu(I18n.getMessage("jsite.menu.help"));
+               final JMenu helpMenu = new JMenu(I18n.getMessage("jsite.menu.help"));
                menuBar.add(helpMenu);
                helpMenu.add(aboutAction);
+               
+               I18nContainer.getInstance().registerRunnable(new Runnable() {
+                       public void run() {
+                               languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
+                               nodeMenu.setText(I18n.getMessage("jsite.menu.nodes"));
+                               helpMenu.setText(I18n.getMessage("jsite.menu.help"));
+                               for (Map.Entry<Locale, Action> languageActionEntry: languageActions.entrySet()) {
+                                       languageActionEntry.getValue().putValue(Action.NAME, I18n.getMessage("jsite.menu.language." + languageActionEntry.getKey().getLanguage()));
+                               }
+                       }
+               });
+               
                return menuBar;
        }
 
        private void initPages() {
-               NodeManagerPage nodeManagerPage = new NodeManagerPage();
+               NodeManagerPage nodeManagerPage = new NodeManagerPage(wizard);
                nodeManagerPage.setName("page.node-manager");
                nodeManagerPage.addNodeManagerListener(this);
                nodeManagerPage.setNodes(configuration.getNodes());
                pages.put(PageType.PAGE_NODE_MANAGER, nodeManagerPage);
 
-               ProjectPage projectPage = new ProjectPage();
+               ProjectPage projectPage = new ProjectPage(wizard);
                projectPage.setName("page.project");
                projectPage.setProjects(configuration.getProjects());
                projectPage.setFreenetInterface(freenetInterface);
                projectPage.addListSelectionListener(this);
                pages.put(PageType.PAGE_PROJECTS, projectPage);
 
-               ProjectFilesPage projectFilesPage = new ProjectFilesPage();
+               ProjectFilesPage projectFilesPage = new ProjectFilesPage(wizard);
                projectFilesPage.setName("page.project.files");
                pages.put(PageType.PAGE_PROJECT_FILES, projectFilesPage);
 
-               ProjectInsertPage projectInsertPage = new ProjectInsertPage();
+               ProjectInsertPage projectInsertPage = new ProjectInsertPage(wizard);
                projectInsertPage.setDebug(debug);
                projectInsertPage.setName("page.project.insert");
                projectInsertPage.setFreenetInterface(freenetInterface);
@@ -242,11 +259,15 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                Action languageAction = languageActions.get(supportedLocale);
                JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) languageAction.getValue("menuItem");
                menuItem.setSelected(true);
-               /* show the restart message in the other language! */
-               Locale currentLocale = I18n.getLocale();
                I18n.setLocale(supportedLocale);
-               JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.menu.language.change.restart-message"), null, JOptionPane.INFORMATION_MESSAGE);
-               I18n.setLocale(currentLocale);
+               for (Runnable i18nRunnable: I18nContainer.getInstance()) {
+                       try {
+                               i18nRunnable.run();
+                       } catch (Throwable t) {
+                               /* we probably shouldn't swallow this. */
+                       }
+               }
+               wizard.setPage(wizard.getPage());
                configuration.setLocale(supportedLocale);
        }
 
@@ -274,7 +295,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                String pageName = wizard.getPage().getName();
                if ("page.node-manager".equals(pageName)) {
                        showPage(PageType.PAGE_PROJECTS);
-                       wizard.setPreviousName((String) manageNodeAction.getValue(Action.NAME));
                } else if ("page.project".equals(pageName)) {
                        ProjectPage projectPage = (ProjectPage) wizard.getPage();
                        Project project = projectPage.getSelectedProject();
@@ -289,8 +309,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        ((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);
                        Project project = projectPage.getSelectedProject();
@@ -332,8 +350,8 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                                return;
                        }
                        configuration.save();
-                       wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
                        showPage(PageType.PAGE_INSERT_PROJECT);
+                       ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).startInsert();
                        nodeMenu.setEnabled(false);
                } else if ("page.project.insert".equals(pageName)) {
                        showPage(PageType.PAGE_PROJECTS);
@@ -348,11 +366,8 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                String pageName = wizard.getPage().getName();
                if ("page.project".equals(pageName)) {
                        showPage(PageType.PAGE_NODE_MANAGER);
-                       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);
                }
index e436472..9f125aa 100644 (file)
@@ -25,7 +25,7 @@ package de.todesbaum.jsite.main;
  */
 public class Version {
 
-       private static final String VERSION = "0.4.9.2";
+       private static final String VERSION = "0.4.9.3";
 
        public static final String getVersion() {
                return VERSION;
index f660ec5..3ccda84 100644 (file)
@@ -27,18 +27,21 @@ import javax.swing.JPanel;
  */
 public class TWizardPage extends JPanel {
 
+       protected final TWizard wizard;
        protected String heading;
        protected String description;
 
-       public TWizardPage() {
+       public TWizardPage(final TWizard wizard) {
+               this.wizard = wizard;
        }
 
-       public TWizardPage(String heading) {
+       public TWizardPage(final TWizard wizard, String heading) {
+               this.wizard = wizard;
                this.heading = heading;
        }
 
-       public TWizardPage(String heading, String description) {
-               this(heading);
+       public TWizardPage(final TWizard wizard, String heading, String description) {
+               this(wizard, heading);
                this.description = description;
        }