]> git.mxchange.org Git - jaddressbook-lib.git/blobdiff - Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Added more thrown exceptions or catch them.
[jaddressbook-lib.git] / Addressbook / src / org / mxchange / addressbook / client / gui / SwingClient.java
index a8c1a72910e14f39b1de5455d4bc296a475e96a5..2ad4ae2d7e663d9dc103402ce49ac1ded43fa870 100644 (file)
  */
 package org.mxchange.addressbook.client.gui;
 
-import org.mxchange.addressbook.application.Application;
-import org.mxchange.addressbook.client.BaseClient;
-import org.mxchange.addressbook.client.Client;
-import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.contact.Gender;
-import org.mxchange.addressbook.exceptions.FrameAlreadyInitializedException;
-import org.mxchange.addressbook.exceptions.UnhandledUserChoiceException;
+import java.io.IOException;
+import java.sql.SQLException;
+import org.mxchange.addressbook.client.AddressbookClient;
+import org.mxchange.addressbook.client.BaseAddressbookClient;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
+import org.mxchange.jcore.application.Application;
+import org.mxchange.jcore.client.gui.ClientFrame;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
+import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
+import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
 
 /**
  *
  * @author Roland Haeder
  */
-public class SwingClient extends BaseClient implements Client {
+public class SwingClient extends BaseAddressbookClient implements AddressbookClient {
 
        /**
         * Swing frame instance
@@ -43,8 +47,6 @@ public class SwingClient extends BaseClient implements Client {
         * @param application Application instance
         */
        public SwingClient (final Application application) {
-               super();
-
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
@@ -53,6 +55,9 @@ public class SwingClient extends BaseClient implements Client {
 
                // Init frame instance
                this.frame = AddressbookFrame.getSelfInstance(this);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
        }
 
        @Override
@@ -92,6 +97,9 @@ public class SwingClient extends BaseClient implements Client {
         */
        @Override
        public Contact doEnterOwnData () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
                // Deligate this call to the frame
                return this.frame.doEnterOwnData();
        }
@@ -100,7 +108,7 @@ public class SwingClient extends BaseClient implements Client {
         * Shuts down this client
         */
        @Override
-       public void doShutdown () {
+       public void doShutdown () throws SQLException, IOException {
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
@@ -172,15 +180,15 @@ public class SwingClient extends BaseClient implements Client {
                // Debug message
                this.getLogger().trace("CALLED!"); //NOI18N
 
-               // Init contact manager here
-               this.initContactManager();
-
                try {
+                       // Init contact manager here
+                       this.initContactManager();
+
                        // Init frame
                        this.frame.init();
-               } catch (final FrameAlreadyInitializedException ex) {
-                       this.getLogger().catching(ex);
-                       System.exit(1);
+               } catch (final FrameAlreadyInitializedException | UnsupportedDatabaseBackendException | SQLException ex) {
+                       // Abort program
+                       this.abortProgramWithException(ex);
                }
 
                // Now start the frame
@@ -197,7 +205,7 @@ public class SwingClient extends BaseClient implements Client {
 
        @Override
        public void showCurrentMenu () {
-       // Debug message
+               // Debug message
                //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
 
                // Not implemented here