]> git.mxchange.org Git - addressbook-swing.git/blob - Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
c9ed4f6d674f15346223e935c43caaa1bec6eda8
[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         @Override
88         public Contact doEnterOwnData () {
89                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
90         }
91
92         @Override
93         public void doShutdown () {
94                 // Debug message
95                 this.getLogger().trace("CALLED!");
96
97                 // Parent call
98                 super.doShutdown();
99
100                 // Shutdown frame
101                 this.frame.doShutdown();
102
103         // @TODO Add other shutdown stuff
104                 // Debug message
105                 this.getLogger().trace("EXIT!");
106         }
107
108         @Override
109         public void doUserMenuChoice () throws UnhandledUserChoiceException {
110         // Debug message
111                 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
112
113                 // Not implemented here
114         }
115
116         @Override
117         public char enterChar (final char[] validChars, String message) {
118                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
119         }
120
121         @Override
122         public int enterInt (final int minimum, final int maximum, final String message) {
123                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
124         }
125
126         @Override
127         public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
128                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
129         }
130
131         @Override
132         public Menu getMenu (final String menuType) {
133                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
134         }
135
136         /**
137          * Returns a Swing menu item
138          *
139          * @param accessKey Key to access the menu
140          * @param text Text to show to user
141          * @return A SelectableMenuItem
142          */
143         @Override
144         public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
145                 // Debug message
146                 this.getLogger().trace("CALLED!");
147
148                 // Returns null as the menu is now no longer controlled here.
149                 return null;
150         }
151
152         /**
153          * Inizializes this client
154          */
155         @Override
156         public void init () {
157                 // Debug message
158                 this.getLogger().trace("CALLED!");
159
160                 // Init contact manager here
161                 this.initContactManager();
162
163                 try {
164                         // Init frame
165                         this.frame.init();
166                 } catch (final FrameAlreadyInitializedException ex) {
167                         this.getLogger().catching(ex);
168                         System.exit(1);
169                 }
170
171                 // Now start the frame
172                 this.frame.setupFrame(this);
173
174                 // Debug message
175                 this.getLogger().trace("EXIT!");
176         }
177
178         @Override
179         public void outputMessage (final String message) {
180                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
181         }
182
183         @Override
184         public void showCurrentMenu () {
185         // Debug message
186                 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
187
188                 // Not implemented here
189         }
190
191         @Override
192         public void showEntry (final SelectableMenuItem item) {
193                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
194         }
195
196         @Override
197         public void showWelcome () {
198                 // Debug message
199                 this.getLogger().trace("CALLED!");
200
201                 // Not implemented here
202         }
203
204         @Override
205         public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
206                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
207         }
208
209         /**
210          * Fills menu map with swing menus
211          */
212         @Override
213         protected final void fillMenuMap () {
214                 // Nothing to fill here as the Swing frame is handling this all
215                 throw new UnsupportedOperationException("Not implemented.");
216         }
217 }