]> git.mxchange.org Git - addressbook-swing.git/blobdiff - Addressbook/src/org/mxchange/addressbook/client/Client.java
Added more input fields and overwritten toString() in Gender enum
[addressbook-swing.git] / Addressbook / src / org / mxchange / addressbook / client / Client.java
index 6e28668d605a3f9d332ac9812123b752a94d6a69..9ebbc14c79b1547bea2ed702a1790d9a74703f5d 100644 (file)
 package org.mxchange.addressbook.client;
 
 import org.mxchange.addressbook.FrameworkInterface;
-import org.mxchange.addressbook.UnhandledUserChoiceException;
+import org.mxchange.addressbook.exceptions.UnhandledUserChoiceException;
 import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.addressbook.contact.Gender;
 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 ();
+       /**
+        * 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 ();
+
+       /**
+        * Asks the user to enter his/her gender (M=Male, F=Female, C=Company)
+        * 
+        * @param message Message to output
+        * @return Gender enum
+        */
+       public Gender enterGender (final String message);
+
+       /**
+        * 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 ();
 }