]> git.mxchange.org Git - addressbook-lib.git/blob - Addressbook/src/org/mxchange/addressbook/client/AddressbookClient.java
Moved more stuff to jcore project as they can be generalized
[addressbook-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.menu.item.SelectableMenuItem;
20 import org.mxchange.jcore.client.Client;
21 import org.mxchange.jcore.contact.Contact;
22 import org.mxchange.jcore.contact.Gender;
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          * The user changes own name data
34          *
35          * @param contact
36          */
37         public void doChangeOwnNameData (final Contact contact);
38
39         /**
40          * The user changes own address data
41          *
42          * @param contact Contact instance to change
43          */
44         public void doChangeOwnAddressData (final Contact contact);
45
46         /**
47          * The user changes own other data
48          *
49          * @param contact Constact instance to change
50          */
51         public void doChangeOwnOtherData (final Contact contact);
52
53         /**
54          * Allows the user to enter own data
55          *
56          * @return Finished Contact instance
57          */
58         public Contact doEnterOwnData ();
59
60         /**
61          * Asks the user to enter his/her gender (M=Male, F=Female, C=Company)
62          *
63          * @param message Message to output
64          * @return Gender enum
65          */
66         public Gender enterGender (final String message);
67
68         /**
69          * Let the user choose what to change on the address: [n]ame, [a]ddress,
70          * [o]ther
71          *
72          * @param contact Contact instance to let the user change data
73          * @throws UnhandledUserChoiceException If choice is not supported
74          */
75         public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;
76
77         /**
78          * Asks the user for a choice and proceeds accordingly
79          *
80          * @throws UnhandledUserChoiceException If choice is not supported
81          */
82         public void doUserMenuChoice () throws UnhandledUserChoiceException;
83
84         /**
85          * Asks the the user to enter a single character which must match validChars
86          *
87          * @param       validChars Valid chars that are accepted
88          * @param       message Message to user
89          * @return      Allowed character
90          */
91         public char enterChar (final char[] validChars, final String message);
92
93         /**
94          * Reads a string of minimum and maximum length from the user. An empty
95          * string should be generally not allowed, but might be okay for e.g.
96          * company name.
97          *
98          * @param minLength     Minimum length of the string to read
99          * @param maxLength     Maximum length of the string to read
100          * @param message       Message to user
101          * @param allowEmpty Whether empty strings are allowed
102          * @return Entered string by user or null if empty string is allowed
103          */
104         public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);
105
106         /**
107          * Reads an integer (int) from the user
108          *
109          * @param minimum Minimum allowed number
110          * @param maximum Maximum allowed number
111          * @param message       Message to user
112          * @return Entered string by user or null if empty string is allowed
113          */
114         public int enterInt (final int minimum, final int maximum, final String message);
115
116         /**
117          * Setter for current menu choice
118          *
119          * @param currentMenu Current menu choice
120          */
121         public void setCurrentMenu (final String currentMenu);
122
123         /**
124          * Some "Getter" for menu item
125          *
126          * @param accessKey Key to press to access this menu
127          * @param text Text to show to user
128          * @return
129          */
130         public SelectableMenuItem getMenuItem (final char accessKey, final String text);
131
132         /**
133          * Shows given menu entry in client
134          *
135          * @param item Menu item to show
136          */
137         public void showEntry (final SelectableMenuItem item);
138
139         /**
140          * Shows current menu selection to the user
141          */
142         public void showCurrentMenu ();
143 }