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 * Shows dialog to enter new contact
90 * @return Returns finished Contact instance
93 public Contact doEnterOwnData () {
94 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
98 * Shuts down this client
101 public void doShutdown () {
103 this.getLogger().trace("CALLED!");
109 this.frame.doShutdown();
111 // @TODO Add other shutdown stuff
113 this.getLogger().trace("EXIT!");
117 public void doUserMenuChoice () throws UnhandledUserChoiceException {
119 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
121 // Not implemented here
125 public char enterChar (final char[] validChars, String message) {
126 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
130 public int enterInt (final int minimum, final int maximum, final String message) {
131 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
135 public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
136 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
140 public Menu getMenu (final String menuType) {
141 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
145 * Returns a Swing menu item
147 * @param accessKey Key to access the menu
148 * @param text Text to show to user
149 * @return A SelectableMenuItem
152 public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
154 this.getLogger().trace("CALLED!");
156 // Returns null as the menu is now no longer controlled here.
161 * Inizializes this client
164 public void init () {
166 this.getLogger().trace("CALLED!");
168 // Init contact manager here
169 this.initContactManager();
174 } catch (final FrameAlreadyInitializedException ex) {
175 this.getLogger().catching(ex);
179 // Now start the frame
180 this.frame.setupFrame(this);
183 this.getLogger().trace("EXIT!");
187 public void outputMessage (final String message) {
188 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
192 public void showCurrentMenu () {
194 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
196 // Not implemented here
200 public void showEntry (final SelectableMenuItem item) {
201 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
205 public void showWelcome () {
207 this.getLogger().trace("CALLED!");
209 // Not implemented here
213 public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
214 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
218 * Fills menu map with swing menus
221 protected final void fillMenuMap () {
222 // Nothing to fill here as the Swing frame is handling this all
223 throw new UnsupportedOperationException("Not implemented.");