X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=Addressbook%2Fsrc%2Forg%2Fmxchange%2Faddressbook%2Fclient%2FClient.java;h=6e28668d605a3f9d332ac9812123b752a94d6a69;hb=53f82048c662991034ded4ace8b4f13d2fe7cbed;hp=136c95a8b577be175a543a9b8e64dbbf148ed4ba;hpb=c28ffed891227798e1a28a6814ba7a870821b2ca;p=jaddressbook-lib.git diff --git a/Addressbook/src/org/mxchange/addressbook/client/Client.java b/Addressbook/src/org/mxchange/addressbook/client/Client.java index 136c95a8..6e28668d 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/Client.java +++ b/Addressbook/src/org/mxchange/addressbook/client/Client.java @@ -1,189 +1,189 @@ -/* - * 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); - - /** - * 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 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.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 (); +}