]> git.mxchange.org Git - jfinancials-swing.git/commitdiff
auto-reformatted most project files
authorRoland Haeder <roland@mxchange.org>
Wed, 30 Sep 2015 10:32:33 +0000 (12:32 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 30 Sep 2015 10:32:33 +0000 (12:32 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

15 files changed:
src/org/mxchange/addressbook/BaseAddressbookSystem.java
src/org/mxchange/addressbook/application/AddressbookApplication.java
src/org/mxchange/addressbook/client/AddressbookClient.java
src/org/mxchange/addressbook/client/BaseAddressbookClient.java
src/org/mxchange/addressbook/client/gui/AddressbookFrame.java
src/org/mxchange/addressbook/client/gui/SwingClient.java
src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java
src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java
src/org/mxchange/addressbook/menu/BaseMenu.java
src/org/mxchange/addressbook/menu/Menu.java
src/org/mxchange/addressbook/menu/MenuTools.java
src/org/mxchange/addressbook/menu/console/ConsoleMenu.java
src/org/mxchange/addressbook/menu/item/BaseMenuItem.java
src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java
src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java

index 6f4ec4ac64909598d09d2dfcb61a4b472db9c7a0..f0d1d9a38d2a41e68a0ba975ce6404c8a75a7951 100644 (file)
@@ -52,6 +52,19 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem {
                }
        }
 
+       /**
+        * Log exception and abort program.
+        * <p>
+        * @param throwable Throwable
+        */
+       protected void abortProgramWithException (final Throwable throwable) {
+               // Log exception
+               this.logException(throwable);
+               
+               // Abort here
+               System.exit(1);
+       }
+
        /**
         * Getter for logger instance
         * <p>
@@ -69,17 +82,4 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem {
        protected void logException (final Throwable exception) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
-
-       /**
-        * Log exception and abort program.
-        * <p>
-        * @param throwable Throwable
-        */
-       protected void abortProgramWithException (final Throwable throwable) {
-               // Log exception
-               this.logException(throwable);
-
-               // Abort here
-               System.exit(1);
-       }
 }
index 4f07e31ebd8b103eeea7b08d1de9ee944d6bf3e7..813e7974e3428a0746f873e9150cf3218eb17e35 100644 (file)
@@ -92,8 +92,24 @@ public class AddressbookApplication extends BaseApplication implements Applicati
        }
 
        /**
-        * Bootstraps application
+        * Main method (entry point)
+        * <p>
+        * @param args the command line arguments
+        */
+       public static void main (String[] args) {
+               // Start application
+               new AddressbookApplication().start(args);
+       }
+
+       /**
+        * Getter for printable application name
+        * <p>
+        * @return A printable name
         */
+       public static String printableTitle () {
+               return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION); //NOI18N
+       }
+
        @Override
        public void doBootstrap () {
                this.getLogger().logDebug("Initializing application ..."); //NOI18N
@@ -142,9 +158,6 @@ public class AddressbookApplication extends BaseApplication implements Applicati
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Main loop of the application
-        */
        @Override
        public void doMainLoop () throws MenuInitializationException {
                // Get client and cast it
@@ -202,6 +215,24 @@ public class AddressbookApplication extends BaseApplication implements Applicati
                System.exit(0);
        }
 
+       /**
+        * Enables console client by setting propper flag
+        */
+       private void enableConsoleClient () {
+               this.getLogger().logDebug("Enabling console client (may become optional client) ..."); //NOI18N
+               this.consoleClient = true;
+               this.guiClient = false;
+       }
+
+       /**
+        * Enables GUI client by setting propper flag
+        */
+       private void enableGuiClient () {
+               this.getLogger().logDebug("Enabling GUI client (may become new default client) ..."); //NOI18N
+               this.consoleClient = false;
+               this.guiClient = true;
+       }
+
        /**
         * Initializes this application
         */
@@ -223,15 +254,6 @@ public class AddressbookApplication extends BaseApplication implements Applicati
                }
        }
 
-       /**
-        * Logs given exception
-        *
-        * @param exception Throwable
-        */
-       protected void logException (final Throwable exception) {
-               this.getLogger().logException(exception);
-       }
-
        /**
         * Initializes properties
         */
