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!");
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.
64 public void displayNameBox (final Contact contact) {
65 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
69 public void displayOtherDataBox (final Contact contact) {
70 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
74 public void doChangeOwnAddressData (Contact contact) {
75 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
79 public void doChangeOwnNameData (Contact contact) {
80 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
84 public void doChangeOwnOtherData (Contact contact) {
85 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
89 * Shows dialog to enter new contact
91 * @return Returns finished Contact instance
94 public Contact doEnterOwnData () {
95 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
99 * Shuts down this client
102 public void doShutdown () {
104 this.getLogger().trace("CALLED!");
110 this.frame.doShutdown();
112 // @TODO Add other shutdown stuff
114 this.getLogger().trace("EXIT!");
118 public void doUserMenuChoice () throws UnhandledUserChoiceException {
120 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
122 // Not implemented here
126 public char enterChar (final char[] validChars, String message) {
127 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
131 public Gender enterGender (final String message) {
132 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
136 public int enterInt (final int minimum, final int maximum, final String message) {
137 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
141 public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
142 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
146 public Menu getMenu (final String menuType) {
147 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
151 * Returns a Swing menu item
153 * @param accessKey Key to access the menu
154 * @param text Text to show to user
155 * @return A SelectableMenuItem
158 public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
160 this.getLogger().trace("CALLED!");
162 // Returns null as the menu is now no longer controlled here.
167 * Inizializes this client
170 public void init () {
172 this.getLogger().trace("CALLED!");
174 // Init contact manager here
175 this.initContactManager();
180 } catch (final FrameAlreadyInitializedException ex) {
181 this.getLogger().catching(ex);
185 // Now start the frame
186 this.frame.setupFrame(this);
189 this.getLogger().trace("EXIT!");
193 public void outputMessage (final String message) {
194 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
198 public void showCurrentMenu () {
200 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
202 // Not implemented here
206 public void showEntry (final SelectableMenuItem item) {
207 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
211 public void showWelcome () {
213 this.getLogger().trace("CALLED!");
215 // Not implemented here
219 public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
220 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
224 * Fills menu map with swing menus
227 protected final void fillMenuMap () {
228 // Nothing to fill here as the Swing frame is handling this all
229 throw new UnsupportedOperationException("Not implemented.");