X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Faddressbook%2Fclient%2Fconsole%2FConsoleClient.java;h=d53c53b168ce36b02952b3301cab4ea708d391cf;hb=015fbc4cc69c0bdbb644da6bab24133290e9ca68;hp=dd98ba2f70faa24f752687fe5c4e221306bcc8db;hpb=81436f1b3a103356d1580ef7be1b7306d36b2b7c;p=addressbook-swing.git diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index dd98ba2..d53c53b 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Roland Haeder + * Copyright (C) 2016 Roland Haeder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC */ public ConsoleClient (final Application application) { // Trace message - this.getLogger().logTrace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N // Set application instance this.setApplication(application); @@ -71,13 +71,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.scanner = new Scanner(System.in, "UTF-8"); //NOI18N // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void displayAddressBox (final Contact contact) { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N // Is it null? if (null == contact) { @@ -89,13 +89,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.outputMessage(MessageFormat.format("Strasse, PLZ Ort, Land: {0}\n{1} {2}\n{3}", contact.getContactStreet(), contact.getContactZipCode(), contact.getContactCity(), contact.getContactCountry())); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void displayNameBox (final Contact contact) { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N // Is it null? if (null == contact) { @@ -110,13 +110,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.outputMessage(MessageFormat.format("Anrede, Vorname, Name: {0} {1} {2}", gender, contact.getContactFirstName(), contact.getContactFamilyName())); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void displayOtherDataBox (final Contact contact) { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N // Is it null? if (null == contact) { @@ -128,13 +128,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getContactPhoneNumber(), contact.getContactFaxNumber(), contact.getContactCellphoneNumber(), contact.getContactComment())); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void doChangeOwnAddressData (final Contact contact) { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N // Is it null? if (null == contact) { @@ -170,13 +170,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC contact.setContactCountry(country); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void doChangeOwnNameData (final Contact contact) { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N // Is it null? if (null == contact) { @@ -208,13 +208,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC contact.setContactFamilyName(familyName); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void doChangeOwnOtherData (final Contact contact) { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N // Is it null? if (null == contact) { @@ -254,13 +254,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC contact.setContactComment(comment); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public Contact doEnterOwnData () { // Trace message - this.getLogger().logTrace("CALLED!"); //NOI18N + this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N // Get manager and cast it ContactFacade manager = (ContactFacade) this.getFacade(); @@ -278,7 +278,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC Contact contact = new UserContact(gender, firstName, familyName); // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N // And return object return contact; @@ -287,20 +287,20 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC @Override public void doShutdown () throws SQLException, IOException { // Trace message - this.getLogger().logTrace("CALLED!"); //NOI18N + this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N // Parent call super.doShutdown(); // TODO Add other shutdown stuff // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public void doUserMenuChoice () throws UnhandledUserChoiceException, MenuInitializationException { // Trace message - this.getLogger().logTrace("CALLED!"); //NOI18N + this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N // Get all access keys from menu char[] accessKeys = MenuTools.getAccessKeysFromMenuMap(this.getMenus(), this.getCurrentMenu()); @@ -362,13 +362,13 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override public char enterChar (final char[] validChars, final String message) { // Trace message - this.getLogger().logTrace(MessageFormat.format("validChars={0},message={1} - CALLED!", Arrays.toString(validChars), message)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("validChars={0},message={1} - CALLED!", Arrays.toString(validChars), message)); //NOI18N // The validChars must not null be null and filled with at least one char if (null == validChars) { @@ -394,7 +394,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } // Trace message - this.getLogger().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N // Return read char return input; @@ -403,7 +403,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC @Override public Gender enterGender (final String message) { // Trace message - this.getLogger().logTrace(MessageFormat.format("message={0} - CALLED!", message)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("message={0} - CALLED!", message)); //NOI18N // Get valid chars char[] validChars = Gender.validChars(); @@ -420,7 +420,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC assert (g instanceof Gender) : "g is not set."; //NOI18N // Trace message - this.getLogger().logTrace(MessageFormat.format("g={0} - EXIT!", g)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("g={0} - EXIT!", g)); //NOI18N // Return it return g; @@ -429,7 +429,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC @Override public int enterInt (final int minimum, final int maximum, final String message) { // Trace message - this.getLogger().logTrace(MessageFormat.format("minimum={0},maximum={1},message={2} - CALLED!", minimum, maximum, message)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("minimum={0},maximum={1},message={2} - CALLED!", minimum, maximum, message)); //NOI18N // Minimum should not be below zero assert (minimum >= 0) : MessageFormat.format("minimum={0} is below zero", minimum); //NOI18N @@ -447,7 +447,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } // Trace message - this.getLogger().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N // Return it return input; @@ -456,7 +456,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC @Override public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) { // Trace message - this.getLogger().logTrace(MessageFormat.format("minLength={0},maxLength={1},message={2}allowEmpty={3} - CALLED!", minLength, maxLength, message, allowEmpty)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("minLength={0},maxLength={1},message={2}allowEmpty={3} - CALLED!", minLength, maxLength, message, allowEmpty)); //NOI18N // Check on length, e.g. country codes are excactly 2 chars long assert (maxLength >= minLength); @@ -474,7 +474,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } // Trace message - this.getLogger().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N // Return it return input; @@ -489,7 +489,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC @Override public void init () { // Trace message - this.getLogger().logTrace("CALLED!"); //NOI18N + this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N // Init contact manager here try { @@ -503,7 +503,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.fillMenuMap(); // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } @Override @@ -531,16 +531,16 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC public void showWelcome () { this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle())); //NOI18N this.outputMessage(""); //NOI18N - this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software"); //NOI18N + this.outputMessage("Copyright(c) 2016 by Roland Haeder, this is free software"); //NOI18N // Debug message - this.getLogger().logDebug("Intro shown to user"); //NOI18N + this.getLoggerBeanLocal().logDebug("Intro shown to user"); //NOI18N } @Override public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException { // Trace message - this.getLogger().logTrace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N // Contact must not be null if (null == contact) { @@ -578,7 +578,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } /** @@ -591,7 +591,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC String input = this.readString(); // Debug message - this.getLogger().logDebug(MessageFormat.format("input={0}", input)); //NOI18N + this.getLoggerBeanLocal().logDebug(MessageFormat.format("input={0}", input)); //NOI18N // This must be only one character if (input.length() != 1) { @@ -613,7 +613,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC String input = this.readString(); // Debug message - this.getLogger().logDebug(MessageFormat.format("input={0}", input)); //NOI18N + this.getLoggerBeanLocal().logDebug(MessageFormat.format("input={0}", input)); //NOI18N // Init number with invalid value int num = -1; @@ -623,11 +623,11 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC num = Integer.parseInt(input); } catch (final NumberFormatException e) { this.outputMessage("Bitte geben Sie nur Zahlen ein!"); - this.getLogger().logWarning(MessageFormat.format("No numbers-only entered. input={0},message={1}", input, e.getMessage())); //NOI18N + this.getLoggerBeanLocal().logWarning(MessageFormat.format("No numbers-only entered. input={0},message={1}", input, e.getMessage())); //NOI18N } // Trace message - this.getLogger().logTrace(MessageFormat.format("num={0} - EXIT!", num)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("num={0} - EXIT!", num)); //NOI18N // Return read number return num; @@ -645,7 +645,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC @Override protected void fillMenuMap () { // Trace message - this.getLogger().logTrace("CALLED!"); //NOI18N + this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N // Initialize first (main) menu Menu menu = new ConsoleMenu("main", this); //NOI18N @@ -654,6 +654,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.getMenus().put("main", menu); //NOI18N // Trace message - this.getLogger().logTrace("EXIT!"); //NOI18N + this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N } }