]> git.mxchange.org Git - jbonuscard-lib.git/blob - Addressbook/src/org/mxchange/addressbook/client/AddressbookClient.java
15732f27640991204f7fea1718314fe550cb955a
[jbonuscard-lib.git] / Addressbook / src / org / mxchange / addressbook / client / AddressbookClient.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.addressbook.client;
18
19 import org.mxchange.addressbook.contact.Contact;
20 import org.mxchange.addressbook.contact.Gender;
21 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
22 import org.mxchange.jcore.client.Client;
23 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
24
25 /**
26  * A special client interface for addressbook applications.
27  * 
28  * @author Roland Haeder
29  */
30 public interface AddressbookClient extends Client {
31
32         /**
33          * Displays a "box" for the address
34          *
35          * @param contact Contact to show address from
36          */
37         public void displayAddressBox (final Contact contact);
38
39         /**
40          * The user changes own name data
41          *
42          * @param contact
43          */
44         public void doChangeOwnNameData (final Contact contact);
45
46         /**
47          * The user changes own address data
48          *
49          * @param contact Contact instance to change
50          */
51         public void doChangeOwnAddressData (final Contact contact);
52
53         /**
54          * The user changes own other data
55          *
56          * @param contact Constact instance to change
57          */
58         public void doChangeOwnOtherData (final Contact contact);
59
60         /**
61          * Allows the user to enter own data
62          *
63          * @return Finished Contact instance
64          */
65         public Contact doEnterOwnData ();
66
67         /**
68          * Asks the user to enter his/her gender (M=Male, F=Female, C=Company)
69          *
70          * @param message Message to output
71          * @return Gender enum
72          */
73         public Gender enterGender (final String message);
74
75         /**
76          * Displays a "box" for the name
77          *
78          * @param contact Contact to show name from
79          */
80         public void displayNameBox (final Contact contact);
81
82         /**
83          * Displays a "box" for other data
84          *
85          * @param contact Contact to show other data from
86          */
87         public void displayOtherDataBox (final Contact contact);
88
89         /**
90          * Let the user choose what to change on the address: [n]ame, [a]ddress,
91          * [o]ther
92          *
93          * @param contact Contact instance to let the user change data
94          * @throws UnhandledUserChoiceException If choice is not supported
95          */
96         public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;
97
98         /**
99          * Asks the user for a choice and proceeds accordingly
100          *
101          * @throws UnhandledUserChoiceException If choice is not supported
102          */
103         public void doUserMenuChoice () throws UnhandledUserChoiceException;
104
105         /**
106          * Asks the the user to enter a single character which must match validChars
107          *
108          * @param       validChars Valid chars that are accepted
109          * @param       message Message to user
110          * @return      Allowed character
111          */
112         public char enterChar (final char[] validChars, final String message);
113
114         /**
115          * Reads a string of minimum and maximum length from the user. An empty
116          * string should be generally not allowed, but might be okay for e.g.
117          * company name.
118          *
119          * @param minLength     Minimum length of the string to read
120          * @param maxLength     Maximum length of the string to read
121          * @param message       Message to user
122          * @param allowEmpty Whether empty strings are allowed
123          * @return Entered string by user or null if empty string is allowed
124          */
125         public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);
126
127         /**
128          * Reads an integer (int) from the user
129          *
130          * @param minimum Minimum allowed number
131          * @param maximum Maximum allowed number
132          * @param message       Message to user
133          * @return Entered string by user or null if empty string is allowed
134          */
135         public int enterInt (final int minimum, final int maximum, final String message);
136
137         /**
138          * Setter for current menu choice
139          *
140          * @param currentMenu Current menu choice
141          */
142         public void setCurrentMenu (final String currentMenu);
143
144         /**
145          * Some "Getter" for menu item
146          *
147          * @param accessKey Key to press to access this menu
148          * @param text Text to show to user
149          * @return
150          */
151         public SelectableMenuItem getMenuItem (final char accessKey, final String text);
152
153         /**
154          * Shows given menu entry in client
155          *
156          * @param item Menu item to show
157          */
158         public void showEntry (final SelectableMenuItem item);
159
160         /**
161          * Shows current menu selection to the user
162          */
163         public void showCurrentMenu ();
164 }