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