2 * Copyright (C) 2015 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.addressbook.client.gui;
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;
31 * @author Roland Haeder
33 public class SwingClient extends BaseClient implements Client {
36 * Swing frame instance
38 private final ClientFrame frame;
41 * Constructor with an Application instance.
43 * @param application Application instance
45 public SwingClient (final Application application) {
49 this.getLogger().trace("CALLED!"); //NOI18N
51 // Set application instance
52 this.setApplication(application);
54 // Init frame instance
55 this.frame = AddressbookFrame.getSelfInstance(this);
59 public void displayAddressBox (final Contact contact) {
60 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
64 public void displayNameBox (final Contact contact) {
65 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
69 public void displayOtherDataBox (final Contact contact) {
70 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
74 public void doChangeOwnAddressData (Contact contact) {
75 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
79 public void doChangeOwnNameData (Contact contact) {
80 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
84 public void doChangeOwnOtherData (Contact contact) {
85 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
89 * Shows dialog to enter new contact
91 * @return Returns finished Contact instance
94 public Contact doEnterOwnData () {
95 // Deligate this call to the frame
96 return this.frame.doEnterOwnData();
100 * Shuts down this client
103 public void doShutdown () {
105 this.getLogger().trace("CALLED!"); //NOI18N
111 this.frame.doShutdown();
113 // @TODO Add other shutdown stuff
115 this.getLogger().trace("EXIT!"); //NOI18N
119 public void doUserMenuChoice () throws UnhandledUserChoiceException {
121 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
123 // Not implemented here
127 public char enterChar (final char[] validChars, String message) {
128 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
132 public Gender enterGender (final String message) {
133 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
137 public int enterInt (final int minimum, final int maximum, final String message) {
138 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
142 public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
143 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
147 public Menu getMenu (final String menuType) {
148 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
152 * Returns a Swing menu item
154 * @param accessKey Key to access the menu
155 * @param text Text to show to user
156 * @return A SelectableMenuItem
159 public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
161 this.getLogger().trace("CALLED!"); //NOI18N
163 // Returns null as the menu is now no longer controlled here.
168 * Inizializes this client
171 public void init () {
173 this.getLogger().trace("CALLED!"); //NOI18N
175 // Init contact manager here
176 this.initContactManager();
181 } catch (final FrameAlreadyInitializedException ex) {
182 this.getLogger().catching(ex);
186 // Now start the frame
187 this.frame.setupFrame(this);
190 this.getLogger().trace("EXIT!"); //NOI18N
194 public void outputMessage (final String message) {
195 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
199 public void showCurrentMenu () {
201 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
203 // Not implemented here
207 public void showEntry (final SelectableMenuItem item) {
208 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
212 public void showWelcome () {
214 this.getLogger().trace("CALLED!"); //NOI18N
216 // Not implemented here
220 public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
221 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
225 * Fills menu map with swing menus
228 protected final void fillMenuMap () {
229 // Nothing to fill here as the Swing frame is handling this all
230 throw new UnsupportedOperationException("Not implemented."); //NOI18N