]> git.mxchange.org Git - jfinancials-swing.git/blobdiff - Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
Added a lot stuff:
[jfinancials-swing.git] / Addressbook / src / org / mxchange / addressbook / client / console / ConsoleClient.java
index 5249c5f9fecd2a958f884821f6a1323b0ef9b048..4803fee54a1594f19e6483198a3f897b08a2741a 100644 (file)
@@ -52,14 +52,8 @@ public class ConsoleClient extends BaseClient implements Client {
        // Set application instance\r
        this.setApplication(application);\r
 \r
-       // Init contact manager here\r
-       this.initContactManager(this);\r
-\r
        // Init scanner instance\r
        this.scanner = new Scanner(System.in);\r
-\r
-       // Fill menu map\r
-       this.fillMenuMap();\r
     }\r
 \r
     /**\r
@@ -71,7 +65,7 @@ public class ConsoleClient extends BaseClient implements Client {
     @Override\r
     public void displayAddressBox (final Contact contact) {\r
        // Simple display ...\r
-        // @todo Use mask\r
+       // @todo Use mask\r
        this.outputMessage("Strasse, PLZ Ort, Land: " + contact.getStreet() + "\n" + contact.getZipCode() + " " + contact.getCity() +  "\n" + contact.getCountryCode());\r
     }\r
 \r
@@ -107,7 +101,18 @@ public class ConsoleClient extends BaseClient implements Client {
     @Override\r
     public void displayOtherDataBox (final Contact contact) {\r
        // Cellphone and such ...\r
-       this.outputMessage("Telefonnumer: " + contact.getPhoneNumber() + "\nFaxnummer: " + contact.getFaxNumber() + "\nHandy: " + contact.getCellphoneNumber() + "\nKommentar:\n" + contact.getComment());\r
+       this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));\r
+    }\r
+\r
+    /**\r
+     * Shutdown this client\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
@@ -149,12 +154,12 @@ public class ConsoleClient extends BaseClient implements Client {
                break;\r
 \r
            case '0': // Program exit\r
-               this.disableIsRunning();\r
+               this.getApplication().doShutdown();\r
                break;\r
        \r
            default:\r
                // @TODO throw own exception\r
-               throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet.");\r
+               throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));\r
        }\r
     }\r
 \r
@@ -257,6 +262,18 @@ public class ConsoleClient extends BaseClient implements Client {
        return new ConsoleMenuItem(accessKey,text);\r
     }\r
 \r
+    /**\r
+     * Inizializes this client\r
+     */\r
+    @Override\r
+    public void initClient () {\r
+       // Init contact manager here\r
+       this.initContactManager();\r
+       \r
+       // Fill menu map\r
+       this.fillMenuMap();\r
+    }\r
+\r
     /**\r
      * Displays textural message to the user\r
      * @param message\r
@@ -290,7 +307,7 @@ public class ConsoleClient extends BaseClient implements Client {
      */\r
     @Override\r
     public void showWelcome () {\r
-       this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION);\r
+       this.outputMessage("Welcome to " + AddressbookApplication.printableTitle());\r
        this.outputMessage("");\r
        this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");\r
        \r