]> git.mxchange.org Git - jfinancials-lib.git/blob - src/org/mxchange/addressbook/client/Client.java
Project relocated (a bit better now?) + continued with Swing client
[jfinancials-lib.git] / 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      * The user changes own name data\r
40      * @param contact \r
41      */\r
42     public void doChangeOwnNameData (final Contact contact);\r
43 \r
44     /**\r
45      * The user changes own address data\r
46      *\r
47      * @param contact Contact instance to change\r
48      */\r
49     public void doChangeOwnAddressData (final Contact contact);\r
50 \r
51     /**\r
52      * The user changes own other data\r
53      * \r
54      * @param contact Constact instance to change\r
55      */\r
56     public void doChangeOwnOtherData (final Contact contact);\r
57 \r
58     /**\r
59      * Allows the user to enter own data\r
60      * \r
61      * @return Finished Contact instance\r
62      */\r
63     public Contact doEnterOwnData ();\r
64 \r
65     /**\r
66      * Shuts down the client and therefore whole application\r
67      */\r
68     public void doShutdown ();\r
69 \r
70     /**\r
71      * Displays a message to the user\r
72      *\r
73      * @param message Message to show to the user\r
74      */\r
75     public void outputMessage (final String message);\r
76 \r
77     /**\r
78      * Displays a "box" for the name\r
79      *\r
80      * @param contact Contact to show name from\r
81      */\r
82     public void displayNameBox (final Contact contact);\r
83 \r
84     /**\r
85      * Displays a "box" for other data\r
86      *\r
87      * @param contact Contact to show other data from\r
88      */\r
89     public void displayOtherDataBox (final Contact contact);\r
90 \r
91     /**\r
92      * Let the user choose what to change on the address: [n]ame, [a]ddress,\r
93      * [o]ther\r
94      * \r
95      * @param contact Contact instance to let the user change data\r
96      * @throws UnhandledUserChoiceException If choice is not supported\r
97      */\r
98     public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;\r
99 \r
100     /**\r
101      * Asks the user for a choice and proceeds accordingly\r
102      * \r
103      * @throws UnhandledUserChoiceException If choice is not supported\r
104      */\r
105     public void doUserMenuChoice () throws UnhandledUserChoiceException ;\r
106 \r
107     /**\r
108      * Enables isRunning attribute which singals that the client is running\r
109      */\r
110     public void enableIsRunning();\r
111 \r
112     /**\r
113      * Asks the the user to enter a single character which must match validChars\r
114      * \r
115      * @param   validChars  Valid chars that are accepted\r
116      * @param   message     Message to user\r
117      * @return  Allowed character\r
118      */\r
119     public char enterChar (final char[] validChars, final String message);\r
120 \r
121     /**\r
122      * Reads a string of minimum and maximum length from the user. An empty\r
123      * string should be generally not allowed, but might be okay for e.g.\r
124      * company name.\r
125      * \r
126      * @param minLength Minimum length of the string to read\r
127      * @param maxLength Maximum length of the string to read\r
128      * @param message   Message to user\r
129      * @param allowEmpty Whether empty strings are allowed\r
130      * @return Entered string by user or null if empty string is allowed\r
131      */\r
132     public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);\r
133 \r
134     /**\r
135      * Reads an integer (int) from the user\r
136      * \r
137      * @param minimum Minimum allowed number\r
138      * @param maximum Maximum allowed number\r
139      * @param message   Message to user\r
140      * @return Entered string by user or null if empty string is allowed\r
141      */\r
142     public int enterInt (final int minimum, final int maximum, final String message);\r
143 \r
144     /**\r
145      * Setter for current menu choice\r
146      * \r
147      * @param currentMenu Current menu choice\r
148      */\r
149     public void setCurrentMenu (final String currentMenu);\r
150 \r
151     /**\r
152      * Some "Getter" for menu item\r
153      * \r
154      * @param accessKey Key to press to access this menu\r
155      * @param text Text to show to user\r
156      * @return \r
157      */\r
158     public SelectableMenuItem getMenuItem (final char accessKey, final String text);\r
159 \r
160     /**\r
161      * Determines whether the client is still active by checking some\r
162      * conditions\r
163      * \r
164      * @return Whether the client is still active\r
165      */\r
166     public boolean isRunning();\r
167 \r
168     /**\r
169      * Shows given menu entry in client\r
170      * \r
171      * @param item Menu item to show\r
172      */\r
173     public void showEntry (final SelectableMenuItem item);\r
174 \r
175     /**\r
176      * Shows introduction to user\r
177      */\r
178     public void showWelcome();\r
179 \r
180     /**\r
181      * Shows current menu selection to the user\r
182      */\r
183     public void showCurrentMenu();\r
184 \r
185     /**\r
186      * Inizializes this client\r
187      */\r
188     public void initClient ();\r
189 }\r