@@ -239,37 +261,6 @@ public class AddressbookApplication extends BaseApplication implements Applicati
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
-       /**
-        * Log exception and abort program.
-        *
-        * @param throwable Throwable
-        */
-       protected void abortProgramWithException (final Throwable throwable) {
-               // Log exception
-               this.logException(throwable);
-
-               // Abort here
-               System.exit(1);
-       }
-
-       /**
-        * Enables console client by setting propper flag
-        */
-       private void enableConsoleClient () {
-               this.getLogger().logDebug("Enabling console client (may become optional client) ..."); //NOI18N
-               this.consoleClient = true;
-               this.guiClient = false;
-       }
-
-       /**
-        * Enables GUI client by setting propper flag
-        */
-       private void enableGuiClient () {
-               this.getLogger().logDebug("Enabling GUI client (may become new default client) ..."); //NOI18N
-               this.consoleClient = false;
-               this.guiClient = true;
-       }
-
        /**
         * Checks whether the client shoule be console client should be launched by
         * checking if -console is set.
@@ -369,30 +360,34 @@ public class AddressbookApplication extends BaseApplication implements Applicati
        }
 
        /**
-        * Main method (entry point)
+        * Log exception and abort program.
         * <p>
-        * @param args the command line arguments
+        * @param throwable Throwable
         */
-       public static void main (String[] args) {
-               // Start application
-               new AddressbookApplication().start(args);
+       protected void abortProgramWithException (final Throwable throwable) {
+               // Log exception
+               this.logException(throwable);
+               
+               // Abort here
+               System.exit(1);
        }
 
        /**
-        * Getter for printable application name
+        * Getter for logger instance
         * <p>
-        * @return A printable name
+        * @return Logger instance
         */
-       public static String printableTitle () {
-               return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION); //NOI18N
+       protected LoggerBeanLocal getLogger () {
+               return this.logger;
        }
 
        /**
-        * Getter for logger instance
-        *
-        * @return Logger instance
+        * Logs given exception
+        * <p>
+        * @param exception Throwable
         */
-       protected LoggerBeanLocal getLogger () {
-               return this.logger;
+       protected void logException (final Throwable exception) {
+               this.getLogger().logException(exception);
        }
+
 }
index c53c27d2c79168f4545ff4331d84318c9b8889e9..7045abe51a66cadb4cdfe38399d24d64781226d3 100644 (file)
@@ -16,9 +16,9 @@
  */
 package org.mxchange.addressbook.client;
 
-import org.mxchange.jcore.exceptions.MenuInitializationException;
 import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.exceptions.MenuInitializationException;
 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
 import org.mxchange.jcore.model.contact.Contact;
 import org.mxchange.jcore.model.contact.gender.Gender;
@@ -31,18 +31,18 @@ import org.mxchange.jcore.model.contact.gender.Gender;
 public interface AddressbookClient extends Client {
 
        /**
-        * The user changes own name data
+        * The user changes own address data
         * <p>
-        * @param contact
+        * @param contact Contact instance to change
         */
-       public void doChangeOwnNameData (final Contact contact);
+       public void doChangeOwnAddressData (final Contact contact);
 
        /**
-        * The user changes own address data
+        * The user changes own name data
         * <p>
-        * @param contact Contact instance to change
+        * @param contact
         */
-       public void doChangeOwnAddressData (final Contact contact);
+       public void doChangeOwnNameData (final Contact contact);
 
        /**
         * The user changes own other data
@@ -58,23 +58,6 @@ public interface AddressbookClient extends Client {
         */
        public Contact doEnterOwnData ();
 
-       /**
-        * Asks the user to enter his/her gender (M=Male, F=Female, C=Company)
-        * <p>
-        * @param message Message to output
-        * @return Gender enum
-        */
-       public Gender enterGender (final String message);
-
-       /**
-        * Let the user choose what to change on the address: [n]ame, [a]ddress,
-        * [o]ther
-        * <p>
-        * @param contact Contact instance to let the user change data
-        * @throws UnhandledUserChoiceException If choice is not supported
-        */
-       public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;
-
        /**
         * Asks the user for a choice and proceeds accordingly
         * <p>
@@ -93,17 +76,12 @@ public interface AddressbookClient extends Client {
        public char enterChar (final char[] validChars, final String message);
 
        /**
-        * Reads a string of minimum and maximum length from the user. An empty
-        * string should be generally not allowed, but might be okay for e.g.
-        * company name.
+        * Asks the user to enter his/her gender (M=Male, F=Female, C=Company)
         * <p>
-        * @param minLength     Minimum length of the string to read
-        * @param maxLength     Maximum length of the string to read
-        * @param message       Message to user
-        * @param allowEmpty Whether empty strings are allowed
-        * @return Entered string by user or null if empty string is allowed
+        * @param message Message to output
+        * @return Gender enum
         */
-       public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);
+       public Gender enterGender (final String message);
 
        /**
         * Reads an integer (int) from the user
@@ -115,6 +93,19 @@ public interface AddressbookClient extends Client {
         */
        public int enterInt (final int minimum, final int maximum, final String message);
 
+       /**
+        * Reads a string of minimum and maximum length from the user. An empty
+        * string should be generally not allowed, but might be okay for e.g.
+        * company name.
+        * <p>
+        * @param minLength     Minimum length of the string to read
+        * @param maxLength     Maximum length of the string to read
+        * @param message       Message to user
+        * @param allowEmpty Whether empty strings are allowed
+        * @return Entered string by user or null if empty string is allowed
+        */
+       public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty);
+
        /**
         * Setter for current menu choice
         * <p>
@@ -131,6 +122,11 @@ public interface AddressbookClient extends Client {
         */
        public SelectableMenuItem getMenuItem (final char accessKey, final String text);
 
