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