add configuration dialog
[jSite2.git] / src / net / pterodactylus / jsite / gui / SwingInterface.java
index e98fa80..1f41af1 100644 (file)
@@ -79,9 +79,19 @@ public class SwingInterface implements CoreListener {
        /** The “about” dialog. */
        private AboutDialog aboutDialog;
 
+       /** The configuration dialog. */
+       private ConfigurationDialog configurationDialog;
+
        /** The list of all defined nodes. */
        private List<Node> nodeList;
 
+       //
+       // CONFIGURATION
+       //
+
+       /** Whether to beautify the GUI. */
+       private boolean beautify;
+
        /**
         * Creates a new swing interface.
         * 
@@ -91,9 +101,12 @@ public class SwingInterface implements CoreListener {
        public SwingInterface(Core core) {
                this.core = core;
                I18n.setLocale(Locale.ENGLISH); /* TODO - load config */
-               System.setProperty("swing.aatext", "true");
-               System.setProperty("swing.plaf.metal.controlFont", "Tahoma");
-               System.setProperty("swing.plaf.metal.userFont", "Tahoma");
+               loadConfig();
+               if (beautify) {
+                       System.setProperty("swing.aatext", "true");
+                       System.setProperty("swing.plaf.metal.controlFont", "Tahoma");
+                       System.setProperty("swing.plaf.metal.userFont", "Tahoma");
+               }
                initActions();
                initDialogs();
        }
@@ -221,6 +234,13 @@ public class SwingInterface implements CoreListener {
        //
 
        /**
+        * Loads the configuration of the interface.
+        */
+       private void loadConfig() {
+               beautify = true;
+       }
+
+       /**
         * Initializes all actions.
         */
        private void initActions() {
@@ -325,6 +345,7 @@ public class SwingInterface implements CoreListener {
        private void initDialogs() {
                manageNodesDialog = new ManageNodesDialog(this);
                aboutDialog = new AboutDialog(this);
+               configurationDialog = new ConfigurationDialog(this);
        }
 
        //
@@ -335,6 +356,11 @@ public class SwingInterface implements CoreListener {
         * Shows the configuration dialog.
         */
        private void configure() {
+               configurationDialog.setBeautify(beautify);
+               configurationDialog.setVisible(true);
+               if (!configurationDialog.wasCancelled()) {
+                       beautify = configurationDialog.getBeautify();
+               }
        }
 
        /**