2 * Copyright (C) 2015 Roland Haeder
\r
4 * This program is free software: you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation, either version 3 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
17 package org.mxchange.addressbook.client;
\r
19 import org.mxchange.addressbook.UnhandledUserChoiceException;
\r
20 import org.mxchange.addressbook.FrameworkInterface;
\r
21 import org.mxchange.addressbook.contact.Contact;
\r
22 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
\r
26 * @author Roland Haeder
\r
28 public interface Client extends FrameworkInterface {
\r
31 * Displays a "box" for the address
\r
33 * @param contact Contact to show address from
\r
35 public void displayAddressBox (final Contact contact);
\r
38 * Displays a message to the user
\r
40 * @param message Message to show to the user
\r
42 public void displayMessage (final String message);
\r
45 * Displays a "box" for the name
\r
47 * @param contact Contact to show name from
\r
49 public void displayNameBox (final Contact contact);
\r
52 * Displays a "box" for other data
\r
54 * @param contact Contact to show other data from
\r
56 public void displayOtherDataBox (final Contact contact);
\r
59 * Let the user choose what to change on the address: [n]ame, [a]ddress,
\r
61 * @param contact Contact instance to let the user change data
\r
62 * @throws UnhandledUserChoiceException If choice is not supported
\r
64 public void doUserChangeAdressChoice (final Contact contact) throws UnhandledUserChoiceException;
\r
67 * Asks the user for a choice and proceeds accordingly
\r
68 * @throws UnhandledUserChoiceException If choice is not supported
\r
70 public void doUserMenuChoice () throws UnhandledUserChoiceException ;
\r
73 * Enables isRunning attribute which singals that the client is running
\r
75 public void enableIsRunning ();
\r
78 * Asks the the user to enter a single character which must match validChars
\r
79 * @param validChars Valid chars that are accepted
\r
80 * @param message Message to user
\r
81 * @return Allowed character
\r
83 public char enterChar (final char[] validChars, final String message);
\r
86 * Reads a string of minimum and maximum length from the user
\r
87 * @param minLength Minimum length of the string to read
\r
88 * @param maxLength Maximum length of the string to read
\r
89 * @param message Message to user
\r
90 * @param allowEmpty Whether empty strings are allowed
\r
91 * @return Entered string by user or null if empty string is allowed
\r
93 public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);
\r
96 * Setter for current menu choice
\r
97 * @param currentMenu Current menu choice
\r
99 public void setCurrentMenu (final String currentMenu);
\r
102 * Some "Getter" for menu item
\r
103 * @param accessKey Key to press to access this menu
\r
104 * @param text Text to show to user
\r
107 public SelectableMenuItem getMenuItem (final char accessKey, final String text);
\r
110 * Determines whether the application is still active by checking some
\r
113 * @return Whether the application is still active
\r
115 public boolean isApplicationRunning ();
\r
118 * Shows given menu entry in client
\r
119 * @param item Menu item to show
\r
121 public void showEntry (final SelectableMenuItem item);
\r
124 * Shows introduction to user
\r
126 public void showWelcome ();
\r
129 * Shows current menu selection to the user
\r
131 public void showCurrentMenu ();
\r