From: Roland Haeder Date: Wed, 30 Sep 2015 10:32:33 +0000 (+0200) Subject: auto-reformatted most project files X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d320d13f3f26ab01c36a7d6857918b141977454a;p=jfinancials-swing.git auto-reformatted most project files Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/addressbook/BaseAddressbookSystem.java b/src/org/mxchange/addressbook/BaseAddressbookSystem.java index 6f4ec4a..f0d1d9a 100644 --- a/src/org/mxchange/addressbook/BaseAddressbookSystem.java +++ b/src/org/mxchange/addressbook/BaseAddressbookSystem.java @@ -52,6 +52,19 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { } } + /** + * Log exception and abort program. + *

+ * @param throwable Throwable + */ + protected void abortProgramWithException (final Throwable throwable) { + // Log exception + this.logException(throwable); + + // Abort here + System.exit(1); + } + /** * Getter for logger instance *

@@ -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. - *

- * @param throwable Throwable - */ - protected void abortProgramWithException (final Throwable throwable) { - // Log exception - this.logException(throwable); - - // Abort here - System.exit(1); - } } diff --git a/src/org/mxchange/addressbook/application/AddressbookApplication.java b/src/org/mxchange/addressbook/application/AddressbookApplication.java index 4f07e31..813e797 100644 --- a/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -92,8 +92,24 @@ public class AddressbookApplication extends BaseApplication implements Applicati } /** - * Bootstraps application + * Main method (entry point) + *

+ * @param args the command line arguments + */ + public static void main (String[] args) { + // Start application + new AddressbookApplication().start(args); + } + + /** + * Getter for printable application name + *

+ * @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. *

- * @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 *

- * @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 + *

+ * @param exception Throwable */ - protected LoggerBeanLocal getLogger () { - return this.logger; + protected void logException (final Throwable exception) { + this.getLogger().logException(exception); } + } diff --git a/src/org/mxchange/addressbook/client/AddressbookClient.java b/src/org/mxchange/addressbook/client/AddressbookClient.java index c53c27d..7045abe 100644 --- a/src/org/mxchange/addressbook/client/AddressbookClient.java +++ b/src/org/mxchange/addressbook/client/AddressbookClient.java @@ -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 *

- * @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 *

- * @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) - *

- * @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 - *

- * @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 *

@@ -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) *

- * @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. + *

+ * @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 *

@@ -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 *

@@ -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 + *

+ * @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; } diff --git a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java index 00a55bd..effa814 100644 --- a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java +++ b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java @@ -43,17 +43,17 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres */ private String currentMenu; - /** - * Menu system - */ - private final Map menus; - /** * Logger instance */ @Log private LoggerBeanLocal logger; + /** + * Menu system + */ + private final Map 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 + *

+ * @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 + *

+ * @return Logger instance + */ + protected LoggerBeanLocal getLogger () { + return this.logger; + } + /** * Getter for menus map *

@@ -148,6 +170,16 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres this.getLogger().logTrace("EXIT!"); //NOI18N } + /** + * Logs an exception + *

+ * @param throwable Throwable + */ + protected void logException (final Throwable throwable) { + // Deligate to logger + this.getLogger().logException(throwable); + } + /** * Shows given menu *

@@ -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); - } } diff --git a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index bc09644..3ad6edb 100644 --- a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -62,7 +62,7 @@ import org.mxchange.jcoreswing.model.swing.contact.ContactTableModel; /** * A Swing frame for addressbook. - * + *

* @author Roland Haeder */ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFrame { diff --git a/src/org/mxchange/addressbook/client/gui/SwingClient.java b/src/org/mxchange/addressbook/client/gui/SwingClient.java index 8d91d07..20d0e5f 100644 --- a/src/org/mxchange/addressbook/client/gui/SwingClient.java +++ b/src/org/mxchange/addressbook/client/gui/SwingClient.java @@ -30,7 +30,7 @@ import org.mxchange.jcoreswing.client.gui.ClientFrame; /** * A swing client - * + *

* @author Roland Haeder */ public class SwingClient extends BaseAddressbookClient implements AddressbookClient { diff --git a/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java b/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java index d5833c4..9b0a0b3 100644 --- a/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java +++ b/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java @@ -47,17 +47,17 @@ public class AddressbookContactManager extends BaseManager implements Manageable */ private final List columnNames; - /** - * Translated column name list - */ - private final List translatedColumnNames; - /** * Logger instance */ @Log private LoggerBeanLocal logger; + /** + * Translated column name list + */ + private final List 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 - *

- * @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 - *

- * @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" - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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) - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 - *

- * @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 + *

+ * @param exception Throwable + */ + protected void logException (final Throwable exception) { + this.getLogger().logException(exception); + } } diff --git a/src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java b/src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java index 7fb7f01..c288c37 100644 --- a/src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java +++ b/src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java @@ -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 *

- * @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. - *

- * @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. *

- * @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). *

- * @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. - *

- * @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. *

- * @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 *

- * @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. - *

- * @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 *

- * @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. - *

