* @param contact Contact instance to let the user change data\r
* @throws UnhandledUserChoiceException If choice is not supported\r
*/\r
- public void doUserChangeAdressChoice (final Contact contact) throws UnhandledUserChoiceException;\r
+ public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;\r
\r
/**\r
* Asks the user for a choice and proceeds accordingly\r
this.outputMessage("Telefonnumer: " + contact.getPhoneNumber() + "\nFaxnummer: " + contact.getFaxNumber() + "\nHandy: " + contact.getCellphoneNumber() + "\nKommentar:\n" + contact.getComment());\r
}\r
\r
- @Override\r
- public void doUserChangeAdressChoice (final Contact contact) throws UnhandledUserChoiceException {\r
- // Ask the user for editing [name], [a]ddress or [other] data\r
- 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) ");\r
-\r
- // @TODO Get rid of this ugly switch block, too\r
- switch (choice) {\r
- case 'n': // Name data\r
- this.getContactManager().changeNameData(contact, this);\r
- break;\r
-\r
- case 'a': // Address data\r
- this.getContactManager().changeAddressData(contact, this);\r
- break;\r
-\r
- case 'o': // Other data\r
- this.getContactManager().changeOtherData(contact, this);\r
- break;\r
-\r
- case 'x': // Exit this menu\r
- // Ignored as it should go back\r
- break;\r
-\r
- default:\r
- // @TODO throw own exception\r
- throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet.");\r
- }\r
- }\r
-\r
@Override\r
public void doUserMenuChoice () throws UnhandledUserChoiceException {\r
// Get all access keys from menu\r
// @TODO Rewrite this ugly switch() block\r
switch (choice) {\r
case '1': // Enter/add own data\r
- this.getContactManager().enterOwnData();\r
+ this.getContactManager().doEnterOwnData();\r
break;\r
\r
case '2': // Change own data\r
*/\r
@Override\r
public void showWelcome () {\r
- this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION);\r
- this.outputMessage("");\r
- this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");\r
- \r
- // Debug message\r
- this.getLogger().debug("Intro shown to user");\r
+ this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION);\r
+ this.outputMessage("");\r
+ this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");\r
+ \r
+ // Debug message\r
+ this.getLogger().debug("Intro shown to user");\r
}\r
\r
+ @Override\r
+ public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {\r
+ // Ask the user for editing [name], [a]ddress or [other] data\r
+ 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) ");\r
+ \r
+ // @TODO Get rid of this ugly switch block, too\r
+ switch (choice) {\r
+ case 'n': // Name data\r
+ this.getContactManager().doChangeNameData(contact, this);\r
+ break;\r
+ \r
+ case 'a': // Address data\r
+ this.getContactManager().doChangeAddressData(contact, this);\r
+ break;\r
+ \r
+ case 'o': // Other data\r
+ this.getContactManager().doChangeOtherData(contact, this);\r
+ break;\r
+ \r
+ case 'x': // Exit this menu\r
+ // Ignored as it should go back\r
+ break;\r
+ \r
+ default:\r
+ // @TODO throw own exception\r
+ throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet.");\r
+ }\r
+ }\r
+\r
/**\r
* Fills menu map with menu entries\r
*/\r
throw new UnsupportedOperationException("Not supported yet.");\r
}\r
\r
+ /**\r
+ * Let the user change other address\r
+ */\r
+ @Override\r
+ public void changeOtherAddress () {\r
+ throw new UnsupportedOperationException("Not supported yet.");\r
+ }\r
+\r
+ /**\r
+ * Allows the user to change his/her own data\r
+ */\r
+ @Override\r
+ public void changeOwnData () {\r
+ /*\r
+ * First check if the user has registered own contact, before that\r
+ * nothing can be changed.\r
+ */\r
+ if (!this.isOwnContactAdded()) {\r
+ // Not added\r
+ this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben.");\r
+ \r
+ // Skip any below code\r
+ return;\r
+ }\r
+ \r
+ // Instance\r
+ Contact contact = this.getOwnContact();\r
+ \r
+ // It must be found\r
+ assert(contact instanceof Contact);\r
+ \r
+ // Display contact\r
+ contact.show(this.getClient());\r
+ \r
+ try {\r
+ // Ask user what to change\r
+ this.getClient().userChooseChangeContactData(contact);\r
+ } catch (final UnhandledUserChoiceException ex) {\r
+ this.getLogger().catching(ex);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Let the user delete other address\r
+ */\r
+ @Override\r
+ public void deleteOtherAddress () {\r
+ throw new UnsupportedOperationException("Not supported yet.");\r
+ }\r
+\r
/**\r
* Let the user change address data\r
* \r
* @param client Client instance to call back\r
*/\r
@Override\r
- public void changeAddressData (final Contact contact, final Client client) {\r
+ public void doChangeAddressData (final Contact contact, final Client client) {\r
// First display it again\r
client.displayAddressBox(contact);\r
\r
* @param client Client instance to call back\r
*/\r
@Override\r
- public void changeNameData (final Contact contact, final Client client) {\r
+ public void doChangeNameData (final Contact contact, final Client client) {\r
// First display them again\r
client.displayNameBox(contact);\r
\r
}\r
}\r
\r
- /**\r
- * Let the user change other address\r
- */\r
- @Override\r
- public void changeOtherAddress () {\r
- throw new UnsupportedOperationException("Not supported yet.");\r
- }\r
-\r
/**\r
* Let the user change other data\r
*\r
* @param client Client instance to call back\r
*/\r
@Override\r
- public void changeOtherData (final Contact contact, final Client client) {\r
- throw new UnsupportedOperationException("Not supported yet.");\r
- }\r
-\r
- /**\r
- * Allows the user to change his/her own data\r
- */\r
- @Override\r
- public void changeOwnData () {\r
- /*\r
- * First check if the user has registered own contact, before that \r
- * nothing can be changed.\r
- */\r
- if (!this.isOwnContactAdded()) {\r
- // Not added\r
- this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben.");\r
-\r
- // Skip any below code\r
- return;\r
- }\r
-\r
- // Instance\r
- Contact contact = this.getOwnContact();\r
-\r
- // It must be found\r
- assert(contact instanceof Contact);\r
-\r
- // Display contact\r
- contact.show(this.getClient());\r
-\r
- try {\r
- // Ask user what to change\r
- this.getClient().doUserChangeAdressChoice(contact);\r
- } catch (final UnhandledUserChoiceException ex) {\r
- this.getLogger().catching(ex);\r
- }\r
- }\r
-\r
- /**\r
- * Let the user delete other address\r
- */\r
- @Override\r
- public void deleteOtherAddress () {\r
+ public void doChangeOtherData (final Contact contact, final Client client) {\r
throw new UnsupportedOperationException("Not supported yet.");\r
}\r
\r
* Asks user for own data\r
*/\r
@Override\r
- public void enterOwnData () {\r
+ public void doEnterOwnData () {\r
// First ask for gender\r
char gender = this.enterOwnGender();\r
\r
* @param contact Instance to change data\r
* @param client Client instance to call back\r
*/\r
- public void changeAddressData (final Contact contact, final Client client);\r
+ public void doChangeAddressData (final Contact contact, final Client client);\r
\r
/**\r
* The user can change name data, like gender, surname, family name and\r
* @param contact Instance to change data\r
* @param client Client instance to call back\r
*/\r
- public void changeNameData (final Contact contact, final Client client);\r
+ public void doChangeNameData (final Contact contact, final Client client);\r
\r
/**\r
* Let the user change other address\r
* @param contact Instance to change data\r
* @param client Client instance to call back\r
*/\r
- public void changeOtherData (final Contact contact, final Client client);\r
+ public void doChangeOtherData (final Contact contact, final Client client);\r
\r
/**\r
* Let the user change own data\r
/**\r
* Asks user for own data\r
*/\r
- public void enterOwnData ();\r
+ public void doEnterOwnData ();\r
\r
/**\r
* Getter for size\r