]> git.mxchange.org Git - jfinancials-lib.git/blobdiff - Addressbook/src/org/mxchange/addressbook/client/Client.java
Added a lot stuff:
[jfinancials-lib.git] / Addressbook / src / org / mxchange / addressbook / client / Client.java
index 545389447fecdd1284b8c8a6809d289bdc98ca90..0d5e154d0da157444773c1532a7784c26aac4983 100644 (file)
 package org.mxchange.addressbook.client;\r
 \r
 import org.mxchange.addressbook.FrameworkInterface;\r
+import org.mxchange.addressbook.UnhandledUserChoiceException;\r
 import org.mxchange.addressbook.contact.Contact;\r
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;\r
 \r
 /**\r
- *\r
+ * An interface for application clients\r
+ * \r
  * @author Roland Haeder\r
  */\r
 public interface Client extends FrameworkInterface {\r
@@ -33,12 +35,17 @@ public interface Client extends FrameworkInterface {
      */\r
     public void displayAddressBox (final Contact contact);\r
 \r
+    /**\r
+     * Shuts down the client and therefore whole application\r
+     */\r
+    public void doShutdown ();\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
+    public void outputMessage (final String message);\r
 \r
     /**\r
      * Displays a "box" for the name\r
@@ -54,19 +61,30 @@ public interface Client extends FrameworkInterface {
      */\r
     public void displayOtherDataBox (final Contact contact);\r
 \r
+    /**\r
+     * Let the user choose what to change on the address: [n]ame, [a]ddress,\r
+     * [o]ther\r
+     * \r
+     * @param contact Contact instance to let the user change data\r
+     * @throws UnhandledUserChoiceException If choice is not supported\r
+     */\r
+    public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;\r
+\r
     /**\r
      * Asks the user for a choice and proceeds accordingly\r
-     * @throws java.lang.Exception\r
+     * \r
+     * @throws UnhandledUserChoiceException If choice is not supported\r
      */\r
-    public void doUserChoice () throws Exception ;\r
+    public void doUserMenuChoice () throws UnhandledUserChoiceException ;\r
 \r
     /**\r
      * Enables isRunning attribute which singals that the client is running\r
      */\r
-    public void enableIsRunning ();\r
+    public void enableIsRunning();\r
 \r
     /**\r
      * Asks the the user to enter a single character which must match validChars\r
+     * \r
      * @param  validChars  Valid chars that are accepted\r
      * @param  message     Message to user\r
      * @return Allowed character\r
@@ -74,22 +92,38 @@ public interface Client extends FrameworkInterface {
     public char enterChar (final char[] validChars, final String message);\r
 \r
     /**\r
-     * Reads a string of minimum and maximum length from the user\r
+     * Reads a string of minimum and maximum length from the user. An empty\r
+     * string should be generally not allowed, but might be okay for e.g.\r
+     * company name.\r
+     * \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
+     * @param allowEmpty Whether empty strings are allowed\r
+     * @return Entered string by user or null if empty string is allowed\r
      */\r
-    public String enterString (final int minLength, final int maxLength, final String message);\r
+    public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);\r
+\r
+    /**\r
+     * Reads an integer (int) from the user\r
+     * \r
+     * @param minimum Minimum allowed number\r
+     * @param maximum Maximum allowed number\r
+     * @param message  Message to user\r
+     * @return Entered string by user or null if empty string is allowed\r
+     */\r
+    public int enterInt (final int minimum, final int maximum, final String message);\r
 \r
     /**\r
      * Setter for current menu choice\r
+     * \r
      * @param currentMenu Current menu choice\r
      */\r
     public void setCurrentMenu (final String currentMenu);\r
 \r
     /**\r
      * Some "Getter" for menu item\r
+     * \r
      * @param accessKey Key to press to access this menu\r
      * @param text Text to show to user\r
      * @return \r
@@ -97,15 +131,16 @@ public interface Client extends FrameworkInterface {
     public SelectableMenuItem getMenuItem (final char accessKey, final String text);\r
 \r
     /**\r
-     * Determines whether the application is still active by checking some\r
+     * Determines whether the client is still active by checking some\r
      * conditions\r
      * \r
-     * @return Whether the application is still active\r
+     * @return Whether the client is still active\r
      */\r
-    public boolean isApplicationRunning ();\r
+    public boolean isRunning();\r
 \r
     /**\r
      * Shows given menu entry in client\r
+     * \r
      * @param item Menu item to show\r
      */\r
     public void showEntry (final SelectableMenuItem item);\r
@@ -113,10 +148,15 @@ public interface Client extends FrameworkInterface {
     /**\r
      * Shows introduction to user\r
      */\r
-    public void showWelcome ();\r
+    public void showWelcome();\r
 \r
     /**\r
      * Shows current menu selection to the user\r
      */\r
-    public void showCurrentMenu ();\r
+    public void showCurrentMenu();\r
+\r
+    /**\r
+     * Inizializes this client\r
+     */\r
+    public void initClient ();\r
 }\r