X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=Addressbook%2Fsrc%2Forg%2Fmxchange%2Faddressbook%2Fclient%2Fconsole%2FConsoleClient.java;h=4803fee54a1594f19e6483198a3f897b08a2741a;hb=e06df9f02fa3fc03c21d5b2c3e2c8cb476be4ea3;hp=5249c5f9fecd2a958f884821f6a1323b0ef9b048;hpb=d16c6288f14c09b779d9d8f395529d411cdd156e;p=jfinancials-swing.git diff --git a/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java index 5249c5f..4803fee 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -52,14 +52,8 @@ public class ConsoleClient extends BaseClient implements Client { // Set application instance this.setApplication(application); - // Init contact manager here - this.initContactManager(this); - // Init scanner instance this.scanner = new Scanner(System.in); - - // Fill menu map - this.fillMenuMap(); } /** @@ -71,7 +65,7 @@ public class ConsoleClient extends BaseClient implements Client { @Override public void displayAddressBox (final Contact contact) { // Simple display ... - // @todo Use mask + // @todo Use mask this.outputMessage("Strasse, PLZ Ort, Land: " + contact.getStreet() + "\n" + contact.getZipCode() + " " + contact.getCity() + "\n" + contact.getCountryCode()); } @@ -107,7 +101,18 @@ public class ConsoleClient extends BaseClient implements Client { @Override public void displayOtherDataBox (final Contact contact) { // Cellphone and such ... - this.outputMessage("Telefonnumer: " + contact.getPhoneNumber() + "\nFaxnummer: " + contact.getFaxNumber() + "\nHandy: " + contact.getCellphoneNumber() + "\nKommentar:\n" + contact.getComment()); + this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment())); + } + + /** + * Shutdown this client + */ + @Override + public void doShutdown () { + // Parent call + super.doShutdown(); + + // @TODO Add other shutdown stuff } @Override @@ -149,12 +154,12 @@ public class ConsoleClient extends BaseClient implements Client { break; case '0': // Program exit - this.disableIsRunning(); + this.getApplication().doShutdown(); break; default: // @TODO throw own exception - throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet."); + throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice)); } } @@ -257,6 +262,18 @@ public class ConsoleClient extends BaseClient implements Client { return new ConsoleMenuItem(accessKey,text); } + /** + * Inizializes this client + */ + @Override + public void initClient () { + // Init contact manager here + this.initContactManager(); + + // Fill menu map + this.fillMenuMap(); + } + /** * Displays textural message to the user * @param message @@ -290,7 +307,7 @@ public class ConsoleClient extends BaseClient implements Client { */ @Override public void showWelcome () { - this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION); + this.outputMessage("Welcome to " + AddressbookApplication.printableTitle()); this.outputMessage(""); this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");