From: Roland Haeder Date: Thu, 15 Oct 2015 07:50:40 +0000 (+0200) Subject: Cleanup through inspection + updated jar(s) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=81436f1b3a103356d1580ef7be1b7306d36b2b7c;p=addressbook-swing.git Cleanup through inspection + updated jar(s) Signed-off-by:Roland Häder --- diff --git a/lib/jcontacts-business-core.jar b/lib/jcontacts-business-core.jar index b0ead65..2314d55 100644 Binary files a/lib/jcontacts-business-core.jar and b/lib/jcontacts-business-core.jar differ diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index 4bf2b79..588f0e3 100644 Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ diff --git a/lib/jcore-logger-lib.jar b/lib/jcore-logger-lib.jar index 5049937..ce30ba8 100644 Binary files a/lib/jcore-logger-lib.jar and b/lib/jcore-logger-lib.jar differ diff --git a/lib/jcore-swing.jar b/lib/jcore-swing.jar index 427a4b3..b66098f 100644 Binary files a/lib/jcore-swing.jar and b/lib/jcore-swing.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar index a6eb677..1c2e570 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcountry-core.jar b/lib/jcountry-core.jar index 9daf436..eaf6110 100644 Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ diff --git a/lib/jphone-core.jar b/lib/jphone-core.jar index 97bdd39..9637788 100644 Binary files a/lib/jphone-core.jar and b/lib/jphone-core.jar differ diff --git a/src/org/mxchange/addressbook/application/AddressbookApplication.java b/src/org/mxchange/addressbook/application/AddressbookApplication.java index c84b7f4..20b26ac 100644 --- a/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -52,6 +52,25 @@ public class AddressbookApplication extends BaseApplication implements Applicati */ public static final String APP_VERSION = "0.0"; //NOI18N + /** + * 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 + } + /** * Console client is enabled by default */ @@ -91,25 +110,6 @@ public class AddressbookApplication extends BaseApplication implements Applicati this.init(); } - /** - * 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 @@ -289,19 +289,18 @@ public class AddressbookApplication extends BaseApplication implements Applicati private void parseArguments (final String[] args) { // Trace message this.getLogger().logTrace(MessageFormat.format("args()={0} - CALLED!", args.length)); //NOI18N - // Debug message this.getLogger().logDebug(MessageFormat.format("Parsing {0} arguments ...", args.length)); //NOI18N - for (final String arg : args) { // Switch on it switch (arg) { - case "-console": //NOI18N - enableConsoleClient(); + case "-console": + //NOI18N + this.enableConsoleClient(); break; - - case "-gui": //NOI18N - enableGuiClient(); + case "-gui": + //NOI18N + this.enableGuiClient(); break; } } @@ -390,4 +389,5 @@ public class AddressbookApplication extends BaseApplication implements Applicati this.getLogger().logException(exception); } + } diff --git a/src/org/mxchange/addressbook/client/AddressbookClient.java b/src/org/mxchange/addressbook/client/AddressbookClient.java index 4961722..4a4b67a 100644 --- a/src/org/mxchange/addressbook/client/AddressbookClient.java +++ b/src/org/mxchange/addressbook/client/AddressbookClient.java @@ -35,56 +35,56 @@ public interface AddressbookClient extends Client { *

