]> git.mxchange.org Git - jaddressbook-lib.git/blob - Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Introduced initStatusPanel() which initializes status panel + renamed methods accordi...
[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.FrameAlreadyInitializedException;
20 import org.mxchange.addressbook.UnhandledUserChoiceException;
21 import org.mxchange.addressbook.application.Application;
22 import org.mxchange.addressbook.client.BaseClient;
23 import org.mxchange.addressbook.client.Client;
24 import org.mxchange.addressbook.contact.Contact;
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      * Swing frame instance
35      */
36     private final ClientFrame frame;
37
38     /**
39      * Constructor with an Application instance.
40      * 
41      * @param application Application instance
42      */
43     public SwingClient (final Application application) {
44         super();
45
46         // Debug message
47         this.getLogger().trace("CALLED!");
48
49         // Set application instance
50         this.setApplication(application);
51
52         // Init frame instance
53         this.frame = AddressbookFrame.getSelfInstance(this);
54     }
55
56     @Override
57     public void displayAddressBox (final Contact contact) {
58         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
59     }
60
61     @Override
62     public void displayNameBox (final Contact contact) {
63         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
64     }
65
66     @Override
67     public void displayOtherDataBox (final Contact contact) {
68         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
69     }
70
71     @Override
72     public void doChangeOwnAddressData (Contact contact) {
73         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
74     }
75
76     @Override
77     public void doChangeOwnNameData (Contact contact) {
78         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
79     }
80
81     @Override
82     public void doChangeOwnOtherData (Contact contact) {
83         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
84     }
85
86     @Override
87     public Contact doEnterOwnData () {
88         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
89     }
90
91     @Override
92     public void doShutdown () {
93         // Debug message
94         this.getLogger().trace("CALLED!");
95
96         // Parent call
97         super.doShutdown();
98
99         // Shutdown frame
100         this.frame.doShutdown();
101
102         // @TODO Add other shutdown stuff
103
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 }