- * @return Phone number + * List all contacts */ - public String enterOwnPhoneNumber (); + public void doListContacts (); /** - * Allows the user to enter own street and house number. - *

- * @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. *

- * @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. *

- * @return ZIP code + * @return City name */ - public int enterOwnZipCode (); + public String enterOwnCity (); /** - * List all contacts + * Allows the user to enter comment for own entry. + *

+ * @return Comment */ - public void doListContacts (); + public String enterOwnComment (); /** - * Adds given contact to address book + * Allows the user to enter own company name. *

- * @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. *

- * @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. + *

+ * @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. *

- * @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. *

- * @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. + *

+ * @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. *

- * @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. *

- * @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. + *

+ * @return Street and house number */ - public void doDeleteOtherAddress (); + public String enterOwnStreet (); /** - * Asks user for own data + * Allows the user to enter own ZIP code. *

- * @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 + *

+ * @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. *

- * @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 *

- * @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 *

- * @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); } diff --git a/src/org/mxchange/addressbook/menu/BaseMenu.java b/src/org/mxchange/addressbook/menu/BaseMenu.java index 019c8e0..cf5b916 100644 --- a/src/org/mxchange/addressbook/menu/BaseMenu.java +++ b/src/org/mxchange/addressbook/menu/BaseMenu.java @@ -26,10 +26,10 @@ import org.mxchange.jcore.client.Client; /** * A general menu class - * + *

* @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 - *

- * @return Count of menu items - */ + @Override public int getMenuItemsCount () { return this.menuList.size(); } - /** - * "Getter" for an iterator of this menu's items - *

- * @return An iterator of all menu items - */ + @Override public Iterator getMenuItemsIterator () { return this.menuList.iterator(); } - /** - * Shows this menu - *

- * @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 diff --git a/src/org/mxchange/addressbook/menu/Menu.java b/src/org/mxchange/addressbook/menu/Menu.java index 909d2ef..a0ba62f 100644 --- a/src/org/mxchange/addressbook/menu/Menu.java +++ b/src/org/mxchange/addressbook/menu/Menu.java @@ -27,6 +27,13 @@ import org.mxchange.jcore.client.Client; */ public interface Menu { + /** + * Size of all menu items + *

+ * @return + */ + public int getMenuItemsCount (); + /** * "Getter" for an iterator on all menu items of the current menu *

@@ -40,11 +47,4 @@ public interface Menu { * @param client Client instance */ public void show (final Client client); - - /** - * Size of all menu items - *

- * @return - */ - public int getMenuItemsCount (); } diff --git a/src/org/mxchange/addressbook/menu/MenuTools.java b/src/org/mxchange/addressbook/menu/MenuTools.java index 9f42475..87f8c11 100644 --- a/src/org/mxchange/addressbook/menu/MenuTools.java +++ b/src/org/mxchange/addressbook/menu/MenuTools.java @@ -24,7 +24,7 @@ import org.mxchange.jcore.exceptions.MenuInitializationException; /** * Menu utilities - * + *

* @author Roland Haeder */ public class MenuTools extends BaseAddressbookSystem { diff --git a/src/org/mxchange/addressbook/menu/console/ConsoleMenu.java b/src/org/mxchange/addressbook/menu/console/ConsoleMenu.java index ad325cb..6c7d8bf 100644 --- a/src/org/mxchange/addressbook/menu/console/ConsoleMenu.java +++ b/src/org/mxchange/addressbook/menu/console/ConsoleMenu.java @@ -23,7 +23,8 @@ import org.mxchange.addressbook.menu.Menu; import org.mxchange.jcore.client.Client; /** - * + * A menu system for the console + *

* @author Roland Haeder */ public class ConsoleMenu extends BaseMenu implements Menu { diff --git a/src/org/mxchange/addressbook/menu/item/BaseMenuItem.java b/src/org/mxchange/addressbook/menu/item/BaseMenuItem.java index 665923e..473e9e4 100644 --- a/src/org/mxchange/addressbook/menu/item/BaseMenuItem.java +++ b/src/org/mxchange/addressbook/menu/item/BaseMenuItem.java @@ -20,9 +20,9 @@ import org.mxchange.addressbook.BaseAddressbookSystem; /** * A general menu item class - * + *

* @author Roland Haeder */ -public class BaseMenuItem extends BaseAddressbookSystem { +public abstract class BaseMenuItem extends BaseAddressbookSystem { } diff --git a/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java b/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java index 28fa76b..59758f8 100644 --- a/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java +++ b/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java @@ -20,18 +20,12 @@ import org.mxchange.jcore.FrameworkInterface; import org.mxchange.jcore.client.Client; /** - * + * A selectable menu item intereface + *

* @author Roland Haeder */ public interface SelectableMenuItem extends FrameworkInterface { - /** - * Shows this menu item - *

- * @param client Client instance - */ - public void show (final Client client); - /** * Access key *

@@ -45,4 +39,11 @@ public interface SelectableMenuItem extends FrameworkInterface { * @return the text */ public String getText (); + + /** + * Shows this menu item + *

+ * @param client Client instance + */ + public void show (final Client client); } diff --git a/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java b/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java index fd008a9..74f8180 100644 --- a/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java +++ b/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java @@ -23,7 +23,8 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.jcore.client.Client; /** - * + * A menu item class for the console + *

* @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 - *

- * @return the accessKey - */ @Override public final char getAccessKey () { return this.accessKey; } - /** - * Access key - *

- * @param accessKey the accessKey to set - */ - private void setAccessKey (char accessKey) { - this.accessKey = accessKey; - } - - /** - * Text to user - *

- * @return the text - */ @Override public String getText () { return this.text; } - /** - * Text to user - *

- * @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 + *

+ * @param text the text to set + */ + private void setText (final String text) { + this.text = text; + } + + /** + * Access key + *

+ * @param accessKey the accessKey to set + */ + private void setAccessKey (final char accessKey) { + this.accessKey = accessKey; + } + }