From 7e667595d8380f21cfba9c6de67180fd1a44a5b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 17 Mar 2012 22:47:57 +0100 Subject: [PATCH] =?utf8?q?Add=20=E2=80=9Cforce=20insert=E2=80=9D=20checkbo?= =?utf8?q?x.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/de/todesbaum/jsite/gui/ProjectFilesPage.java | 36 +++++++++++++++++++----- src/de/todesbaum/jsite/i18n/jSite.properties | 2 ++ src/de/todesbaum/jsite/i18n/jSite_de.properties | 2 ++ src/de/todesbaum/jsite/i18n/jSite_fr.properties | 2 ++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/de/todesbaum/jsite/gui/ProjectFilesPage.java b/src/de/todesbaum/jsite/gui/ProjectFilesPage.java index fcbc369..d2479d4 100644 --- a/src/de/todesbaum/jsite/gui/ProjectFilesPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectFilesPage.java @@ -88,6 +88,9 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis /** The “insert” checkbox. */ private JCheckBox fileOptionsInsertCheckBox; + /** The “force insert” checkbox. */ + private JCheckBox fileOptionsForceInsertCheckBox; + /** The “insert redirect” checkbox. */ private JCheckBox fileOptionsInsertRedirectCheckBox; @@ -206,6 +209,15 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis fileOptionsPanel.add(fileOptionsInsertCheckBox, new GridBagConstraints(0, 4, 5, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0)); + fileOptionsForceInsertCheckBox = new JCheckBox(I18n.getMessage("jsite.project-files.force-insert")); + fileOptionsForceInsertCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.force-insert.tooltip")); + fileOptionsForceInsertCheckBox.setName("force-insert"); + fileOptionsForceInsertCheckBox.setMnemonic(KeyEvent.VK_F); + fileOptionsForceInsertCheckBox.addActionListener(this); + fileOptionsForceInsertCheckBox.setEnabled(false); + + fileOptionsPanel.add(fileOptionsForceInsertCheckBox, new GridBagConstraints(0, 5, 5, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0)); + fileOptionsCustomKeyTextField = new JTextField(45); fileOptionsCustomKeyTextField.setToolTipText(I18n.getMessage("jsite.project-files.custom-key.tooltip")); fileOptionsCustomKeyTextField.setEnabled(false); @@ -219,9 +231,9 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis fileOptionsInsertRedirectCheckBox.setEnabled(false); final TLabel customKeyLabel = new TLabel(I18n.getMessage("jsite.project-files.custom-key") + ":", KeyEvent.VK_K, fileOptionsCustomKeyTextField); - fileOptionsPanel.add(fileOptionsInsertRedirectCheckBox, 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(customKeyLabel, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); - fileOptionsPanel.add(fileOptionsCustomKeyTextField, new GridBagConstraints(2, 5, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); + fileOptionsPanel.add(fileOptionsInsertRedirectCheckBox, 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(customKeyLabel, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); + fileOptionsPanel.add(fileOptionsCustomKeyTextField, new GridBagConstraints(2, 6, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); fileOptionsRenameCheckBox = new JCheckBox(I18n.getMessage("jsite.project-files.rename"), false); fileOptionsRenameCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.rename.tooltip")); @@ -260,8 +272,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis }); - fileOptionsPanel.add(fileOptionsRenameCheckBox, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0)); - fileOptionsPanel.add(fileOptionsRenameTextField, new GridBagConstraints(2, 6, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); + fileOptionsPanel.add(fileOptionsRenameCheckBox, new GridBagConstraints(0, 7, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0)); + fileOptionsPanel.add(fileOptionsRenameTextField, new GridBagConstraints(2, 7, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); fileOptionsMIMETypeComboBox = new JComboBox(DefaultMIMETypes.getAllMIMETypes()); fileOptionsMIMETypeComboBox.setToolTipText(I18n.getMessage("jsite.project-files.mime-type.tooltip")); @@ -271,8 +283,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis fileOptionsMIMETypeComboBox.setEnabled(false); final TLabel mimeTypeLabel = new TLabel(I18n.getMessage("jsite.project-files.mime-type") + ":", KeyEvent.VK_M, fileOptionsMIMETypeComboBox); - fileOptionsPanel.add(mimeTypeLabel, new GridBagConstraints(0, 7, 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, 7, 4, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); + fileOptionsPanel.add(mimeTypeLabel, new GridBagConstraints(0, 8, 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, 8, 4, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); I18nContainer.getInstance().registerRunnable(new Runnable() { @@ -285,6 +297,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis 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")); + fileOptionsForceInsertCheckBox.setText(I18n.getMessage("jsite.project-files.force-insert")); + fileOptionsForceInsertCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.force-insert.tooltip")); fileOptionsInsertRedirectCheckBox.setText(I18n.getMessage("jsite.project-files.insert-redirect")); fileOptionsInsertRedirectCheckBox.setToolTipText(I18n.getMessage("jsite.project-files.insert-redirect.tooltip")); fileOptionsCustomKeyTextField.setToolTipText(I18n.getMessage("jsite.project-files.custom-key.tooltip")); @@ -442,6 +456,9 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis boolean isInsert = checkBox.isSelected(); fileOption.setInsert(isInsert); fileOptionsInsertRedirectCheckBox.setEnabled(!isInsert); + } else if ("force-insert".equals(checkBox.getName())) { + boolean isForceInsert = checkBox.isSelected(); + fileOption.setForceInsert(isForceInsert); } else if ("insert-redirect".equals(checkBox.getName())) { boolean isInsertRedirect = checkBox.isSelected(); fileOption.setInsertRedirect(isInsertRedirect); @@ -466,6 +483,7 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis /** * {@inheritDoc} */ + @SuppressWarnings("null") public void valueChanged(ListSelectionEvent e) { ScannedFile scannedFile = (ScannedFile) projectFileList.getSelectedValue(); boolean enabled = scannedFile != null; @@ -478,6 +496,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis FileOption fileOption = project.getFileOption(filename); defaultFileCheckBox.setSelected(filename.equals(project.getIndexFile())); fileOptionsInsertCheckBox.setSelected(fileOption.isInsert()); + fileOptionsForceInsertCheckBox.setEnabled(scannedFile.getHash().equals(fileOption.getLastInsertHash())); + fileOptionsForceInsertCheckBox.setSelected(fileOption.isForceInsert()); fileOptionsInsertRedirectCheckBox.setEnabled(!fileOption.isInsert()); fileOptionsInsertRedirectCheckBox.setSelected(fileOption.isInsertRedirect()); fileOptionsCustomKeyTextField.setEnabled(fileOption.isInsertRedirect()); @@ -489,6 +509,8 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis } else { defaultFileCheckBox.setSelected(false); fileOptionsInsertCheckBox.setSelected(true); + fileOptionsForceInsertCheckBox.setEnabled(false); + fileOptionsForceInsertCheckBox.setSelected(false); fileOptionsInsertRedirectCheckBox.setEnabled(false); fileOptionsInsertRedirectCheckBox.setSelected(false); fileOptionsCustomKeyTextField.setEnabled(false); diff --git a/src/de/todesbaum/jsite/i18n/jSite.properties b/src/de/todesbaum/jsite/i18n/jSite.properties index 66f9343..4208022 100644 --- a/src/de/todesbaum/jsite/i18n/jSite.properties +++ b/src/de/todesbaum/jsite/i18n/jSite.properties @@ -144,6 +144,8 @@ jsite.project-files.default=Default file jsite.project-files.default.tooltip=Specify that this file is the project\u2019s index file jsite.project-files.insert=Insert jsite.project-files.insert.tooltip=Uncheck if you do not want to insert this file +jsite.project-files.force-insert=Force insert +jsite.project-files.force-insert.tooltip=Forces the insert of this file even it is not modified jsite.project-files.insert-redirect=Redirect jsite.project-files.insert-redirect.tooltip=Check if you want to insert a redirect for this file jsite.project-files.custom-key=Custom key diff --git a/src/de/todesbaum/jsite/i18n/jSite_de.properties b/src/de/todesbaum/jsite/i18n/jSite_de.properties index b65f6ed..4f9d63c 100644 --- a/src/de/todesbaum/jsite/i18n/jSite_de.properties +++ b/src/de/todesbaum/jsite/i18n/jSite_de.properties @@ -144,6 +144,8 @@ jsite.project-files.default=Index-Datei jsite.project-files.default.tooltip=Lege Index-Datei f\u00fcr Projekt fest jsite.project-files.insert=Einf\u00fcgen jsite.project-files.insert.tooltip=jSite f\u00fcgt diese Datei ein +jsite.project-files.force-insert=Einf\u00fcgen erzwingen +jsite.project-files.force-insert.tooltip=F\u00fcgt diese Datei ein, auch wenn sie nicht modifiziert wurde jsite.project-files.insert-redirect=Umleitung jsite.project-files.insert-redirect.tooltip=F\u00fcgt eine Umleitung ein jsite.project-files.custom-key=Extern erstellter Schl\u00fcssel diff --git a/src/de/todesbaum/jsite/i18n/jSite_fr.properties b/src/de/todesbaum/jsite/i18n/jSite_fr.properties index 9561549..c974ee4 100644 --- a/src/de/todesbaum/jsite/i18n/jSite_fr.properties +++ b/src/de/todesbaum/jsite/i18n/jSite_fr.properties @@ -134,6 +134,8 @@ jsite.project-files.default=Fichier par d\u00e9faut jsite.project-files.default.tooltip=Est-ce l'index? jsite.project-files.insert=Ins\u00e9rer jsite.project-files.insert.tooltip=D\u00e9cochez si vous ne voulez pas ins\u00e9rer ce fichier +jsite.project-files.force-insert=Force insert +jsite.project-files.force-insert.tooltip=Forces the insert of this file even it is not modified jsite.project-files.insert-redirect=Redirection jsite.project-files.insert-redirect.tooltip=Cochez si vous voulez ins\u00e9rer une redirection pour ce fichier jsite.project-files.custom-key=Clef existante -- 2.7.4