+       /**
+        * Shows current menu selection to the user
+        */
+       public void showCurrentMenu ();
+
        /**
         * Shows given menu entry in client
         * <p>
@@ -139,7 +135,11 @@ public interface AddressbookClient extends Client {
        public void showEntry (final SelectableMenuItem item);
 
        /**
-        * Shows current menu selection to the user
+        * Let the user choose what to change on the address: [n]ame, [a]ddress,
+        * [o]ther
+        * <p>
+        * @param contact Contact instance to let the user change data
+        * @throws UnhandledUserChoiceException If choice is not supported
         */
-       public void showCurrentMenu ();
+       public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;
 }
index 00a55bdc0ba512578a46213387951e4068dc454f..effa814cc046867f8493481c1733f0e5ff2171cc 100644 (file)
@@ -43,17 +43,17 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
         */
        private String currentMenu;
 
-       /**
-        * Menu system
-        */
-       private final Map<String, Menu> menus;
-
        /**
         * Logger instance
         */
        @Log
        private LoggerBeanLocal logger;
 
+       /**
+        * Menu system
+        */
+       private final Map<String, Menu> menus;
+
        /**
         * No instances can be created of this class
         */
@@ -108,11 +108,33 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
                return menu;
        }
 
+       /**
+        * Logs exception and exits program
+        * <p>
+        * @param throwable Throwable
+        */
+       protected void abortProgramWithException (final Throwable throwable) {
+               // Log exception
+               this.logException(throwable);
+               
+               // Abort here
+               System.exit(1);
+       }
+
        /**
         * Fills menu map with swing menus
         */
        protected abstract void fillMenuMap ();
 
+       /**
+        * Getter for logger instance
+        * <p>
+        * @return Logger instance
+        */
+       protected LoggerBeanLocal getLogger () {
+               return this.logger;
+       }
+
        /**
         * Getter for menus map
         * <p>
@@ -148,6 +170,16 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
+       /**
+        * Logs an exception
+        * <p>
+        * @param throwable Throwable
+        */
+       protected void logException (final Throwable throwable) {
+               // Deligate to logger
+               this.getLogger().logException(throwable);
+       }
+
        /**
         * Shows given menu
         * <p>
@@ -173,36 +205,4 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
                // Trace message
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
-
-       /**
-        * Getter for logger instance
-        *
-        * @return Logger instance
-        */
-       protected LoggerBeanLocal getLogger () {
-               return this.logger;
-       }
-
-       /**
-        * Logs an exception
-        *
-        * @param throwable Throwable
-        */
-       protected void logException (final Throwable throwable) {
-               // Deligate to logger
-               this.getLogger().logException(throwable);
-       }
-
-       /**
-        * Logs exception and exits program
-        *
-        * @param throwable Throwable
-        */
-       protected void abortProgramWithException (final Throwable throwable) {
-               // Log exception
-               this.logException(throwable);
-
-               // Abort here
-               System.exit(1);
-       }
 }
