-/*\r
- * Copyright (C) 2015 Roland Haeder\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package org.mxchange.addressbook.client.gui;\r
-\r
-import org.mxchange.addressbook.UnhandledUserChoiceException;\r
-import org.mxchange.addressbook.application.AddressbookApplication;\r
-import org.mxchange.addressbook.client.BaseClient;\r
-import org.mxchange.addressbook.client.Client;\r
-import org.mxchange.addressbook.contact.Contact;\r
-import org.mxchange.addressbook.menu.Menu;\r
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;\r
-\r
-/**\r
- *\r
- * @author Roland Haeder\r
- */\r
-public class SwingClient extends BaseClient implements Client {\r
- /**\r
- * Constructor with application instance\r
- * @param application \r
- */\r
- public SwingClient (final AddressbookApplication application) {\r
- super();\r
-\r
- // Set application instance\r
- this.setApplication(application);\r
-\r
- // Init contact manager here\r
- this.initContactManager(this);\r
-\r
- // Fill menu map\r
- this.fillMenuMap();\r
- }\r
-\r
- @Override\r
- public void displayAddressBox (final Contact contact) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void displayNameBox (final Contact contact) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void displayOtherDataBox (final Contact contact) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void doUserMenuChoice () throws UnhandledUserChoiceException {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public char enterChar (final char[] validChars, String message) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public int enterInt (final int minimum, final int maximum, final String message) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public Menu getMenu (final String menuType) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- /**\r
- * Returns a Swing menu item\r
- * \r
- * @param accessKey Key to access the menu\r
- * @param text Text to show to user\r
- * @return A SelectableMenuItem\r
- * @todo Make sure the access key is unique\r
- */\r
- @Override\r
- public SelectableMenuItem getMenuItem (final char accessKey, final String text) {\r
- // Returns null as the menu is now no longer controlled here.\r
- return null;\r
- }\r
-\r
- @Override\r
- public void outputMessage (final String message) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void showCurrentMenu () {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void showEntry (final SelectableMenuItem item) {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void showWelcome () {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- @Override\r
- public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {\r
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
- }\r
-\r
- /**\r
- * Fills menu map with swing menus\r
- */\r
- @Override\r
- protected final void fillMenuMap () {\r
- // Nothing to fill here as the Swing frame is handling this all\r
- }\r
- \r
-}\r
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.client.gui;
+
+import org.mxchange.addressbook.application.Application;
+import org.mxchange.addressbook.client.BaseClient;
+import org.mxchange.addressbook.client.Client;
+import org.mxchange.addressbook.contact.Contact;
+import org.mxchange.addressbook.exceptions.FrameAlreadyInitializedException;
+import org.mxchange.addressbook.exceptions.UnhandledUserChoiceException;
+import org.mxchange.addressbook.menu.Menu;
+import org.mxchange.addressbook.menu.item.SelectableMenuItem;
+
+/**
+ *
+ * @author Roland Haeder
+ */
+public class SwingClient extends BaseClient implements Client {
+ /**
+ * Swing frame instance
+ */
+ private final ClientFrame frame;
+
+ /**
+ * Constructor with an Application instance.
+ *
+ * @param application Application instance
+ */
+ public SwingClient (final Application application) {
+ super();
+
+ // Debug message
+ this.getLogger().trace("CALLED!");
+
+ // Set application instance
+ this.setApplication(application);
+
+ // Init frame instance
+ this.frame = AddressbookFrame.getSelfInstance(this);
+ }
+
+ @Override
+ public void displayAddressBox (final Contact contact) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void displayNameBox (final Contact contact) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void displayOtherDataBox (final Contact contact) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void doChangeOwnAddressData (Contact contact) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void doChangeOwnNameData (Contact contact) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void doChangeOwnOtherData (Contact contact) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Contact doEnterOwnData () {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void doShutdown () {
+ // Debug message
+ this.getLogger().trace("CALLED!");
+
+ // Parent call
+ super.doShutdown();
+
+ // Shutdown frame
+ this.frame.doShutdown();
+
+ // @TODO Add other shutdown stuff
+
+ // Debug message
+ this.getLogger().trace("EXIT!");
+ }
+
+ @Override
+ public void doUserMenuChoice () throws UnhandledUserChoiceException {
+ // Debug message
+ //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
+
+ // Not implemented here
+ }
+
+ @Override
+ public char enterChar (final char[] validChars, String message) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public int enterInt (final int minimum, final int maximum, final String message) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Menu getMenu (final String menuType) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ /**
+ * Returns a Swing menu item
+ *
+ * @param accessKey Key to access the menu
+ * @param text Text to show to user
+ * @return A SelectableMenuItem
+ */
+ @Override
+ public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
+ // Debug message
+ this.getLogger().trace("CALLED!");
+
+ // Returns null as the menu is now no longer controlled here.
+ return null;
+ }
+
+ /**
+ * Inizializes this client
+ */
+ @Override
+ public void init () {
+ // Debug message
+ this.getLogger().trace("CALLED!");
+
+ // Init contact manager here
+ this.initContactManager();
+
+ try {
+ // Init frame
+ this.frame.init();
+ } catch (final FrameAlreadyInitializedException ex) {
+ this.getLogger().catching(ex);
+ System.exit(1);
+ }
+
+ // Now start the frame
+ this.frame.setupFrame(this);
+
+ // Debug message
+ this.getLogger().trace("EXIT!");
+ }
+
+ @Override
+ public void outputMessage (final String message) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void showCurrentMenu () {
+ // Debug message
+ //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
+
+ // Not implemented here
+ }
+
+ @Override
+ public void showEntry (final SelectableMenuItem item) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void showWelcome () {
+ // Debug message
+ this.getLogger().trace("CALLED!");
+
+ // Not implemented here
+ }
+
+ @Override
+ public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ /**
+ * Fills menu map with swing menus
+ */
+ @Override
+ protected final void fillMenuMap () {
+ // Nothing to fill here as the Swing frame is handling this all
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+}