]> git.mxchange.org Git - jaddressbook-share-lib.git/blob - Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Renamed some classes/interfaces to make it clear they belong only to this project...
[jaddressbook-share-lib.git] / Addressbook / src / org / mxchange / addressbook / client / gui / SwingClient.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.gui;
18
19 import org.mxchange.addressbook.client.AddressbookClient;
20 import org.mxchange.addressbook.client.BaseAddressbookClient;
21 import org.mxchange.addressbook.menu.Menu;
22 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
23 import org.mxchange.jcore.application.Application;
24 import org.mxchange.jcore.contact.Contact;
25 import org.mxchange.jcore.contact.Gender;
26 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
27 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
28
29 /**
30  *
31  * @author Roland Haeder
32  */
33 public class SwingClient extends BaseAddressbookClient implements AddressbookClient {
34
35         /**
36          * Swing frame instance
37          */
38         private final ClientFrame frame;
39
40         /**
41          * Constructor with an Application instance.
42          *
43          * @param application Application instance
44          */
45         public SwingClient (final Application application) {
46                 // Debug message
47                 this.getLogger().trace("CALLED!"); //NOI18N
48
49                 // Set application instance
50                 this.setApplication(application);
51
52                 // Init frame instance
53                 this.frame = AddressbookFrame.getSelfInstance(this);
54
55                 // Trace message
56                 this.getLogger().trace("EXIT!"); //NOI18N
57         }
58
59         @Override
60         public void displayAddressBox (final Contact contact) {
61                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
62         }
63
64         @Override
65         public void displayNameBox (final Contact contact) {
66                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
67         }
68
69         @Override
70         public void displayOtherDataBox (final Contact contact) {
71                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
72         }
73
74         @Override
75         public void doChangeOwnAddressData (Contact contact) {
76                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
77         }
78
79         @Override
80         public void doChangeOwnNameData (Contact contact) {
81                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
82         }
83
84         @Override
85         public void doChangeOwnOtherData (Contact contact) {
86                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
87         }
88
89         /**
90          * Shows dialog to enter new contact
91          *
92          * @return Returns finished Contact instance
93          */
94         @Override
95         public Contact doEnterOwnData () {
96                 // Trace message
97                 this.getLogger().trace("CALLED!"); //NOI18N
98
99                 // Deligate this call to the frame
100                 return this.frame.doEnterOwnData();
101         }
102
103         /**
104          * Shuts down this client
105          */
106         @Override
107         public void doShutdown () {
108                 // Debug message
109                 this.getLogger().trace("CALLED!"); //NOI18N
110
111                 // Parent call
112                 super.doShutdown();
113
114                 // Shutdown frame
115                 this.frame.doShutdown();
116
117                 // @TODO Add other shutdown stuff
118                 // Debug message
119                 this.getLogger().trace("EXIT!"); //NOI18N
120         }
121
122         @Override
123         public void doUserMenuChoice () throws UnhandledUserChoiceException {
124                 // Debug message
125                 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
126
127                 // Not implemented here
128         }
129
130         @Override
131         public char enterChar (final char[] validChars, String message) {
132                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
133         }
134
135         @Override
136         public Gender enterGender (final String message) {
137                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
138         }
139
140         @Override
141         public int enterInt (final int minimum, final int maximum, final String message) {
142                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
143         }
144
145         @Override
146         public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
147                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
148         }
149
150         @Override
151         public Menu getMenu (final String menuType) {
152                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
153         }
154
155         /**
156          * Returns a Swing menu item
157          *
158          * @param accessKey Key to access the menu
159          * @param text Text to show to user
160          * @return A SelectableMenuItem
161          */
162         @Override
163         public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
164                 // Debug message
165                 this.getLogger().trace("CALLED!"); //NOI18N
166
167                 // Returns null as the menu is now no longer controlled here.
168                 return null;
169         }
170
171         /**
172          * Inizializes this client
173          */
174         @Override
175         public void init () {
176                 // Debug message
177                 this.getLogger().trace("CALLED!"); //NOI18N
178
179                 // Init contact manager here
180                 this.initContactManager();
181
182                 try {
183                         // Init frame
184                         this.frame.init();
185                 } catch (final FrameAlreadyInitializedException ex) {
186                         // Abort program
187                         this.abortProgramWithException(ex);
188                 }
189
190                 // Now start the frame
191                 this.frame.setupFrame(this);
192
193                 // Debug message
194                 this.getLogger().trace("EXIT!"); //NOI18N
195         }
196
197         @Override
198         public void outputMessage (final String message) {
199                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
200         }
201
202         @Override
203         public void showCurrentMenu () {
204                 // Debug message
205                 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
206
207                 // Not implemented here
208         }
209
210         @Override
211         public void showEntry (final SelectableMenuItem item) {
212                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
213         }
214
215         @Override
216         public void showWelcome () {
217                 // Debug message
218                 this.getLogger().trace("CALLED!"); //NOI18N
219
220                 // Not implemented here
221         }
222
223         @Override
224         public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
225                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
226         }
227
228         /**
229          * Fills menu map with swing menus
230          */
231         @Override
232         protected final void fillMenuMap () {
233                 // Nothing to fill here as the Swing frame is handling this all
234                 throw new UnsupportedOperationException("Not implemented."); //NOI18N
235         }
236 }