* @param contact Contact to show address from */ - public void displayAddressBox (final Contact contact); + void displayAddressBox (final Contact contact); /** * Displays a "box" for the name *

* @param contact Contact to show name from */ - public void displayNameBox (final Contact contact); + void displayNameBox (final Contact contact); /** * Displays a "box" for other data *

* @param contact Contact to show other data from */ - public void displayOtherDataBox (final Contact contact); + void displayOtherDataBox (final Contact contact); /** * Shows given contact instamce *

* @param contact Contact instance */ - public void show (final Contact contact); + void show (final Contact contact); /** * The user changes own address data *

* @param contact Contact instance to change */ - public void doChangeOwnAddressData (final Contact contact); + void doChangeOwnAddressData (final Contact contact); /** * The user changes own name data *

* @param contact */ - public void doChangeOwnNameData (final Contact contact); + void doChangeOwnNameData (final Contact contact); /** * The user changes own other data *

* @param contact Constact instance to change */ - public void doChangeOwnOtherData (final Contact contact); + void doChangeOwnOtherData (final Contact contact); /** * Allows the user to enter own data *

* @return Finished Contact instance */ - public Contact doEnterOwnData (); + Contact doEnterOwnData (); /** * Asks the user for a choice and proceeds accordingly @@ -93,7 +93,7 @@ public interface AddressbookClient extends Client { * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the * menu cannot be initialized */ - public void doUserMenuChoice () throws UnhandledUserChoiceException, MenuInitializationException; + void doUserMenuChoice () throws UnhandledUserChoiceException, MenuInitializationException; /** * Asks the the user to enter a single character which must match validChars @@ -103,7 +103,7 @@ public interface AddressbookClient extends Client { *

* @return Allowed character */ - public char enterChar (final char[] validChars, final String message); + char enterChar (final char[] validChars, final String message); /** * Asks the user to enter his/her gender (M=Male, F=Female, C=Company) @@ -112,7 +112,7 @@ public interface AddressbookClient extends Client { *

* @return Gender enum */ - public Gender enterGender (final String message); + Gender enterGender (final String message); /** * Reads an integer (int) from the user @@ -123,7 +123,7 @@ public interface AddressbookClient extends Client { *

* @return Entered string by user or null if empty string is allowed */ - public int enterInt (final int minimum, final int maximum, final String message); + int enterInt (final int minimum, final int maximum, final String message); /** * Reads a string of minimum and maximum length from the user. An empty @@ -137,14 +137,14 @@ public interface AddressbookClient extends Client { *

* @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); + String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty); /** * Setter for current menu choice *

* @param currentMenu Current menu choice */ - public void setCurrentMenu (final String currentMenu); + void setCurrentMenu (final String currentMenu); /** * Some "Getter" for menu item @@ -154,19 +154,19 @@ public interface AddressbookClient extends Client { *

* @return */ - public SelectableMenuItem getMenuItem (final char accessKey, final String text); + SelectableMenuItem getMenuItem (final char accessKey, final String text); /** * Shows current menu selection to the user */ - public void showCurrentMenu (); + void showCurrentMenu (); /** * Shows given menu entry in client *

* @param item Menu item to show */ - public void showEntry (final SelectableMenuItem item); + void showEntry (final SelectableMenuItem item); /** * Let the user choose what to change on the address: [n]ame, [a]ddress, @@ -176,5 +176,5 @@ public interface AddressbookClient extends Client { *

* @throws UnhandledUserChoiceException If choice is not supported */ - public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException; + 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 3dced1b..0091974 100644 --- a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java +++ b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java @@ -18,6 +18,7 @@ package org.mxchange.addressbook.client; import java.sql.SQLException; import java.text.MessageFormat; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.naming.Context; @@ -79,12 +80,12 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres *

