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