X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=Addressbook%2Fsrc%2Forg%2Fmxchange%2Faddressbook%2Fclient%2FClient.java;h=9ebbc14c79b1547bea2ed702a1790d9a74703f5d;hb=8b901b209e8b4d330d8bc9ae2a78c121d1110c2e;hp=0d5e154d0da157444773c1532a7784c26aac4983;hpb=e06df9f02fa3fc03c21d5b2c3e2c8cb476be4ea3;p=addressbook-swing.git
diff --git a/Addressbook/src/org/mxchange/addressbook/client/Client.java b/Addressbook/src/org/mxchange/addressbook/client/Client.java
index 0d5e154..9ebbc14 100644
--- a/Addressbook/src/org/mxchange/addressbook/client/Client.java
+++ b/Addressbook/src/org/mxchange/addressbook/client/Client.java
@@ -1,162 +1,198 @@
-/*
- * 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 .
- */
-package org.mxchange.addressbook.client;
-
-import org.mxchange.addressbook.FrameworkInterface;
-import org.mxchange.addressbook.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);
-
- /**
- * 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 initClient ();
-}
+/*
+ * 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 .
+ */
+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.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 ();
+
+ /**
+ * 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 ();
+}