* @return the currentMenu */ - public final String getCurrentMenu () { + public String getCurrentMenu () { return this.currentMenu; } @Override - public final void setCurrentMenu (final String currentMenu) { + public void setCurrentMenu (final String currentMenu) { this.currentMenu = currentMenu; } @@ -141,8 +142,8 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres *

* @return Map of all menus */ - protected final Map getMenus () { - return this.menus; + protected Map getMenus () { + return Collections.unmodifiableMap(this.menus); } /** diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index 686f192..dd98ba2 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -643,7 +643,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } @Override - protected final void fillMenuMap () { + protected void fillMenuMap () { // Trace message this.getLogger().logTrace("CALLED!"); //NOI18N diff --git a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index c1c0346..9a46532 100644 --- a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -78,7 +78,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra *

* @return Returns a singelton instance of this frame */ - public static final ClientFrame getSelfInstance (final Client client) { + public static ClientFrame getSelfInstance (final Client client) { // Is it set? if (!(self instanceof ClientFrame)) { // Create new instance @@ -294,7 +294,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra * @return Field isInitialized */ @Override - public final boolean isInitialized () { + public boolean isInitialized () { return this.initialized; } @@ -507,16 +507,16 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra // Init 3 panels: // 1) "name" panel - initNameDataPanel(this.addContact); + this.initNameDataPanel(this.addContact); // 2) "address" panel - initAddressDataPanel(this.addContact); + this.initAddressDataPanel(this.addContact); // 3) "other" panel - initOtherDataPanel(this.addContact); + this.initOtherDataPanel(this.addContact); // 4) "Add" and "Cancel" buttons, combined they are unique for this dialog - initAddCancelButtons(); + this.initAddCancelButtons(); // x)Only for developing: /* @@ -858,7 +858,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra // Init other windows: // 1) Add contact - initAddContactDialog(); + this.initAddContactDialog(); // Trace message this.getLogger().logTrace("EXIT!"); //NOI18N diff --git a/src/org/mxchange/addressbook/client/gui/SwingClient.java b/src/org/mxchange/addressbook/client/gui/SwingClient.java index 82cf84e..a4b6e41 100644 --- a/src/org/mxchange/addressbook/client/gui/SwingClient.java +++ b/src/org/mxchange/addressbook/client/gui/SwingClient.java @@ -233,7 +233,7 @@ public class SwingClient extends BaseAddressbookClient implements AddressbookCli * Fills menu map with swing menus */ @Override - protected final void fillMenuMap () { + protected void fillMenuMap () { // Nothing to fill here as the Swing frame is handling this all throw new UnsupportedOperationException("Not implemented."); //NOI18N } diff --git a/src/org/mxchange/addressbook/facade/contact/ContactFacade.java b/src/org/mxchange/addressbook/facade/contact/ContactFacade.java index 1e93bf4..5879608 100644 --- a/src/org/mxchange/addressbook/facade/contact/ContactFacade.java +++ b/src/org/mxchange/addressbook/facade/contact/ContactFacade.java @@ -41,12 +41,12 @@ public interface ContactFacade extends Facade { * @throws org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException If * the contact is already added */ - public void addContact (final Contact contact) throws ContactAlreadyAddedException; + void addContact (final Contact contact) throws ContactAlreadyAddedException; /** * Let the user add a new other address */ - public void doAddOtherAddress (); + void doAddOtherAddress (); /** * The user can change address data, like street, ZIP code, city and country @@ -54,7 +54,7 @@ public interface ContactFacade extends Facade { *

* @param contact Instance to change data */ - public void doChangeAddressData (final Contact contact); + void doChangeAddressData (final Contact contact); /** * The user can change name data, like gender, surname, family name and @@ -62,147 +62,146 @@ public interface ContactFacade extends Facade { *

* @param contact Instance to change data */ - public void doChangeNameData (final Contact contact); + void doChangeNameData (final Contact contact); /** * Let the user change other address */ - public void doChangeOtherAddress (); + void doChangeOtherAddress (); /** * The user can change other data, like phone numbers or comments. *

* @param contact Instance to change data */ - public void doChangeOtherData (final Contact contact); + void doChangeOtherData (final Contact contact); /** * Let the user change own data *

*/ - public void doChangeOwnData (); + void doChangeOwnData (); /** * Let the user delete other address */ - public void doDeleteOtherAddress (); + void doDeleteOtherAddress (); /** * Asks user for own data *

* @throws org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException If * own contact is already added - * @throws java.io.IOException If an IO error was found */ - public void doEnterOwnData () throws ContactAlreadyAddedException; + void doEnterOwnData () throws ContactAlreadyAddedException; /** * List all contacts */ - public void doListContacts (); + void doListContacts (); /** * Searches address book for a contact */ - public void doSearchContacts (); + void doSearchContacts (); /** * Allows the user to enter own cellphone number. *

* @return Cellphone number */ - public DialableCellphoneNumber enterOwnCellNumber (); + DialableCellphoneNumber enterOwnCellNumber (); /** * Allows the user to enter own city name. *

* @return City name */ - public String enterOwnCity (); + String enterOwnCity (); /** * Allows the user to enter comment for own entry. *

* @return Comment */ - public String enterOwnComment (); + String enterOwnComment (); /** * Allows the user to enter own company name. *

* @return Company name */ - public String enterOwnCompanyName (); + String enterOwnCompanyName (); /** * Allows the user to enter own country code. *

* @return Country code */ - public Country enterOwnCountryCode (); + Country enterOwnCountryCode (); /** * Allows the user to enter own email address. *

* @return Email address */ - public String enterOwnEmailAddress (); + String enterOwnEmailAddress (); /** * Allows the user to enter own family name. *

* @return Family name */ - public String enterOwnFamilyName (); + String enterOwnFamilyName (); /** * Allows the user to enter own fax number. *

* @return Fax number */ - public DialableFaxNumber enterOwnFaxNumber (); + DialableFaxNumber enterOwnFaxNumber (); /** * Allows the user to enter own surname. *

* @return Surname */ - public String enterOwnFirstName (); + String enterOwnFirstName (); /** * Allows the user to enter own gender. *

* @return Gender */ - public Gender enterOwnGender (); + Gender enterOwnGender (); /** * Allows the user to enter own phone number. *

* @return Phone number */ - public DialableLandLineNumber enterOwnPhoneNumber (); + DialableLandLineNumber enterOwnPhoneNumber (); /** * Allows the user to enter own street and house number. *

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

* @return ZIP code */ - public int enterOwnZipCode (); + int enterOwnZipCode (); /** * Getter for column count *

* @return Column count TODO: This is needed for TableModel in Swing */ - public int getColumnCount (); + int getColumnCount (); /** * Getter for column name at given index. @@ -211,7 +210,7 @@ public interface ContactFacade extends Facade { *

* @return Database column name TODO: This is needed for TableModel in Swing */ - public String getColumnName (final int columnIndex); + String getColumnName (final int columnIndex); /** * Getter for translated column name at given index. @@ -221,7 +220,7 @@ public interface ContactFacade extends Facade { * @return Human-readable column name TODO: This is needed for TableModel in * Swing */ - public String getTranslatedColumnName (final int columnIndex); + String getTranslatedColumnName (final int columnIndex); /** * Somewhat "getter" for value from given row and column index @@ -231,7 +230,7 @@ public interface ContactFacade extends Facade { *

* @return Value from given row/column */ - public Object getValueFromRowColumn (final int rowIndex, final int columnIndex); + Object getValueFromRowColumn (final int rowIndex, final int columnIndex); /** * Checks whether own contact is already added by checking all entries for @@ -241,12 +240,12 @@ public interface ContactFacade extends Facade { *

* @throws java.io.IOException If an IO error occurs */ - public boolean isOwnContactAdded () throws IOException; + boolean isOwnContactAdded () throws IOException; /** * Adds given contact to address book *

* @param contact Contact being added TODO Add check for book size */ - public void registerContact (final Contact contact); + void registerContact (final Contact contact); } diff --git a/src/org/mxchange/addressbook/menu/BaseMenu.java b/src/org/mxchange/addressbook/menu/BaseMenu.java index cf5b916..1d9dfcc 100644 --- a/src/org/mxchange/addressbook/menu/BaseMenu.java +++ b/src/org/mxchange/addressbook/menu/BaseMenu.java @@ -18,6 +18,7 @@ package org.mxchange.addressbook.menu; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import org.mxchange.addressbook.BaseAddressbookSystem; @@ -87,8 +88,8 @@ public abstract class BaseMenu extends BaseAddressbookSystem implements Menu { *

* @return menuList List of menu entries */ - protected final List getMenuList () { - return this.menuList; + protected List getMenuList () { + return Collections.unmodifiableList(this.menuList); } /** diff --git a/src/org/mxchange/addressbook/menu/Menu.java b/src/org/mxchange/addressbook/menu/Menu.java index a0ba62f..f605563 100644 --- a/src/org/mxchange/addressbook/menu/Menu.java +++ b/src/org/mxchange/addressbook/menu/Menu.java @@ -32,19 +32,19 @@ public interface Menu { *

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

* @return Iterator on all menu items */ - public Iterator getMenuItemsIterator (); + Iterator getMenuItemsIterator (); /** * Shows this menu *

* @param client Client instance */ - public void show (final Client client); + void show (final Client client); } diff --git a/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java b/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java index 59758f8..5f81076 100644 --- a/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java +++ b/src/org/mxchange/addressbook/menu/item/SelectableMenuItem.java @@ -31,19 +31,19 @@ public interface SelectableMenuItem extends FrameworkInterface { *

* @return the accessKey */ - public char getAccessKey (); + char getAccessKey (); /** * Text to user *

* @return the text */ - public String getText (); + String getText (); /** * Shows this menu item *

* @param client Client instance */ - public void show (final Client client); + 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 74f8180..339623d 100644 --- a/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java +++ b/src/org/mxchange/addressbook/menu/item/console/ConsoleMenuItem.java @@ -51,15 +51,33 @@ public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem } @Override - public final char getAccessKey () { + public char getAccessKey () { return this.accessKey; } + /** + * Access key + *

+ * @param accessKey the accessKey to set + */ + private void setAccessKey (final char accessKey) { + this.accessKey = accessKey; + } + @Override public String getText () { return this.text; } + /** + * Text to user + *

+ * @param text the text to set + */ + private void setText (final String text) { + this.text = text; + } + @Override public void show (final Client client) { // Trace message @@ -84,22 +102,4 @@ 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; - } - }