-/*\r
- * Copyright (C) 2015 Roland Haeder\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package org.mxchange.addressbook.client;\r
-\r
-import org.mxchange.addressbook.FrameworkInterface;\r
-import org.mxchange.addressbook.contact.Contact;\r
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;\r
-\r
-/**\r
- *\r
- * @author Roland Haeder\r
- */\r
-public interface Client extends FrameworkInterface {\r
-\r
- /**\r
- * Displays a "box" for the address\r
- *\r
- * @param contact Contact to show address from\r
- */\r
- public void displayAddressBox (final Contact contact);\r
-\r
- /**\r
- * Displays a message to the user\r
- *\r
- * @param message Message to show to the user\r
- */\r
- public void displayMessage (final String message);\r
-\r
- /**\r
- * Displays a "box" for the name\r
- *\r
- * @param contact Contact to show name from\r
- */\r
- public void displayNameBox (final Contact contact);\r
-\r
- /**\r
- * Displays a "box" for other data\r
- *\r
- * @param contact Contact to show other data from\r
- */\r
- public void displayOtherDataBox (final Contact contact);\r
-\r
- /**\r
- * Asks the user for a choice and proceeds accordingly\r
- * @throws java.lang.Exception\r
- */\r
- public void doUserChoice () throws Exception ;\r
-\r
- /**\r
- * Enables isRunning attribute which singals that the client is running\r
- */\r
- public void enableIsRunning ();\r
-\r
- /**\r
- * Asks the the user to enter a single character which must match validChars\r
- * @param validChars Valid chars that are accepted\r
- * @param message Message to user\r
- * @return Allowed character\r
- */\r
- public char enterChar (final char[] validChars, final String message);\r
-\r
- /**\r
- * Reads a string of minimum and maximum length from the user\r
- * @param minLength Minimum length of the string to read\r
- * @param maxLength Maximum length of the string to read\r
- * @param message Message to user\r
- * @return \r
- */\r
- public String enterString (final int minLength, final int maxLength, final String message);\r
-\r
- /**\r
- * Setter for current menu choice\r
- * @param currentMenu Current menu choice\r
- */\r
- public void setCurrentMenu (final String currentMenu);\r
-\r
- /**\r
- * Some "Getter" for menu item\r
- * @param accessKey Key to press to access this menu\r
- * @param text Text to show to user\r
- * @return \r
- */\r
- public SelectableMenuItem getMenuItem (final char accessKey, final String text);\r
-\r
- /**\r
- * Determines whether the application is still active by checking some\r
- * conditions\r
- * \r
- * @return Whether the application is still active\r
- */\r
- public boolean isApplicationRunning ();\r
-\r
- /**\r
- * Shows given menu entry in client\r
- * @param item Menu item to show\r
- */\r
- public void showEntry (final SelectableMenuItem item);\r
-\r
- /**\r
- * Shows introduction to user\r
- */\r
- public void showWelcome ();\r
-\r
- /**\r
- * Shows current menu selection to the user\r
- */\r
- public void showCurrentMenu ();\r
-}\r
+/*
+ * Copyright (C) 2015 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.client;
+
+import org.mxchange.addressbook.FrameworkInterface;
+import org.mxchange.addressbook.exceptions.UnhandledUserChoiceException;
+import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.addressbook.menu.item.SelectableMenuItem;
+
+/**
+ * An interface for application clients
+ *
+ * @author Roland Haeder
+ */
+public interface Client extends FrameworkInterface {
+
+ /**
+ * Displays a "box" for the address
+ *
+ * @param contact Contact to show address from
+ */
+ public void displayAddressBox (final Contact contact);
+
+ /**
+ * The user changes own name data
+ *
+ * @param contact
+ */
+ public void doChangeOwnNameData (final Contact contact);
+
+ /**
+ * The user changes own address data
+ *
+ * @param contact Contact instance to change
+ */
+ public void doChangeOwnAddressData (final Contact contact);
+
+ /**
+ * The user changes own other data
+ *
+ * @param contact Constact instance to change
+ */
+ public void doChangeOwnOtherData (final Contact contact);
+
+ /**
+ * Allows the user to enter own data
+ *
+ * @return Finished Contact instance
+ */
+ public Contact doEnterOwnData ();
+
+ /**
+ * Shuts down the client and therefore whole application
+ */
+ public void doShutdown ();
+
+ /**
+ * Displays a message to the user
+ *
+ * @param message Message to show to the user
+ */
+ public void outputMessage (final String message);
+
+ /**
+ * Displays a "box" for the name
+ *
+ * @param contact Contact to show name from
+ */
+ public void displayNameBox (final Contact contact);
+
+ /**
+ * Displays a "box" for other data
+ *
+ * @param contact Contact to show other data from
+ */
+ public void displayOtherDataBox (final Contact contact);
+
+ /**
+ * Let the user choose what to change on the address: [n]ame, [a]ddress,
+ * [o]ther
+ *
+ * @param contact Contact instance to let the user change data
+ * @throws UnhandledUserChoiceException If choice is not supported
+ */
+ public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;
+
+ /**
+ * Asks the user for a choice and proceeds accordingly
+ *
+ * @throws UnhandledUserChoiceException If choice is not supported
+ */
+ public void doUserMenuChoice () throws UnhandledUserChoiceException;
+
+ /**
+ * Enables isRunning attribute which singals that the client is running
+ */
+ public void enableIsRunning ();
+
+ /**
+ * 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
+ */
+ public char enterChar (final char[] validChars, final String message);
+
+ /**
+ * Reads a string of minimum and maximum length from the user. An empty
+ * string should be generally not allowed, but might be okay for e.g.
+ * company name.
+ *
+ * @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 empty strings are allowed
+ * @return Entered string by user or null if empty string is allowed
+ */
+ public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);
+
+ /**
+ * Reads an integer (int) from the user
+ *
+ * @param minimum Minimum allowed number
+ * @param maximum Maximum allowed number
+ * @param message Message to user
+ * @return Entered string by user or null if empty string is allowed
+ */
+ public int enterInt (final int minimum, final int maximum, final String message);
+
+ /**
+ * Setter for current menu choice
+ *
+ * @param currentMenu Current menu choice
+ */
+ public void setCurrentMenu (final String currentMenu);
+
+ /**
+ * Some "Getter" for menu item
+ *
+ * @param accessKey Key to press to access this menu
+ * @param text Text to show to user
+ * @return
+ */
+ public SelectableMenuItem getMenuItem (final char accessKey, final String text);
+
+ /**
+ * Determines whether the client is still active by checking some conditions
+ *
+ * @return Whether the client is still active
+ */
+ public boolean isRunning ();
+
+ /**
+ * Shows given menu entry in client
+ *
+ * @param item Menu item to show
+ */
+ public void showEntry (final SelectableMenuItem item);
+
+ /**
+ * Shows introduction to user
+ */
+ public void showWelcome ();
+
+ /**
+ * Shows current menu selection to the user
+ */
+ public void showCurrentMenu ();
+
+ /**
+ * Inizializes this client
+ */
+ public void init ();
+}