]> git.mxchange.org Git - addressbook-swing.git/blob - Addressbook/src/org/mxchange/addressbook/client/Client.java
Updated comment (minor)
[addressbook-swing.git] / Addressbook / src / org / mxchange / addressbook / client / Client.java
1 /*\r
2  * Copyright (C) 2015 Roland Haeder\r
3  *\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
8  *\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
13  *\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
16  */\r
17 package org.mxchange.addressbook.client;\r
18 \r
19 import org.mxchange.addressbook.FrameworkInterface;\r
20 import org.mxchange.addressbook.UnhandledUserChoiceException;\r
21 import org.mxchange.addressbook.contact.Contact;\r
22 import org.mxchange.addressbook.menu.item.SelectableMenuItem;\r
23 \r
24 /**\r
25  *\r
26  * @author Roland Haeder\r
27  */\r
28 public interface Client extends FrameworkInterface {\r
29 \r
30     /**\r
31      * Displays a "box" for the address\r
32      *\r
33      * @param contact Contact to show address from\r
34      */\r
35     public void displayAddressBox (final Contact contact);\r
36 \r
37     /**\r
38      * Displays a message to the user\r
39      *\r
40      * @param message Message to show to the user\r
41      */\r
42     public void outputMessage (final String message);\r
43 \r
44     /**\r
45      * Displays a "box" for the name\r
46      *\r
47      * @param contact Contact to show name from\r
48      */\r
49     public void displayNameBox (final Contact contact);\r
50 \r
51     /**\r
52      * Displays a "box" for other data\r
53      *\r
54      * @param contact Contact to show other data from\r
55      */\r
56     public void displayOtherDataBox (final Contact contact);\r
57 \r
58     /**\r
59      * Let the user choose what to change on the address: [n]ame, [a]ddress,\r
60      * [o]ther\r
61      * \r
62      * @param contact Contact instance to let the user change data\r
63      * @throws UnhandledUserChoiceException If choice is not supported\r
64      */\r
65     public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;\r
66 \r
67     /**\r
68      * Asks the user for a choice and proceeds accordingly\r
69      * \r
70      * @throws UnhandledUserChoiceException If choice is not supported\r
71      */\r
72     public void doUserMenuChoice () throws UnhandledUserChoiceException ;\r
73 \r
74     /**\r
75      * Enables isRunning attribute which singals that the client is running\r
76      */\r
77     public void enableIsRunning ();\r
78 \r
79     /**\r
80      * Asks the the user to enter a single character which must match validChars\r
81      * \r
82      * @param   validChars  Valid chars that are accepted\r
83      * @param   message     Message to user\r
84      * @return  Allowed character\r
85      */\r
86     public char enterChar (final char[] validChars, final String message);\r
87 \r
88     /**\r
89      * Reads a string of minimum and maximum length from the user. An empty\r
90      * string should be generally not allowed, but might be okay for e.g.\r
91      * company name.\r
92      * \r
93      * @param minLength Minimum length of the string to read\r
94      * @param maxLength Maximum length of the string to read\r
95      * @param message   Message to user\r
96      * @param allowEmpty Whether empty strings are allowed\r
97      * @return Entered string by user or null if empty string is allowed\r
98      */\r
99     public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);\r
100 \r
101     /**\r
102      * Reads an integer (int) from the user\r
103      * \r
104      * @param minimum Minimum allowed number\r
105      * @param maximum Maximum allowed number\r
106      * @param message   Message to user\r
107      * @return Entered string by user or null if empty string is allowed\r
108      */\r
109     public int enterInt (final int minimum, final int maximum, final String message);\r
110 \r
111     /**\r
112      * Setter for current menu choice\r
113      * \r
114      * @param currentMenu Current menu choice\r
115      */\r
116     public void setCurrentMenu (final String currentMenu);\r
117 \r
118     /**\r
119      * Some "Getter" for menu item\r
120      * \r
121      * @param accessKey Key to press to access this menu\r
122      * @param text Text to show to user\r
123      * @return \r
124      */\r
125     public SelectableMenuItem getMenuItem (final char accessKey, final String text);\r
126 \r
127     /**\r
128      * Determines whether the application is still active by checking some\r
129      * conditions\r
130      * \r
131      * @return Whether the application is still active\r
132      */\r
133     public boolean isApplicationRunning ();\r
134 \r
135     /**\r
136      * Shows given menu entry in client\r
137      * @param item Menu item to show\r
138      */\r
139     public void showEntry (final SelectableMenuItem item);\r
140 \r
141     /**\r
142      * Shows introduction to user\r
143      */\r
144     public void showWelcome ();\r
145 \r
146     /**\r
147      * Shows current menu selection to the user\r
148      */\r
149     public void showCurrentMenu ();\r
150 }\r