Add Interface.setCore(Core) method to set the core that is controlled by the interface.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 26 Jan 2009 23:27:32 +0000 (00:27 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 26 Jan 2009 23:27:32 +0000 (00:27 +0100)
src/net/pterodactylus/jkeytool/gui/Interface.java
src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java
src/net/pterodactylus/jkeytool/main/Main.java

index 7b278ce..44b0a65 100644 (file)
@@ -19,6 +19,7 @@
 
 package net.pterodactylus.jkeytool.gui;
 
+import net.pterodactylus.jkeytool.core.Core;
 import net.pterodactylus.jkeytool.core.CoreListener;
 
 /**
@@ -29,6 +30,14 @@ import net.pterodactylus.jkeytool.core.CoreListener;
 public interface Interface extends CoreListener {
 
        /**
+        * Sets the core to control.
+        *
+        * @param core
+        *            The core to control
+        */
+       public void setCore(Core core);
+
+       /**
         * Starts the interface, usually by making it visible.
         */
        public void start();
index 388846d..4d287d9 100644 (file)
@@ -22,6 +22,7 @@ package net.pterodactylus.jkeytool.gui.swing;
 import java.io.File;
 import java.security.KeyStore;
 
+import net.pterodactylus.jkeytool.core.Core;
 import net.pterodactylus.jkeytool.gui.Interface;
 
 /**
@@ -31,11 +32,24 @@ import net.pterodactylus.jkeytool.gui.Interface;
  */
 public class SwingInterface implements Interface {
 
+       /** The core to control. */
+       private Core core;
+
        //
        // INTERFACE Interface
        //
 
        /**
+        * Sets the core to control.
+        *
+        * @param core
+        *            The core to control
+        */
+       public void setCore(Core core) {
+               this.core = core;
+       }
+
+       /**
         * {@inheritDoc}
         */
        public void start() {
index 9f4b477..26a9496 100644 (file)
@@ -56,6 +56,7 @@ public class Main {
        public static void main(String[] arguments) {
                Core core = new Core();
                Interface gui = getInterface();
+               gui.setCore(core);
                core.addCoreListener(gui);
                gui.start();
        }