* @author Roland Haeder
*/
public class ConsoleClient extends BaseClient implements Client {
- /**
- * Scanner instance for reading data from console input
- */
- private final Scanner scanner;
-
- /**
- * Parameterless constructor
- * @param application An instance of an Application class
- */
- public ConsoleClient (final Application application) {
- super();
-
- // Set application instance
- this.setApplication(application);
-
- // Init scanner instance
- this.scanner = new Scanner(System.in);
- }
-
- /**
- * Displays a textual address "box" of given contact
- *
- * @param contact Contact to show address for
- */
- @Override
- public void displayAddressBox (final Contact contact) {
- // Simple display ...
- this.outputMessage(MessageFormat.format("Strasse, PLZ Ort, Land: {0}\n{1} {2}\n{3}", contact.getStreet(), contact.getZipCode(), contact.getCity(), contact.getCountryCode()));
- }
-
- /**
- * Displays a textual name "box" of given contact
- *
- * @param contact Contact to show name for
- */
- @Override
- public void displayNameBox (final Contact contact) {
- // Get translated gender as the user may want to see "Mr.", "Mrs."
- String gender = contact.getTranslatedGender();
-
- // Get company name
- String companyName = contact.getCompanyName();
-
- // If it is empty/null, then assume private contact
- if ((companyName == null) || (companyName.isEmpty())) {
- // Now put all together: gender, surname, family name
- // @todo Use mask
- this.outputMessage(MessageFormat.format("Anrede, Vorname, Name: {0} {1} {2}", gender, contact.getSurname(), contact.getFamilyName()));
- } else {
- // Company contact
- this.outputMessage(MessageFormat.format("Firma: {0}\nAnsprechpartner: {1} {2} {3}", companyName, gender, contact.getSurname(), contact.getFamilyName()));
+
+ /**
+ * Scanner instance for reading data from console input
+ */
+ private final Scanner scanner;
+
+ /**
+ * Parameterless constructor
+ *
+ * @param application An instance of an Application class
+ */
+ public ConsoleClient (final Application application) {
+ super();
+
+ // Set application instance
+ this.setApplication(application);
+
+ // Init scanner instance
+ this.scanner = new Scanner(System.in);
+ }
+
+ /**
+ * Displays a textual address "box" of given contact
+ *
+ * @param contact Contact to show address for
+ */
+ @Override
+ public void displayAddressBox (final Contact contact) {
+ // Simple display ...
+ this.outputMessage(MessageFormat.format("Strasse, PLZ Ort, Land: {0}\n{1} {2}\n{3}", contact.getStreet(), contact.getZipCode(), contact.getCity(), contact.getCountryCode()));
+ }
+
+ /**
+ * Displays a textual name "box" of given contact
+ *
+ * @param contact Contact to show name for
+ */
+ @Override
+ public void displayNameBox (final Contact contact) {
+ // Get translated gender as the user may want to see "Mr.", "Mrs."
+ String gender = contact.getTranslatedGender();
+
+ // Get company name
+ String companyName = contact.getCompanyName();
+
+ // If it is empty/null, then assume private contact
+ if ((companyName == null) || (companyName.isEmpty())) {
+ // Now put all together: gender, surname, family name
+ // @todo Use mask
+ this.outputMessage(MessageFormat.format("Anrede, Vorname, Name: {0} {1} {2}", gender, contact.getSurname(), contact.getFamilyName()));
+ } else {
+ // Company contact
+ this.outputMessage(MessageFormat.format("Firma: {0}\nAnsprechpartner: {1} {2} {3}", companyName, gender, contact.getSurname(), contact.getFamilyName()));
+ }
+ }
+
+ /**
+ * Displays a textual other data "box" of given contact
+ *
+ * @param contact Contact to show other data for
+ */
+ @Override
+ public void displayOtherDataBox (final Contact contact) {
+ // Cellphone and such ...
+ this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));
+ }
+
+ @Override
+ public void doChangeOwnAddressData (final Contact contact) {
+ // Make sure it is own contact
+ if (!contact.isOwnContact()) {
+ // Not own contact
+ throw new IllegalArgumentException("Contact is not own data.");
+ }
+
+ // Own address data
+ String street = this.getContactManager().enterOwnStreet();
+
+ // Get zip code
+ int zipCode = this.getContactManager().enterOwnZipCode();
+
+ // Get city name
+ String city = this.getContactManager().enterOwnCity();
+
+ // Get country code
+ String countryCode = this.getContactManager().enterOwnCountryCode();
+
+ // Update address data
+ contact.updateAddressData(street, zipCode, city, countryCode);
+ }
+
+ @Override
+ public void doChangeOwnNameData (final Contact contact) {
+ // Make sure it is own contact
+ if (!contact.isOwnContact()) {
+ // Not own contact
+ throw new IllegalArgumentException("Contact is not own data.");
+ }
+
+ // Gender:
+ char gender = this.getContactManager().enterOwnGender();
+
+ // Surname
+ String surname = this.getContactManager().enterOwnSurname();
+
+ // Family name
+ String familyName = this.getContactManager().enterOwnFamilyName();
+
+ // And company
+ String companyName = this.getContactManager().enterOwnCompanyName();
+
+ // Update contact instance
+ contact.updateNameData(gender, surname, familyName, companyName);
+ }
+
+ @Override
+ public void doChangeOwnOtherData (final Contact contact) {
+ // Make sure it is own contact
+ if (!contact.isOwnContact()) {
+ // Not own contact
+ throw new IllegalArgumentException("Contact is not own data.");
+ }
+
+ // Phone number
+ String phoneNumber = this.getContactManager().enterOwnPhoneNumber();
+
+ // Phone number
+ String cellNumber = this.getContactManager().enterOwnCellNumber();
+
+ // Fax number
+ String faxNumber = this.getContactManager().enterOwnFaxNumber();
+
+ // Email address
+ String email = this.getContactManager().enterOwnEmailAddress();
+
+ // Comment
+ String comment = this.getContactManager().enterOwnComment();
+
+ // Update contact instance
+ contact.updateOtherData(phoneNumber, cellNumber, faxNumber, email, null, comment);
+ }
+
+ @Override
+ public Contact doEnterOwnData () {
+ // First ask for gender
+ char gender = this.getContactManager().enterOwnGender();
+
+ // 2nd for surname
+ String surname = this.getContactManager().enterOwnSurname();
+
+ // And 3rd for family name
+ String familyName = this.getContactManager().enterOwnFamilyName();
+
+ // Company name ...
+ String companyName = this.getContactManager().enterOwnCompanyName();
+
+ // Construct UserContact instance
+ Contact contact = new UserContact(gender, surname, familyName, companyName);
+
+ // And return object
+ return contact;
}
- }
-
- /**
- * Displays a textual other data "box" of given contact
- *
- * @param contact Contact to show other data for
- */
- @Override
- public void displayOtherDataBox (final Contact contact) {
- // Cellphone and such ...
- this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));
- }
-
- @Override
- public void doChangeOwnAddressData (final Contact contact) {
- // Make sure it is own contact
- if (!contact.isOwnContact()) {
- // Not own contact
- throw new IllegalArgumentException("Contact is not own data.");
+
+ /**
+ * Shutdown this client
+ */
+ @Override
+ public void doShutdown () {
+ // Parent call
+ super.doShutdown();
+
+ // @TODO Add other shutdown stuff
}
- // Own address data
- String street = this.getContactManager().enterOwnStreet();
+ @Override
+ public void doUserMenuChoice () throws UnhandledUserChoiceException {
+ // Get all access keys from menu
+ char[] accessKeys = MenuTools.getAccessKeysFromMenuMap(this.getMenus(), this.getCurrentMenu());
+
+ // Output textural message and ask for a char as input
+ char choice = this.enterChar(accessKeys, "Bitte Auswahl eingeben (0=Programm beenden): ");
- // Get zip code
- int zipCode = this.getContactManager().enterOwnZipCode();
+ // @TODO Rewrite this ugly switch() block
+ switch (choice) {
+ case '1': // Enter/add own data
+ this.getContactManager().doEnterOwnData();
+ break;
- // Get city name
- String city = this.getContactManager().enterOwnCity();
+ case '2': // Change own data
+ this.getContactManager().doChangeOwnData();
+ break;
- // Get country code
- String countryCode = this.getContactManager().enterOwnCountryCode();
+ case '3': // Add new addess
+ this.getContactManager().doAddOtherAddress();
+ break;
- // Update address data
- contact.updateAddressData(street, zipCode, city, countryCode);
- }
+ case '4': // List contacts
+ this.getContactManager().doListContacts();
+ break;
- @Override
- public void doChangeOwnNameData (final Contact contact) {
- // Make sure it is own contact
- if (!contact.isOwnContact()) {
- // Not own contact
- throw new IllegalArgumentException("Contact is not own data.");
+ case '5': // Search addresses
+ this.getContactManager().doSearchContacts();
+ break;
+
+ case '6': // Change other addess
+ this.getContactManager().doChangeOtherAddress();
+ break;
+
+ case '7': // Delete other address
+ this.getContactManager().doDeleteOtherAddress();
+ break;
+
+ case '0': // Program exit
+ this.getApplication().doShutdown();
+ break;
+
+ default:
+ // @TODO throw own exception
+ throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
+ }
}
- // Gender:
- char gender = this.getContactManager().enterOwnGender();
+ /**
+ * Asks the the user to enter a single character which must match validChars
+ *
+ * @param validChars Valid chars that are accepted
+ * @param message Message to user
+ * @return Allowed character
+ */
+ @Override
+ public char enterChar (final char[] validChars, final String message) {
+ char input = 0;
+
+ // Sort array, else binarySearch() won't work
+ Arrays.sort(validChars);
+
+ // Keep asking until valid char has been entered
+ while (Arrays.binarySearch(validChars, input) < 0) {
+ // Output message
+ System.out.print(message);
+
+ // Read char
+ input = this.readChar();
+ }
+
+ // Return read char
+ return input;
+ }
+
+ /**
+ * Reads an integer (int) with a textural message from the user
+ *
+ * @param minimum Minimum allowed number
+ * @param maximum Maximum allowed number
+ * @param message Messager to display in console
+ * @return
+ */
+ @Override
+ public int enterInt (final int minimum, final int maximum, final String message) {
+ // Minimum should not be below zero
+ assert (minimum >= 0);
+ assert (maximum > minimum);
+
+ // Init input
+ int input = -1;
+
+ while ((input < minimum) || (input > maximum)) {
+ // Output message
+ System.out.print(message);
+
+ // Read integer from user
+ input = this.readInt();
+ }
+
+ // Return it
+ return input;
+ }
- // Surname
- String surname = this.getContactManager().enterOwnSurname();
+ /**
+ * Reads a string of minimum and maximum length from the user
+ *
+ * @param minLength Minimum length of the string to read
+ * @param maxLength Maximum length of the string to read
+ * @param message Message to user
+ * @param allowEmpty Whether to allow empty string
+ * @return Entered string by user or null for empty strings
+ */
+ @Override
+ public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
+ // Check on length, e.g. country codes are excactly 2 chars long
+ assert (maxLength >= minLength);
+
+ // Init input
+ String input = null;
+
+ // Check if it is to short or to long
+ while (((input == null) || ((input.length() < minLength) && (!allowEmpty))) || ((input.length() > 0) && (input.length() < minLength) && (allowEmpty)) || ((input instanceof String) && (input.length() > maxLength))) {
+ // Output message
+ System.out.print(message);
+
+ // Read line
+ input = this.readString();
+ }
+
+ // Return it
+ return input;
+ }
- // Family name
- String familyName = this.getContactManager().enterOwnFamilyName();
+ /**
+ * Returns a console menu item
+ *
+ * @param accessKey Key to access the menu
+ * @param text Text to show to user
+ * @return A SelectableMenuItem
+ * @todo Make sure the access key is unique
+ */
+ @Override
+ public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
+ // Return a new console menu item
+ return new ConsoleMenuItem(accessKey, text);
+ }
- // And company
- String companyName = this.getContactManager().enterOwnCompanyName();
+ /**
+ * Inizializes this client
+ */
+ @Override
+ public void init () {
+ // Init contact manager here
+ this.initContactManager();
- // Update contact instance
- contact.updateNameData(gender, surname, familyName, companyName);
- }
+ // Fill menu map
+ this.fillMenuMap();
+ }
- @Override
- public void doChangeOwnOtherData (final Contact contact) {
- // Make sure it is own contact
- if (!contact.isOwnContact()) {
- // Not own contact
- throw new IllegalArgumentException("Contact is not own data.");
+ /**
+ * Displays textural message to the user
+ *
+ * @param message
+ */
+ @Override
+ public void outputMessage (final String message) {
+ System.out.println(message);
}
- // Phone number
- String phoneNumber = this.getContactManager().enterOwnPhoneNumber();
-
- // Phone number
- String cellNumber = this.getContactManager().enterOwnCellNumber();
-
- // Fax number
- String faxNumber = this.getContactManager().enterOwnFaxNumber();
-
- // Email address
- String email = this.getContactManager().enterOwnEmailAddress();
-
- // Comment
- String comment = this.getContactManager().enterOwnComment();
-
- // Update contact instance
- contact.updateOtherData(phoneNumber, cellNumber, faxNumber, email, null, comment);
- }
-
- @Override
- public Contact doEnterOwnData () {
- // First ask for gender
- char gender = this.getContactManager().enterOwnGender();
-
- // 2nd for surname
- String surname = this.getContactManager().enterOwnSurname();
-
- // And 3rd for family name
- String familyName = this.getContactManager().enterOwnFamilyName();
-
- // Company name ...
- String companyName = this.getContactManager().enterOwnCompanyName();
-
- // Construct UserContact instance
- Contact contact = new UserContact(gender, surname, familyName, companyName);
-
- // And return object
- return contact;
- }
-
- /**
- * Shutdown this client
- */
- @Override
- public void doShutdown () {
- // Parent call
- super.doShutdown();
-
- // @TODO Add other shutdown stuff
- }
-
- @Override
- public void doUserMenuChoice () throws UnhandledUserChoiceException {
- // Get all access keys from menu
- char[] accessKeys = MenuTools.getAccessKeysFromMenuMap(this.getMenus(), this.getCurrentMenu());
-
- // Output textural message and ask for a char as input
- char choice = this.enterChar(accessKeys, "Bitte Auswahl eingeben (0=Programm beenden): ");
-
- // @TODO Rewrite this ugly switch() block
- switch (choice) {
- case '1': // Enter/add own data
- this.getContactManager().doEnterOwnData();
- break;
-
- case '2': // Change own data
- this.getContactManager().doChangeOwnData();
- break;
-
- case '3': // Add new addess
- this.getContactManager().doAddOtherAddress();
- break;
-
- case '4': // List contacts
- this.getContactManager().doListContacts();
- break;
-
- case '5': // Search addresses
- this.getContactManager().doSearchContacts();
- break;
-
- case '6': // Change other addess
- this.getContactManager().doChangeOtherAddress();
- break;
-
- case '7': // Delete other address
- this.getContactManager().doDeleteOtherAddress();
- break;
-
- case '0': // Program exit
- this.getApplication().doShutdown();
- break;
-
- default:
- // @TODO throw own exception
- throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
+ /**
+ * Shows textural menu on console
+ */
+ @Override
+ public void showCurrentMenu () {
+ this.showMenu(this.getCurrentMenu());
}
- }
-
- /**
- * Asks the the user to enter a single character which must match validChars
- * @param validChars Valid chars that are accepted
- * @param message Message to user
- * @return Allowed character
- */
- @Override
- public char enterChar (final char[] validChars, final String message) {
- char input = 0;
-
- // Sort array, else binarySearch() won't work
- Arrays.sort(validChars);
-
- // Keep asking until valid char has been entered
- while (Arrays.binarySearch(validChars, input) < 0) {
- // Output message
- System.out.print(message);
-
- // Read char
- input = this.readChar();
+
+ /**
+ * Shows given menu entry to user
+ *
+ * @param item Menu entry
+ */
+ @Override
+ public void showEntry (final SelectableMenuItem item) {
+ // Access key then text
+ this.outputMessage("[" + item.getAccessKey() + "] " + item.getText());
}
- // Return read char
- return input;
- }
-
- /**
- * Reads an integer (int) with a textural message from the user
- *
- * @param minimum Minimum allowed number
- * @param maximum Maximum allowed number
- * @param message Messager to display in console
- * @return
- */
- @Override
- public int enterInt (final int minimum, final int maximum, final String message) {
- // Minimum should not be below zero
- assert(minimum >= 0);
- assert(maximum > minimum);
-
- // Init input
- int input = -1;
-
- while ((input < minimum) || (input > maximum)) {
- // Output message
- System.out.print(message);
-
- // Read integer from user
- input = this.readInt();
+ /**
+ * Shows a textural message to the user
+ */
+ @Override
+ public void showWelcome () {
+ this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle()));
+ this.outputMessage("");
+ this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");
+
+ // Debug message
+ this.getLogger().debug("Intro shown to user");
}
- // Return it
- return input;
- }
-
- /**
- * Reads a string of minimum and maximum length from the user
- *
- * @param minLength Minimum length of the string to read
- * @param maxLength Maximum length of the string to read
- * @param message Message to user
- * @param allowEmpty Whether to allow empty string
- * @return Entered string by user or null for empty strings
- */
- @Override
- public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
- // Check on length, e.g. country codes are excactly 2 chars long
- assert(maxLength >= minLength);
-
- // Init input
- String input = null;
-
- // Check if it is to short or to long
- while (((input == null) || ((input.length() < minLength) && (!allowEmpty))) || ((input.length() > 0) && (input.length() < minLength) && (allowEmpty)) || ((input instanceof String) && (input.length() > maxLength))) {
- // Output message
- System.out.print(message);
-
- // Read line
- input = this.readString();
+ @Override
+ public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
+ // Ask the user for editing [name], [a]ddress or [other] data
+ char choice = this.enterChar(new char[] {'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
+
+ // @TODO Get rid of this ugly switch block, too
+ switch (choice) {
+ case 'n': // Name data
+ this.getContactManager().doChangeNameData(contact, this);
+ break;
+
+ case 'a': // Address data
+ this.getContactManager().doChangeAddressData(contact, this);
+ break;
+
+ case 'o': // Other data
+ this.getContactManager().doChangeOtherData(contact, this);
+ break;
+
+ case 'x': // Exit this menu
+ // Ignored as it should go back
+ break;
+
+ default:
+ // @TODO throw own exception
+ throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
+ }
}
- // Return it
- return input;
- }
-
- /**
- * Returns a console menu item
- *
- * @param accessKey Key to access the menu
- * @param text Text to show to user
- * @return A SelectableMenuItem
- * @todo Make sure the access key is unique
- */
- @Override
- public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
- // Return a new console menu item
- return new ConsoleMenuItem(accessKey,text);
- }
-
- /**
- * Inizializes this client
- */
- @Override
- public void init () {
- // Init contact manager here
- this.initContactManager();
-
- // Fill menu map
- this.fillMenuMap();
- }
-
- /**
- * Displays textural message to the user
- * @param message
- */
- @Override
- public void outputMessage (final String message) {
- System.out.println(message);
- }
-
- /**
- * Shows textural menu on console
- */
- @Override
- public void showCurrentMenu () {
- this.showMenu(this.getCurrentMenu());
- }
-
- /**
- * Shows given menu entry to user
- *
- * @param item Menu entry
- */
- @Override
- public void showEntry (final SelectableMenuItem item) {
- // Access key then text
- this.outputMessage("[" + item.getAccessKey() + "] " + item.getText());
- }
-
- /**
- * Shows a textural message to the user
- */
- @Override
- public void showWelcome () {
- this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle()));
- this.outputMessage("");
- this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");
-
- // Debug message
- this.getLogger().debug("Intro shown to user");
- }
-
- @Override
- public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
- // Ask the user for editing [name], [a]ddress or [other] data
- char choice = this.enterChar(new char[]{'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
-
- // @TODO Get rid of this ugly switch block, too
- switch (choice) {
- case 'n': // Name data
- this.getContactManager().doChangeNameData(contact, this);
- break;
-
- case 'a': // Address data
- this.getContactManager().doChangeAddressData(contact, this);
- break;
-
- case 'o': // Other data
- this.getContactManager().doChangeOtherData(contact, this);
- break;
-
- case 'x': // Exit this menu
- // Ignored as it should go back
- break;
-
- default:
- // @TODO throw own exception
- throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));
+ /**
+ * Reads one character
+ *
+ * @return A single character
+ */
+ private char readChar () {
+ // Read line
+ String input = this.scanner.nextLine();
+
+ // This must be only one character
+ if (input.length() != 1) {
+ // Return zero
+ return 0;
+ }
+
+ // Get char from first (and only) position
+ return input.charAt(0);
}
- }
-
- /**
- * Reads one character
- *
- * @return A single character
- */
- private char readChar () {
- // Read line
- String input = this.scanner.nextLine();
-
- // This must be only one character
- if (input.length() != 1) {
- // Return zero
- return 0;
+
+ /**
+ * Reads an integer (int) from user
+ *
+ * @return An integer number
+ */
+ private int readInt () {
+ // First read a string
+ String input = this.readString();
+
+ // Init number with invalid value
+ int num = -1;
+
+ // Parse number, this can be risky
+ try {
+ num = Integer.parseInt(input);
+ } catch (final NumberFormatException e) {
+ this.outputMessage("Bitte geben Sie nur Zahlen ein!");
+ this.getLogger().warn(MessageFormat.format("No numbers-only entered. input={0},message={1}", input, e.getMessage()));
+ }
+
+ // Return read number
+ return num;
}
- // Get char from first (and only) position
- return input.charAt(0);
- }
-
- /**
- * Reads an integer (int) from user
- *
- * @return An integer number
- */
- private int readInt () {
- // First read a string
- String input = this.readString();
-
- // Init number with invalid value
- int num = -1;
-
- // Parse number, this can be risky
- try {
- num = Integer.parseInt(input);
- } catch (final NumberFormatException e) {
- this.outputMessage("Bitte geben Sie nur Zahlen ein!");
- this.getLogger().warn(MessageFormat.format("No numbers-only entered. input={0},message={1}", input, e.getMessage()));
+ /**
+ * Reads a string from a scanner until RETURN is pressed
+ *
+ * @return Read string from scanner
+ */
+ private String readString () {
+ return this.scanner.nextLine();
}
- // Return read number
- return num;
- }
-
- /**
- * Reads a string from a scanner until RETURN is pressed
- *
- * @return Read string from scanner
- */
- private String readString () {
- return this.scanner.nextLine();
- }
-
- /**
- * Fills menu map with menu entries
- */
- @Override
- protected final void fillMenuMap () {
- // Initialize first (main) menu
- Menu menu = new ConsoleMenu("main", this);
-
- // Add it
- this.getMenus().put("main", menu);
- }
+ /**
+ * Fills menu map with menu entries
+ */
+ @Override
+ protected final void fillMenuMap () {
+ // Initialize first (main) menu
+ Menu menu = new ConsoleMenu("main", this);
+
+ // Add it
+ this.getMenus().put("main", menu);
+ }
}