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