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.exceptions.FrameAlreadyInitializedException;
24 import org.mxchange.addressbook.exceptions.UnhandledUserChoiceException;
25 import org.mxchange.addressbook.menu.Menu;
26 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
30 * @author Roland Haeder
32 public class SwingClient extends BaseClient implements Client {
35 * Swing frame instance
37 private final ClientFrame frame;
40 * Constructor with an Application instance.
42 * @param application Application instance
44 public SwingClient (final Application application) {
48 this.getLogger().trace("CALLED!");
50 // Set application instance
51 this.setApplication(application);
53 // Init frame instance
54 this.frame = AddressbookFrame.getSelfInstance(this);
58 public void displayAddressBox (final Contact contact) {
59 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
63 public void displayNameBox (final Contact contact) {
64 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
68 public void displayOtherDataBox (final Contact contact) {
69 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
73 public void doChangeOwnAddressData (Contact contact) {
74 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
78 public void doChangeOwnNameData (Contact contact) {
79 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
83 public void doChangeOwnOtherData (Contact contact) {
84 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
88 public Contact doEnterOwnData () {
89 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
93 public void doShutdown () {
95 this.getLogger().trace("CALLED!");
101 this.frame.doShutdown();
103 // @TODO Add other shutdown stuff
105 this.getLogger().trace("EXIT!");
109 public void doUserMenuChoice () throws UnhandledUserChoiceException {
111 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
113 // Not implemented here
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.
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.
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.
132 public Menu getMenu (final String menuType) {
133 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
137 * Returns a Swing menu item
139 * @param accessKey Key to access the menu
140 * @param text Text to show to user
141 * @return A SelectableMenuItem
144 public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
146 this.getLogger().trace("CALLED!");
148 // Returns null as the menu is now no longer controlled here.
153 * Inizializes this client
156 public void init () {
158 this.getLogger().trace("CALLED!");
160 // Init contact manager here
161 this.initContactManager();
166 } catch (final FrameAlreadyInitializedException ex) {
167 this.getLogger().catching(ex);
171 // Now start the frame
172 this.frame.setupFrame(this);
175 this.getLogger().trace("EXIT!");
179 public void outputMessage (final String message) {
180 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
184 public void showCurrentMenu () {
186 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
188 // Not implemented here
192 public void showEntry (final SelectableMenuItem item) {
193 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
197 public void showWelcome () {
199 this.getLogger().trace("CALLED!");
201 // Not implemented here
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.
210 * Fills menu map with swing menus
213 protected final void fillMenuMap () {
214 // Nothing to fill here as the Swing frame is handling this all
215 throw new UnsupportedOperationException("Not implemented.");