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.client.AddressbookClient;
20 import org.mxchange.addressbook.client.BaseAddressbookClient;
21 import org.mxchange.jcore.contact.Contact;
22 import org.mxchange.jcore.contact.Gender;
23 import org.mxchange.addressbook.menu.Menu;
24 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
25 import org.mxchange.jcore.application.Application;
26 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
27 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
31 * @author Roland Haeder
33 public class SwingClient extends BaseAddressbookClient implements AddressbookClient {
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) {
47 this.getLogger().trace("CALLED!"); //NOI18N
49 // Set application instance
50 this.setApplication(application);
52 // Init frame instance
53 this.frame = AddressbookFrame.getSelfInstance(this);
56 this.getLogger().trace("EXIT!"); //NOI18N
60 public void displayAddressBox (final Contact contact) {
61 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
65 public void displayNameBox (final Contact contact) {
66 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
70 public void displayOtherDataBox (final Contact contact) {
71 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
75 public void doChangeOwnAddressData (Contact contact) {
76 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
80 public void doChangeOwnNameData (Contact contact) {
81 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
85 public void doChangeOwnOtherData (Contact contact) {
86 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
90 * Shows dialog to enter new contact
92 * @return Returns finished Contact instance
95 public Contact doEnterOwnData () {
97 this.getLogger().trace("CALLED!"); //NOI18N
99 // Deligate this call to the frame
100 return this.frame.doEnterOwnData();
104 * Shuts down this client
107 public void doShutdown () {
109 this.getLogger().trace("CALLED!"); //NOI18N
115 this.frame.doShutdown();
117 // @TODO Add other shutdown stuff
119 this.getLogger().trace("EXIT!"); //NOI18N
123 public void doUserMenuChoice () throws UnhandledUserChoiceException {
125 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
127 // Not implemented here
131 public char enterChar (final char[] validChars, String message) {
132 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
136 public Gender enterGender (final String message) {
137 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
141 public int enterInt (final int minimum, final int maximum, final String message) {
142 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
146 public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
147 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
151 public Menu getMenu (final String menuType) {
152 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
156 * Returns a Swing menu item
158 * @param accessKey Key to access the menu
159 * @param text Text to show to user
160 * @return A SelectableMenuItem
163 public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
165 this.getLogger().trace("CALLED!"); //NOI18N
167 // Returns null as the menu is now no longer controlled here.
172 * Inizializes this client
175 public void init () {
177 this.getLogger().trace("CALLED!"); //NOI18N
179 // Init contact manager here
180 this.initContactManager();
185 } catch (final FrameAlreadyInitializedException ex) {
187 this.abortProgramWithException(ex);
190 // Now start the frame
191 this.frame.setupFrame(this);
194 this.getLogger().trace("EXIT!"); //NOI18N
198 public void outputMessage (final String message) {
199 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
203 public void showCurrentMenu () {
205 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
207 // Not implemented here
211 public void showEntry (final SelectableMenuItem item) {
212 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
216 public void showWelcome () {
218 this.getLogger().trace("CALLED!"); //NOI18N
220 // Not implemented here
224 public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
225 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
229 * Fills menu map with swing menus
232 protected final void fillMenuMap () {
233 // Nothing to fill here as the Swing frame is handling this all
234 throw new UnsupportedOperationException("Not implemented."); //NOI18N