index bc09644749ed8eb6dca4b233e76ea9d16e045bef..3ad6edb5c9db395a9d4d6e3817eeb61a2c270c14 100644 (file)
@@ -62,7 +62,7 @@ import org.mxchange.jcoreswing.model.swing.contact.ContactTableModel;
 
 /**
  * A Swing frame for addressbook.
- *
+ * <p>
  * @author Roland Haeder
  */
 public class AddressbookFrame extends BaseAddressbookSystem implements ClientFrame {
index 8d91d075abb948656aa4b504e3b3f9ad588eaafc..20d0e5fd3909eb6cb58f698ee8ed266859744720 100644 (file)
@@ -30,7 +30,7 @@ import org.mxchange.jcoreswing.client.gui.ClientFrame;
 
 /**
  * A swing client
- *
+ * <p>
  * @author Roland Haeder
  */
 public class SwingClient extends BaseAddressbookClient implements AddressbookClient {
index d5833c45921a99f542344ad719d7ecec7ae4e44e..9b0a0b33d45f358615c38e3d031ec4fb1ebcc4e5 100644 (file)
@@ -47,17 +47,17 @@ public class AddressbookContactManager extends BaseManager implements Manageable
         */
        private final List<String> columnNames;
 
-       /**
-        * Translated column name list
-        */
-       private final List<String> translatedColumnNames;
-
        /**
         * Logger instance
         */
        @Log
        private LoggerBeanLocal logger;
 
+       /**
+        * Translated column name list
+        */
+       private final List<String> translatedColumnNames;
+
        /**
         * Constructor which accepts maxContacts for maximum (initial) contacts and
         * a client instance.
@@ -93,11 +93,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                //* NOISY-DEBUG: */ this.getLogger().logDebug("client=" + client);
        }
 
-       /**
-        * Adds given Contact instance to list
-        * <p>
-        * @param contact Contact instance to add
-        */
        @Override
        public void addContact (final Contact contact) throws ContactAlreadyAddedException {
                // Trace message
@@ -116,19 +111,11 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Let the user add a new other address
-        */
        @Override
        public void doAddOtherAddress () {
                throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
-       /**
-        * Let the user change address data
-        * <p>
-        * @param contact Instance to change data
-        */
        @Override
        public void doChangeAddressData (final Contact contact) {
                // Trace message
@@ -163,11 +150,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Let the user change "name data"
-        * <p>
-        * @param contact Instance to change data
-        */
        @Override
        public void doChangeNameData (final Contact contact) {
                // Trace message
@@ -198,19 +180,11 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Let the user change other address
-        */
        @Override
        public void doChangeOtherAddress () {
                throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
-       /**
-        * Let the user change other data
-        * <p>
-        * @param contact Instance to change data TODO Didn't handle birthday
-        */
        @Override
        public void doChangeOtherData (final Contact contact) {
                // Trace message
@@ -241,9 +215,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Allows the user to change his/her own data
-        */
        @Override
        public void doChangeOwnData () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
                // Trace message
@@ -284,17 +255,11 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Let the user delete other address
-        */
        @Override
        public void doDeleteOtherAddress () {
                throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
-       /**
-        * Asks user for own data
-        */
        @Override
        public void doEnterOwnData () throws ContactAlreadyAddedException, IOException {
                // Trace message
@@ -332,12 +297,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                throw new UnsupportedOperationException("Not supported yet."); //NOI18N
        }
 
-       /**
-        * Shuts down this contact manager
-        * <p>
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws java.io.IOException If an IO error occurs
-        */
        @Override
        public void doShutdown () throws SQLException, IOException {
                // Trace message
@@ -350,11 +309,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
-       /**
-        * Asks the user for his/her cellphone number
-        * <p>
-        * @return User's cellphone number
-        */
        @Override
        public String enterOwnCellNumber () {
                // Trace message
@@ -366,11 +320,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(5, 30, "Bitte geben Sie Ihre Handynummer an: ", true);
        }
 
-       /**
-        * Asks the user for his/her city's name
-        * <p>
-        * @return City's name of the user
-        */
        @Override
        public String enterOwnCity () {
                // Trace message
@@ -382,11 +331,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(3, 50, "Bitte geben Sie Ihre Wohnort ein: ", false);
        }
 
-       /**
-        * Asks the user for his/her city's name
-        * <p>
-        * @return City's name of the user
-        */
        @Override
        public String enterOwnComment () {
                // Trace message
@@ -398,11 +342,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(0, 100, "Kommentar zu Ihrem Eintrag: ", true);
        }
 
-       /**
-        * Asks the user for his/her company name
-        * <p>
-        * @return User's company name
-        */
        @Override
        public String enterOwnCompanyName () {
                // Trace message
@@ -414,11 +353,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(5, 50, "Bitte geben Sie Ihre Firmenbezeichnung ein: ", true);
        }
 
-       /**
-        * Asks user for his/her own country code
-        * <p>
-        * @return User's own country code
-        */
        @Override
        public String enterOwnCountryCode () {
                // Trace message
@@ -430,11 +364,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(2, 2, "Bitte geben Sie den zweistelligen Ländercode von Ihrem Land ein: ", false).toUpperCase();
        }
 
-       /**
-        * Asks user for his/her own country code
-        * <p>
-        * @return User's own country code
-        */
        @Override
        public String enterOwnEmailAddress () {
                // Trace message
@@ -446,11 +375,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(10, 50, "Bitte geben Sie Ihre Email-Adresse ein: ", true);
        }
 
-       /**
-        * Asks the user for family name
-        * <p>
-        * @return Family name of the user
-        */
        @Override
        public String enterOwnFamilyName () {
                // Trace message
@@ -462,11 +386,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(2, 50, "Bitte geben Sie Ihren Nachnamen ein: ", false);
        }
 
-       /**
-        * Asks the user for family name
-        * <p>
-        * @return Family name of the user
-        */
        @Override
        public String enterOwnFaxNumber () {
                // Trace message
@@ -478,11 +397,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(5, 30, "Bitte geben Sie Ihre Faxnummer an: ", true);
        }
 
-       /**
-        * Asks the user for surname
-        * <p>
-        * @return Surname of the user
-        */
        @Override
        public String enterOwnFirstName () {
                // Trace message
@@ -494,11 +408,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false);
        }
 
-       /**
-        * Asks the user for gender, until a valid has been entered
-        * <p>
-        * @return Gender of the user
-        */
        @Override
        public Gender enterOwnGender () {
                // Trace message
@@ -510,11 +419,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterGender("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): ");
        }
 
-       /**
-        * Asks the user for phone number
-        * <p>
-        * @return Phone number of the user
-        */
        @Override
        public String enterOwnPhoneNumber () {
                // Trace message
@@ -526,11 +430,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(5, 30, "Bitte geben Sie Ihre Telefonnummer an: ", true);
        }
 
-       /**
-        * Asks the user for own street (including number)
-        * <p>
-        * @return Own street an number
-        */
        @Override
        public String enterOwnStreet () {
                // Trace message
@@ -542,11 +441,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return client.enterString(5, 50, "Bitte geben Sie Ihre Strasse und Hausnummer ein: ", false);
        }
 
-       /**
-        * Asks the user for own ZIP code
-        * <p>
-        * @return ZIP code
-        */
        @Override
        public int enterOwnZipCode () {
                // Trace message
@@ -620,12 +514,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return value;
        }
 
-       /**
-        * Checks whether own contact is already added by checking all entries for
-        * isOwnContact flag
-        * <p>
-        * @return Whether own contact is already added
-        */
        @Override
        public boolean isOwnContactAdded () throws IOException {
                // Trace message
@@ -649,20 +537,6 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                return isAdded;
        }
 
-       /**
-        * Logs given exception
-        * <p>
-        * @param exception Throwable
-        */
-       protected void logException (final Throwable exception) {
-               this.getLogger().logException(exception);
-       }
-
-       /**
-        * Adds given contact to address book and flushes all entries to database
-        * <p>
-        * @param contact Contact being added TODO Add check for book size
-        */
        @Override
        public void registerContact (final Contact contact) {
                // Trace message
@@ -784,4 +658,13 @@ public class AddressbookContactManager extends BaseManager implements Manageable
                // Return instance or null
                return contact;
        }
+
+       /**
+        * Logs given exception
+        * <p>
+        * @param exception Throwable
+        */
+       protected void logException (final Throwable exception) {
+               this.getLogger().logException(exception);
+       }
 }
index 7fb7f011f396632f4e006b56ca81dce2427d9f59..c288c377b7ab7c8f9c458ee899edb074bec10803 100644 (file)
@@ -32,188 +32,186 @@ import org.mxchange.jcore.model.contact.gender.Gender;
 public interface ManageableContactAddressbook extends Manageable {
 
        /**
-        * Allows the user to enter own cellphone number.
+        * Adds given Contact instance to list
         * <p>
-        * @return Cellphone number
+        * @param contact Contact instance to add
+        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
         */
-       public String enterOwnCellNumber ();
+       public void addContact (final Contact contact) throws ContactAlreadyAddedException;
 
        /**
-        * Allows the user to enter own city name.
-        * <p>
-        * @return City name
+        * Let the user add a new other address
         */
-       public String enterOwnCity ();
+       public void doAddOtherAddress ();
 
        /**
-        * Allows the user to enter comment for own entry.
+        * The user can change address data, like street, ZIP code, city and country
+        * of given Contact instance.
         * <p>
-        * @return Comment
+        * @param contact Instance to change data
         */
-       public String enterOwnComment ();
+       public void doChangeAddressData (final Contact contact);
 
        /**
-        * Allows the user to enter own company name.
+        * The user can change name data, like gender, surname, family name and
+        * company name (if business contact).
         * <p>
-        * @return Company name
+        * @param contact Instance to change data
         */
-       public String enterOwnCompanyName ();
+       public void doChangeNameData (final Contact contact);
 
        /**
-        * Allows the user to enter own country code.
-        * <p>
-        * @return Country code
+        * Let the user change other address
         */
-       public String enterOwnCountryCode ();
+       public void doChangeOtherAddress ();
 
        /**
-        * Allows the user to enter own email address.
+        * The user can change other data, like phone numbers or comments.
         * <p>
-        * @return Email address
+        * @param contact Instance to change data
         */
-       public String enterOwnEmailAddress ();
+       public void doChangeOtherData (final Contact contact);
 
        /**
-        * Allows the user to enter own family name.
+        * Let the user change own data
         * <p>
-        * @return Family name
+        * @throws java.sql.SQLException If an SQL error occurs
+        * @throws java.io.IOException If an IO error occurs
+        * @throws java.lang.NoSuchMethodException If a method cannot be found
+        * @throws java.lang.IllegalAccessException If a method is not accessible
+        * @throws java.lang.reflect.InvocationTargetException Any other problems?
         */
-       public String enterOwnFamilyName ();
+       public void doChangeOwnData () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
 
        /**
-        * Allows the user to enter own fax number.
-        * <p>
-        * @return Fax number
+        * Let the user delete other address
         */
-       public String enterOwnFaxNumber ();
+       public void doDeleteOtherAddress ();
 
        /**
-        * Allows the user to enter own gender.
+        * Asks user for own data
         * <p>
-        * @return Gender
+        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException
+        * If own contact is already added
+        * @throws java.io.IOException If an IO error was found
         */
-       public Gender enterOwnGender ();
+       public void doEnterOwnData () throws ContactAlreadyAddedException, IOException;
 
        /**
-        * Allows the user to enter own phone number.
-        * <p>
-        * @return Phone number
+        * List all contacts
         */
-       public String enterOwnPhoneNumber ();
+       public void doListContacts ();
 
        /**
-        * Allows the user to enter own street and house number.
-        * <p>
-        * @return Street and house number
+        * Searches address book for a contact
         */
-       public String enterOwnStreet ();
+       public void doSearchContacts ();
 
        /**
-        * Allows the user to enter own surname.
+        * Allows the user to enter own cellphone number.
         * <p>
-        * @return Surname
+        * @return Cellphone number
         */
-       public String enterOwnFirstName ();
+       public String enterOwnCellNumber ();
 
        /**
-        * Allows the user to enter own ZIP code.
+        * Allows the user to enter own city name.
         * <p>
-        * @return ZIP code
+        * @return City name
         */
-       public int enterOwnZipCode ();
+       public String enterOwnCity ();
 
        /**
-        * List all contacts
+        * Allows the user to enter comment for own entry.
+        * <p>
+        * @return Comment
         */
-       public void doListContacts ();
+       public String enterOwnComment ();
 
        /**
-        * Adds given contact to address book
+        * Allows the user to enter own company name.
         * <p>
-        * @param contact Contact being added TODO Add check for book size
+        * @return Company name
         */
-       public void registerContact (final Contact contact);
+       public String enterOwnCompanyName ();
 
        /**
-        * Adds given Contact instance to list
+        * Allows the user to enter own country code.
         * <p>
-        * @param contact Contact instance to add
-        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException
-        * If the contact is already added
+        * @return Country code
         */
-       public void addContact (final Contact contact) throws ContactAlreadyAddedException;
+       public String enterOwnCountryCode ();
 
        /**
-        * Let the user add a new other address
+        * Allows the user to enter own email address.
+        * <p>
+        * @return Email address
         */
-       public void doAddOtherAddress ();
+       public String enterOwnEmailAddress ();
 
        /**
-        * The user can change address data, like street, ZIP code, city and country
-        * of given Contact instance.
+        * Allows the user to enter own family name.
         * <p>
-        * @param contact Instance to change data
+        * @return Family name
         */
-       public void doChangeAddressData (final Contact contact);
+       public String enterOwnFamilyName ();
 
        /**
-        * The user can change name data, like gender, surname, family name and
-        * company name (if business contact).
+        * Allows the user to enter own fax number.
         * <p>
-        * @param contact Instance to change data
+        * @return Fax number
         */
-       public void doChangeNameData (final Contact contact);
+       public String enterOwnFaxNumber ();
 
        /**
-        * Let the user change other address
+        * Allows the user to enter own surname.
+        * <p>
+        * @return Surname
         */
-       public void doChangeOtherAddress ();
+       public String enterOwnFirstName ();
 
        /**
-        * The user can change other data, like phone numbers or comments.
+        * Allows the user to enter own gender.
         * <p>
-        * @param contact Instance to change data
+        * @return Gender
         */
-       public void doChangeOtherData (final Contact contact);
+       public Gender enterOwnGender ();
 
        /**
-        * Let the user change own data
+        * Allows the user to enter own phone number.
         * <p>
-        * @throws java.sql.SQLException If an SQL error occurs
-        * @throws java.io.IOException If an IO error occurs
-        * @throws java.lang.NoSuchMethodException If a method cannot be found
-        * @throws java.lang.IllegalAccessException If a method is not accessible
-        * @throws java.lang.reflect.InvocationTargetException Any other problems?
+        * @return Phone number
         */
-       public void doChangeOwnData () throws IOException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+       public String enterOwnPhoneNumber ();
 
        /**
-        * Let the user delete other address
+        * Allows the user to enter own street and house number.
+        * <p>
+        * @return Street and house number
         */
-       public void doDeleteOtherAddress ();
+       public String enterOwnStreet ();
 
        /**
-        * Asks user for own data
+        * Allows the user to enter own ZIP code.
         * <p>
-        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException
-        * If own contact is already added
-        * @throws java.io.IOException If an IO error was found
+        * @return ZIP code
         */
-       public void doEnterOwnData () throws ContactAlreadyAddedException, IOException;
+       public int enterOwnZipCode ();
 
        /**
-        * Searches address book for a contact
+        * Getter for column count
+        * <p>
+        * @return Column count TODO: This is needed for TableModel in Swing
         */
-       public void doSearchContacts ();
+       public int getColumnCount ();
 
        /**
-        * Checks whether own contact is already added by checking all entries for
-        * isOwnContact flag
+        * Getter for column name at given index.
         * <p>
-        * @return Whether own contact is already added
-        * @throws java.io.IOException If an IO error occurs
+        * @param columnIndex Column index
+        * @return Database column name TODO: This is needed for TableModel in Swing
         */
-       public boolean isOwnContactAdded () throws IOException;
+       public String getColumnName (final int columnIndex);
 
        /**
         * Getter for translated column name at given index.
@@ -231,25 +229,25 @@ public interface ManageableContactAddressbook extends Manageable {
         * @param columnIndex Column index
         * @return Value from given row/column
         * @throws java.lang.NoSuchMethodException If the method was not found
-        * @throws java.lang.IllegalAccessException If the accessed method was not
-        * public
+        * @throws java.lang.IllegalAccessException If the accessed method was not public
         * @throws java.lang.reflect.InvocationTargetException Something else
         * happened? TODO: This is needed for TableModel in Swing
         */
        public Object getValueFromRowColumn (final int rowIndex, final int columnIndex) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
 
        /**
-        * Getter for column name at given index.
+        * Checks whether own contact is already added by checking all entries for
+        * isOwnContact flag
         * <p>
-        * @param columnIndex Column index
-        * @return Database column name TODO: This is needed for TableModel in Swing
+        * @return Whether own contact is already added
+        * @throws java.io.IOException If an IO error occurs
         */
-       public String getColumnName (final int columnIndex);
+       public boolean isOwnContactAdded () throws IOException;
 
        /**
-        * Getter for column count
+        * Adds given contact to address book
         * <p>
-        * @return Column count TODO: This is needed for TableModel in Swing
+        * @param contact Contact being added TODO Add check for book size
         */
-       public int getColumnCount ();
+       public void registerContact (final Contact contact);
 }
index 019c8e03b4778fdd8395100a7828f2bd27d672ef..cf5b916ff17bc502bb76710ada4d1fb2afdee318 100644 (file)
@@ -26,10 +26,10 @@ import org.mxchange.jcore.client.Client;
 
 /**
  * A general menu class
- *
+ * <p>
  * @author Roland Haeder
  */
-public abstract class BaseMenu extends BaseAddressbookSystem {
+public abstract class BaseMenu extends BaseAddressbookSystem implements Menu {
 
        /**
         * Menu list
@@ -42,29 +42,17 @@ public abstract class BaseMenu extends BaseAddressbookSystem {
        protected BaseMenu () {
        }
 
-       /**
-        * Size of menu items
-        * <p>
-        * @return Count of menu items
-        */
+       @Override
        public int getMenuItemsCount () {
                return this.menuList.size();
        }
 
-       /**
-        * "Getter" for an iterator of this menu's items
-        * <p>
-        * @return An iterator of all menu items
-        */
+       @Override
        public Iterator<SelectableMenuItem> getMenuItemsIterator () {
                return this.menuList.iterator();
        }
 
-       /**
-        * Shows this menu
-        * <p>
-        * @param client Client instance to call back
-        */
+       @Override
        public void show (final Client client) {
                // Trace message
                this.getLogger().logTrace(MessageFormat.format("client={0} CALLED!", client)); //NOI18N
index 909d2ef2fbf251f03ab3ae96b6fb7b1426d3a2c3..a0ba62f9f1539f8b37bcf253f6cfbd9ffdf80b4d 100644 (file)
@@ -27,6 +27,13 @@ import org.mxchange.jcore.client.Client;
  */
 public interface Menu {
 
+       /**
+        * Size of all menu items
+        * <p>
+        * @return
+        */
+       public int getMenuItemsCount ();
+
        /**
         * "Getter" for an iterator on all menu items of the current menu
         * <p>
@@ -40,11 +47,4 @@ public interface Menu {
         * @param client Client instance
         */
        public void show (final Client client);
-
-       /**
-        * Size of all menu items
-        * <p>
-        * @return
-        */
-       public int getMenuItemsCount ();
 }
index 9f424755423583db5a98ef321dcb5fd77d6eaaf0..87f8c114733b6ef686d8f7a6d35638c0fc5d092e 100644 (file)
@@ -24,7 +24,7 @@ import org.mxchange.jcore.exceptions.MenuInitializationException;
 
 /**
  * Menu utilities
- *
+ * <p>
  * @author Roland Haeder
  */
 public class MenuTools extends BaseAddressbookSystem {
index ad325cb752bc930063d9e32b013ee7bcfa22ad19..6c7d8bf7b6a1ef336cecc6211ffe0f96ad29bd5d 100644 (file)
@@ -23,7 +23,8 @@ import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.jcore.client.Client;
 
 /**
- *
+ * A menu system for the console
+ * <p>
  * @author Roland Haeder
  */
 public class ConsoleMenu extends BaseMenu implements Menu {
index 665923ef03b2101566e4d948eb5fe8c89a7dd41d..473e9e4ac1a319590d404051a3854e2983a23815 100644 (file)
@@ -20,9 +20,9 @@ import org.mxchange.addressbook.BaseAddressbookSystem;
 
 /**
  * A general menu item class
- *
+ * <p>
  * @author Roland Haeder
  */
-public class BaseMenuItem extends BaseAddressbookSystem {
+public abstract class BaseMenuItem extends BaseAddressbookSystem {
 
 }
index 28fa76bb95a038784d87c072eb320944f27c1e64..59758f821b201f9619d514052a705b6259e0bbce 100644 (file)
@@ -20,18 +20,12 @@ import org.mxchange.jcore.FrameworkInterface;
 import org.mxchange.jcore.client.Client;
 
 /**
- *
+ * A selectable menu item intereface
+ * <p>
  * @author Roland Haeder
  */
 public interface SelectableMenuItem extends FrameworkInterface {
 
-       /**
-        * Shows this menu item
-        * <p>
-        * @param client Client instance
-        */
-       public void show (final Client client);
-
        /**
         * Access key
         * <p>
@@ -45,4 +39,11 @@ public interface SelectableMenuItem extends FrameworkInterface {
         * @return the text
         */
        public String getText ();
+
+       /**
+        * Shows this menu item
+        * <p>
+        * @param client Client instance
+        */
+       public void show (final Client client);
 }
index fd008a9bb0c1864fc595fa1a41bf66db3ce05159..74f8180171e45c128a3e30682538d380aaae19c8 100644 (file)
@@ -23,7 +23,8 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem;
 import org.mxchange.jcore.client.Client;
 
 /**
- *
+ * A menu item class for the console
+ * <p>
  * @author Roland Haeder
  */
 public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem {
@@ -49,44 +50,16 @@ public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem
                this.setText(text);
        }
 
-       /**
-        * Access key
-        * <p>
-        * @return the accessKey
-        */
        @Override
        public final char getAccessKey () {
                return this.accessKey;
        }
 
-       /**
-        * Access key
-        * <p>
-        * @param accessKey the accessKey to set
-        */
-       private void setAccessKey (char accessKey) {
-               this.accessKey = accessKey;
-       }
-
-       /**
-        * Text to user
-        * <p>
-        * @return the text
-        */
        @Override
        public String getText () {
                return this.text;
        }
 
-       /**
-        * Text to user
-        * <p>
-        * @param text the text to set
-        */
-       private void setText (String text) {
-               this.text = text;
-       }
-
        @Override
        public void show (final Client client) {
                // Trace message
@@ -111,4 +84,22 @@ public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem
                this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
+       /**
+        * Text to user
+        * <p>
+        * @param text the text to set
+        */
+       private void setText (final String text) {
+               this.text = text;
+       }
+
+       /**
+        * Access key
+        * <p>
+        * @param accessKey the accessKey to set
+        */
+       private void setAccessKey (final char accessKey) {
+               this.accessKey = accessKey;
+       }
+
 }