]> git.mxchange.org Git - addressbook-lib.git/blobdiff - Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Added 'final' keyword to getters/setters as it makes no sense overwriting them.
[addressbook-lib.git] / Addressbook / src / org / mxchange / addressbook / client / gui / SwingClient.java
index 87686e9ecbbbd5d5f7532d9be766b7c9699cb88c..8992b3a1ebb621a54afb9499d6f829e79033fe25 100644 (file)
@@ -16,8 +16,9 @@
  */\r
 package org.mxchange.addressbook.client.gui;\r
 \r
+import org.mxchange.addressbook.FrameAlreadyInitializedException;\r
 import org.mxchange.addressbook.UnhandledUserChoiceException;\r
-import org.mxchange.addressbook.application.AddressbookApplication;\r
+import org.mxchange.addressbook.application.Application;\r
 import org.mxchange.addressbook.client.BaseClient;\r
 import org.mxchange.addressbook.client.Client;\r
 import org.mxchange.addressbook.contact.Contact;\r
@@ -30,17 +31,23 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem;
  */\r
 public class SwingClient extends BaseClient implements Client {\r
     /**\r
-     * Constructor with application instance\r
-     * @param application \r
+     * Swing frame instance\r
      */\r
-    public SwingClient (final AddressbookApplication application) {\r
+    private final ClientFrame frame;\r
+\r
+    /**\r
+     * Constructor with an Application instance.\r
+     * \r
+     * @param application Application instance\r
+     */\r
+    public SwingClient (final Application application) {\r
        super();\r
 \r
        // Set application instance\r
        this.setApplication(application);\r
 \r
-       // Init contact manager here\r
-       this.initContactManager(this);\r
+       // Init frame instance\r
+       this.frame = AddressbookFrame.getSelfInstance(this);\r
     }\r
 \r
     @Override\r
@@ -59,10 +66,38 @@ public class SwingClient extends BaseClient implements Client {
     }\r
 \r
     @Override\r
-    public void doUserMenuChoice () throws UnhandledUserChoiceException {\r
+    public void doChangeOwnAddressData (Contact contact) {\r
+       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+    }\r
+\r
+    @Override\r
+    public void doChangeOwnNameData (Contact contact) {\r
+       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+    }\r
+\r
+    @Override\r
+    public void doChangeOwnOtherData (Contact contact) {\r
+       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+    }\r
+\r
+    @Override\r
+    public Contact doEnterOwnData () {\r
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
     }\r
 \r
+    @Override\r
+    public void doShutdown () {\r
+       // Parent call\r
+       super.doShutdown();\r
+\r
+       // @TODO Add other shutdown stuff\r
+    }\r
+\r
+    @Override\r
+    public void doUserMenuChoice () throws UnhandledUserChoiceException {\r
+       // Not implemented here\r
+    }\r
+\r
     @Override\r
     public char enterChar (final char[] validChars, String message) {\r
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
@@ -89,7 +124,6 @@ public class SwingClient extends BaseClient implements Client {
      * @param accessKey Key to access the menu\r
      * @param text Text to show to user\r
      * @return A SelectableMenuItem\r
-     * @todo Make sure the access key is unique\r
      */\r
     @Override\r
     public SelectableMenuItem getMenuItem (final char accessKey, final String text) {\r
@@ -97,6 +131,26 @@ public class SwingClient extends BaseClient implements Client {
        return null;\r
     }\r
 \r
+    /**\r
+     * Inizializes this client\r
+     */\r
+    @Override\r
+    public void initClient () {\r
+       // Init contact manager here\r
+       this.initContactManager();\r
+\r
+       try {\r
+           // Init frame\r
+           this.frame.initFrame();\r
+       } catch (final FrameAlreadyInitializedException ex) {\r
+           this.getLogger().catching(ex);\r
+           System.exit(1);\r
+       }\r
+\r
+       // Now start the frame\r
+       this.frame.setupFrame(this);\r
+    }\r
+\r
     @Override\r
     public void outputMessage (final String message) {\r
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
@@ -104,7 +158,7 @@ public class SwingClient extends BaseClient implements Client {
 \r
     @Override\r
     public void showCurrentMenu () {\r
-       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+       // Not implemented here\r
     }\r
 \r
     @Override\r
@@ -114,7 +168,7 @@ public class SwingClient extends BaseClient implements Client {
 \r
     @Override\r
     public void showWelcome () {\r
-       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+       // Not implemented here\r
     }\r
 \r
     @Override\r