add advanced mode
[jSite2.git] / src / net / pterodactylus / jsite / gui / ConfigurationDialog.java
index 1d0a4bf..a5a6c88 100644 (file)
@@ -43,6 +43,12 @@ public class ConfigurationDialog extends JDialog implements I18nable {
        /** The “cancel” action. */
        private I18nAction cancelAction;
 
+       /** The “advanced mode” action. */
+       private I18nAction advancedModeAction;
+
+       /** The “advanced mode” checkbox. */
+       private JCheckBox advancedModeCheckBox;
+
        /** The “beautify GUI” action. */
        private I18nAction antialiasAction;
 
@@ -110,6 +116,27 @@ public class ConfigurationDialog extends JDialog implements I18nable {
        }
 
        /**
+        * Returns whether the advanced mode is selected.
+        *
+        * @return <code>true</code> if the advanced mode is selected,
+        *         <code>false</code> otherwise
+        */
+       public boolean isAdvancedMode() {
+               return advancedModeCheckBox.isSelected();
+       }
+
+       /**
+        * Sets whether the advanced mode is selected.
+        *
+        * @param advancedMode
+        *            <code>true</code> if the advanced mode is selected,
+        *            <code>false</code> otherwise
+        */
+       public void setAdvancedMode(boolean advancedMode) {
+               advancedModeCheckBox.setSelected(advancedMode);
+       }
+
+       /**
         * Returns whether the “beautify” checkbox has been selected. The result of
         * this method should not be used if {@link #wasCancelled()} returned
         * <code>true</code>!
@@ -223,7 +250,16 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                                actionCancel();
                        }
                };
-               antialiasAction = new I18nAction("configurationDialog.page.interface.item.antialias") {
+               advancedModeAction = new I18nAction("configurationDialog.page.interface.item.advancedMode") {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       public void actionPerformed(ActionEvent e) {
+                               /* do nothing. */
+                       }
+               };
+               antialiasAction = new I18nAction("configurationDialog.page.interfaceTweaks.item.antialias") {
 
                        /**
                         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
@@ -232,7 +268,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                                /* do nothing. */
                        }
                };
-               useCustomControlFontAction = new I18nAction("configurationDialog.page.interface.item.useCustomControlFont") {
+               useCustomControlFontAction = new I18nAction("configurationDialog.page.interfaceTweaks.item.useCustomControlFont") {
 
                        /**
                         * {@inheritDoc}
@@ -244,7 +280,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                                controlFontSizeSpinner.setEnabled(selected);
                        }
                };
-               useCustomUserFontAction = new I18nAction("configurationDialog.page.interface.item.useCustomUserFont") {
+               useCustomUserFontAction = new I18nAction("configurationDialog.page.interfaceTweaks.item.useCustomUserFont") {
 
                        /**
                         * {@inheritDoc}
@@ -268,8 +304,11 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
                contentPane.add(tabbedPane, BorderLayout.CENTER);
 
+               JComponent interfaceConfig = createInterfaceConfig();
+               tabbedPane.add(I18n.get("configurationDialog.page.interface.name"), interfaceConfig);
+
                JComponent interfaceTweaksConfig = createInterfaceTweaksConfig();
-               tabbedPane.add(I18n.get("configurationDialog.page.interface.name"), interfaceTweaksConfig);
+               tabbedPane.add(I18n.get("configurationDialog.page.interfaceTweaks.name"), interfaceTweaksConfig);
 
                JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 12, 12));
                contentPane.add(buttonPanel, BorderLayout.PAGE_END);
@@ -283,41 +322,57 @@ public class ConfigurationDialog extends JDialog implements I18nable {
        }
 
        /**
-        * Creates the panel for the interface configuration.
+        * Creates the interface configuration panel.
         *
         * @return The interface configuration panel
         */
-       private JComponent createInterfaceTweaksConfig() {
+       private JComponent createInterfaceConfig() {
                JPanel interfaceConfigPanel = new JPanel(new GridBagLayout());
                interfaceConfigPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
 
-               restartRequiredLabel = new I18nLabel("configurationDialog.page.interface.item.restartRequired");
-               interfaceConfigPanel.add(restartRequiredLabel, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+               advancedModeCheckBox = new JCheckBox(advancedModeAction);
+               interfaceConfigPanel.add(advancedModeCheckBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+
+               interfaceConfigPanel.add(new JPanel(), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+               return interfaceConfigPanel;
+       }
+
+       /**
+        * Creates the panel for the interface tweaks configuration.
+        *
+        * @return The interface tweaks configuration panel
+        */
+       private JComponent createInterfaceTweaksConfig() {
+               JPanel interfaceTweaksConfigPanel = new JPanel(new GridBagLayout());
+               interfaceTweaksConfigPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
+
+               restartRequiredLabel = new I18nLabel("configurationDialog.page.interfaceTweaks.item.restartRequired");
+               interfaceTweaksConfigPanel.add(restartRequiredLabel, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
 
                antialiasCheckBox = new JCheckBox(antialiasAction);
-               interfaceConfigPanel.add(antialiasCheckBox, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(18, 0, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(antialiasCheckBox, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(18, 0, 0, 0), 0, 0));
 
                useCustomControlFontCheckBox = new JCheckBox(useCustomControlFontAction);
-               interfaceConfigPanel.add(useCustomControlFontCheckBox, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 0, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(useCustomControlFontCheckBox, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 0, 0, 0), 0, 0));
 
                controlFontList = new FontComboBox();
-               interfaceConfigPanel.add(controlFontList, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(controlFontList, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
 
                controlFontSizeSpinner = new JSpinner(new SpinnerNumberModel(12, 6, 80, 1));
-               interfaceConfigPanel.add(controlFontSizeSpinner, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(controlFontSizeSpinner, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
 
                useCustomUserFontCheckBox = new JCheckBox(useCustomUserFontAction);
-               interfaceConfigPanel.add(useCustomUserFontCheckBox, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(useCustomUserFontCheckBox, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
 
                userFontList = new FontComboBox();
-               interfaceConfigPanel.add(userFontList, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(userFontList, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
 
                userFontSizeSpinner = new JSpinner(new SpinnerNumberModel(12, 6, 80, 1));
-               interfaceConfigPanel.add(userFontSizeSpinner, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(userFontSizeSpinner, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
 
-               interfaceConfigPanel.add(new JPanel(), new GridBagConstraints(0, 4, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+               interfaceTweaksConfigPanel.add(new JPanel(), new GridBagConstraints(0, 4, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
 
-               return interfaceConfigPanel;
+               return interfaceTweaksConfigPanel;
        }
 
        //