]> git.mxchange.org Git - jaddressbook-share-lib.git/commitdiff
Renamed interface ...
authorRoland Haeder <roland@mxchange.org>
Fri, 4 Sep 2015 20:22:26 +0000 (22:22 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 4 Sep 2015 20:23:27 +0000 (22:23 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/addressbook/client/BaseAddressbookClient.java
src/org/mxchange/addressbook/client/console/ConsoleClient.java
src/org/mxchange/addressbook/client/gui/AddressbookFrame.java
src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java
src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java [deleted file]
src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java [new file with mode: 0644]

index 8f0dc1aae6374bae4484b98b46cc7718980b52b7..a21dbec05a251aa5bb7f87f86c3e13f66b480e36 100644 (file)
@@ -21,7 +21,7 @@ import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
 import org.mxchange.addressbook.manager.contact.AddressbookContactManager;
-import org.mxchange.addressbook.manager.contact.ManageableAddressbookContact;
+import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.jcore.client.BaseClient;
 import org.mxchange.jcore.client.Client;
@@ -114,7 +114,7 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
 
                // Init contact manager with console client
                // TODO Static initial amount of contacts
-               ManageableAddressbookContact manager = new AddressbookContactManager((Client) this);
+               ManageableContactAddressbook manager = new AddressbookContactManager((Client) this);
 
                // Set it here
                this.setManager(manager);
index 0df415eef9200334410634006533d27895ba0b56..082e49b9f3c04e00c59f9080c30f38be3fc77c20 100644 (file)
@@ -26,7 +26,7 @@ import org.mxchange.addressbook.application.AddressbookApplication;
 import org.mxchange.addressbook.client.AddressbookClient;
 import org.mxchange.addressbook.client.BaseAddressbookClient;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
-import org.mxchange.addressbook.manager.contact.ManageableAddressbookContact;
+import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook;
 import org.mxchange.addressbook.menu.Menu;
 import org.mxchange.addressbook.menu.MenuTools;
 import org.mxchange.addressbook.menu.console.ConsoleMenu;
@@ -169,7 +169,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                }
 
                // Get manager and cast it
-               ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+               ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
 
                // Own street and number
                String streetNumber = manager.enterOwnStreet();
@@ -211,7 +211,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                }
 
                // Get manager and cast it
-               ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+               ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
 
                // Gender:
                Gender gender = manager.enterOwnGender();
@@ -253,7 +253,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                }
 
                // Get manager and cast it
-               ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+               ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
 
                // Phone number
                String phoneNumber = manager.enterOwnPhoneNumber();
@@ -287,7 +287,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                this.getLogger().trace("CALLED!"); //NOI18N
 
                // Get manager and cast it
-               ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+               ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
 
                // First ask for gender
                Gender gender = manager.enterOwnGender();
@@ -340,7 +340,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                char choice = this.enterChar(accessKeys, "Bitte Auswahl eingeben (0=Programm beenden): ");
 
                // Get manager and cast it
-               ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+               ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
 
                // Try it!
                try {
@@ -641,7 +641,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC
                char choice = this.enterChar(new char[] {'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
 
                // Get manager and cast it
-               ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+               ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
 
                // TODO Get rid of this ugly switch block, too
                switch (choice) {
index bd0f4480e4c999c45a85dd5eb499e5c53f1dd118..1d0e3b9a854a662bfcd25a38c4245646879b63a3 100644 (file)
@@ -50,7 +50,7 @@ import javax.swing.table.TableModel;
 import org.mxchange.addressbook.BaseAddressbookSystem;
 import org.mxchange.addressbook.application.AddressbookApplication;
 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
-import org.mxchange.addressbook.manager.contact.ManageableAddressbookContact;
+import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook;
 import org.mxchange.jcore.client.Client;
 import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
 import org.mxchange.jcore.model.contact.Contact;
@@ -215,7 +215,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra
                this.getLogger().trace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
 
                // Has the user entered own data?
-               if (((ManageableAddressbookContact) this.getClient().getManager()).isOwnContactAdded()) {
+               if (((ManageableContactAddressbook) this.getClient().getManager()).isOwnContactAdded()) {
                        // Debug message
                        this.getLogger().debug("Disabling menus: isOwnContactAdded()=false"); //NOI18N
 
@@ -674,7 +674,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra
                        @Override
                        public void actionPerformed (final ActionEvent e) {
                                try {
-                                       ((ManageableAddressbookContact) self.getClient().getManager()).doEnterOwnData();
+                                       ((ManageableContactAddressbook) self.getClient().getManager()).doEnterOwnData();
                                } catch (final ContactAlreadyAddedException ex) {
                                        // Already added, log away
                                        // TODO maybe output message here?
@@ -702,7 +702,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra
                        @Override
                        public void actionPerformed (final ActionEvent e) {
                                try {
-                                       ((ManageableAddressbookContact) self.getClient().getManager()).doChangeOwnData();
+                                       ((ManageableContactAddressbook) self.getClient().getManager()).doChangeOwnData();
                                } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
                                        self.logException(ex);
                                }
@@ -722,7 +722,7 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra
                         */
                        @Override
                        public void actionPerformed (final ActionEvent e) {
-                               ((ManageableAddressbookContact) self.getClient().getManager()).doAddOtherAddress();
+                               ((ManageableContactAddressbook) self.getClient().getManager()).doAddOtherAddress();
                        }
                });
 
index 072ff62dbdc0186cd3a9abb9c4ed5fdcac93fb3c..c7aed6ab601404f43d036a9c5fd3348b3b6b7fb9 100644 (file)
@@ -38,7 +38,7 @@ import org.mxchange.jcore.model.contact.gender.Gender;
  * @author Roland Haeder
  * @version 0.0
  */
-public class AddressbookContactManager extends BaseManager implements ManageableAddressbookContact {
+public class AddressbookContactManager extends BaseManager implements ManageableContactAddressbook {
 
        /**
         * Column name list
diff --git a/src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java b/src/org/mxchange/addressbook/manager/contact/ManageableAddressbookContact.java
deleted file mode 100644 (file)
index 21b3671..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.manager.contact;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
-import org.mxchange.jcore.manager.Manageable;
-import org.mxchange.jcore.model.contact.Contact;
-import org.mxchange.jcore.model.contact.gender.Gender;
-
-/**
- *
- * @author Roland Haeder
- */
-public interface ManageableAddressbookContact extends Manageable {
-       /**
-        * Allows the user to enter own cellphone number.
-        *
-        * @return Cellphone number
-        */
-       public String enterOwnCellNumber ();
-
-       /**
-        * Allows the user to enter own city name.
-        *
-        * @return City name
-        */
-       public String enterOwnCity ();
-
-       /**
-        * Allows the user to enter comment for own entry.
-        *
-        * @return Comment
-        */
-       public String enterOwnComment ();
-
-       /**
-        * Allows the user to enter own company name.
-        *
-        * @return Company name
-        */
-       public String enterOwnCompanyName ();
-
-       /**
-        * Allows the user to enter own country code.
-        *
-        * @return Country code
-        */
-       public String enterOwnCountryCode ();
-
-       /**
-        * Allows the user to enter own email address.
-        *
-        * @return Email address
-        */
-       public String enterOwnEmailAddress ();
-
-       /**
-        * Allows the user to enter own family name.
-        *
-        * @return Family name
-        */
-       public String enterOwnFamilyName ();
-
-       /**
-        * Allows the user to enter own fax number.
-        *
-        * @return Fax number
-        */
-       public String enterOwnFaxNumber ();
-
-       /**
-        * Allows the user to enter own gender.
-        *
-        * @return Gender
-        */
-       public Gender enterOwnGender ();
-
-       /**
-        * Allows the user to enter own phone number.
-        *
-        * @return Phone number
-        */
-       public String enterOwnPhoneNumber ();
-
-       /**
-        * Allows the user to enter own street and house number.
-        *
-        * @return Street and house number
-        */
-       public String enterOwnStreet ();
-
-       /**
-        * Allows the user to enter own surname.
-        *
-        * @return Surname
-        */
-       public String enterOwnFirstName ();
-
-       /**
-        * Allows the user to enter own ZIP code.
-        *
-        * @return ZIP code
-        */
-       public int enterOwnZipCode ();
-
-       /**
-        * List all contacts
-        */
-       public void doListContacts ();
-
-       /**
-        * Adds given contact to address book
-        *
-        * @param contact Contact being added
-        * TODO Add check for book size
-        */
-       public void registerContact (final Contact contact);
-
-       /**
-        * Adds given Contact instance to list
-        *
-        * @param contact Contact instance to add
-        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
-        */
-       public void addContact (final Contact contact) throws ContactAlreadyAddedException;
-
-       /**
-        * Let the user add a new other address
-        */
-       public void doAddOtherAddress ();
-
-       /**
-        * The user can change address data, like street, ZIP code, city and country
-        * of given Contact instance.
-        *
-        * @param contact Instance to change data
-        */
-       public void doChangeAddressData (final Contact contact);
-
-       /**
-        * The user can change name data, like gender, surname, family name and
-        * company name (if business contact).
-        *
-        * @param contact Instance to change data
-        */
-       public void doChangeNameData (final Contact contact);
-
-       /**
-        * Let the user change other address
-        */
-       public 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);
-
-       /**
-        * Let the user change own data
-        * @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 void doChangeOwnData () throws IOException , SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
-
-       /**
-        * Let the user delete other address
-        */
-       public void doDeleteOtherAddress ();
-
-       /**
-        * Asks user for own data
-        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If own contact is already added
-        * @throws java.io.IOException If an IO error was found
-        */
-       public void doEnterOwnData () throws ContactAlreadyAddedException, IOException;
-
-       /**
-        * Searches address book for a contact
-        */
-       public void doSearchContacts ();
-
-       /**
-        * Checks whether own contact is already added by checking all entries for
-        * isOwnContact flag
-        *
-        * @return Whether own contact is already added
-        * @throws java.io.IOException If an IO error occurs
-        */
-       public boolean isOwnContactAdded () throws IOException;
-
-       /**
-        * Getter for translated column name at given index.
-        *
-        * @param columnIndex Column index
-        * @return Human-readable column name
-        * TODO: This is needed for TableModel in Swing
-        */
-       public String getTranslatedColumnName (final int columnIndex);
-
-       /**
-        * Somewhat "getter" for value from given row and column index
-        *
-        * @param rowIndex Row index
-        * @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.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.
-        *
-        * @param columnIndex Column index
-        * @return Database column name
-        * TODO: This is needed for TableModel in Swing
-        */
-       public String getColumnName (final int columnIndex);
-
-       /**
-        * Getter for column count
-        * @return Column count
-        * TODO: This is needed for TableModel in Swing
-        */
-       public int getColumnCount ();
-}
diff --git a/src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java b/src/org/mxchange/addressbook/manager/contact/ManageableContactAddressbook.java
new file mode 100644 (file)
index 0000000..f93c982
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.manager.contact;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.sql.SQLException;
+import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
+import org.mxchange.jcore.manager.Manageable;
+import org.mxchange.jcore.model.contact.Contact;
+import org.mxchange.jcore.model.contact.gender.Gender;
+
+/**
+ * An interface for addressbook contact manager
+ *
+ * @author Roland Haeder
+ */
+public interface ManageableContactAddressbook extends Manageable {
+       /**
+        * Allows the user to enter own cellphone number.
+        *
+        * @return Cellphone number
+        */
+       public String enterOwnCellNumber ();
+
+       /**
+        * Allows the user to enter own city name.
+        *
+        * @return City name
+        */
+       public String enterOwnCity ();
+
+       /**
+        * Allows the user to enter comment for own entry.
+        *
+        * @return Comment
+        */
+       public String enterOwnComment ();
+
+       /**
+        * Allows the user to enter own company name.
+        *
+        * @return Company name
+        */
+       public String enterOwnCompanyName ();
+
+       /**
+        * Allows the user to enter own country code.
+        *
+        * @return Country code
+        */
+       public String enterOwnCountryCode ();
+
+       /**
+        * Allows the user to enter own email address.
+        *
+        * @return Email address
+        */
+       public String enterOwnEmailAddress ();
+
+       /**
+        * Allows the user to enter own family name.
+        *
+        * @return Family name
+        */
+       public String enterOwnFamilyName ();
+
+       /**
+        * Allows the user to enter own fax number.
+        *
+        * @return Fax number
+        */
+       public String enterOwnFaxNumber ();
+
+       /**
+        * Allows the user to enter own gender.
+        *
+        * @return Gender
+        */
+       public Gender enterOwnGender ();
+
+       /**
+        * Allows the user to enter own phone number.
+        *
+        * @return Phone number
+        */
+       public String enterOwnPhoneNumber ();
+
+       /**
+        * Allows the user to enter own street and house number.
+        *
+        * @return Street and house number
+        */
+       public String enterOwnStreet ();
+
+       /**
+        * Allows the user to enter own surname.
+        *
+        * @return Surname
+        */
+       public String enterOwnFirstName ();
+
+       /**
+        * Allows the user to enter own ZIP code.
+        *
+        * @return ZIP code
+        */
+       public int enterOwnZipCode ();
+
+       /**
+        * List all contacts
+        */
+       public void doListContacts ();
+
+       /**
+        * Adds given contact to address book
+        *
+        * @param contact Contact being added
+        * TODO Add check for book size
+        */
+       public void registerContact (final Contact contact);
+
+       /**
+        * Adds given Contact instance to list
+        *
+        * @param contact Contact instance to add
+        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
+        */
+       public void addContact (final Contact contact) throws ContactAlreadyAddedException;
+
+       /**
+        * Let the user add a new other address
+        */
+       public void doAddOtherAddress ();
+
+       /**
+        * The user can change address data, like street, ZIP code, city and country
+        * of given Contact instance.
+        *
+        * @param contact Instance to change data
+        */
+       public void doChangeAddressData (final Contact contact);
+
+       /**
+        * The user can change name data, like gender, surname, family name and
+        * company name (if business contact).
+        *
+        * @param contact Instance to change data
+        */
+       public void doChangeNameData (final Contact contact);
+
+       /**
+        * Let the user change other address
+        */
+       public 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);
+
+       /**
+        * Let the user change own data
+        * @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 void doChangeOwnData () throws IOException , SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+       /**
+        * Let the user delete other address
+        */
+       public void doDeleteOtherAddress ();
+
+       /**
+        * Asks user for own data
+        * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If own contact is already added
+        * @throws java.io.IOException If an IO error was found
+        */
+       public void doEnterOwnData () throws ContactAlreadyAddedException, IOException;
+
+       /**
+        * Searches address book for a contact
+        */
+       public void doSearchContacts ();
+
+       /**
+        * Checks whether own contact is already added by checking all entries for
+        * isOwnContact flag
+        *
+        * @return Whether own contact is already added
+        * @throws java.io.IOException If an IO error occurs
+        */
+       public boolean isOwnContactAdded () throws IOException;
+
+       /**
+        * Getter for translated column name at given index.
+        *
+        * @param columnIndex Column index
+        * @return Human-readable column name
+        * TODO: This is needed for TableModel in Swing
+        */
+       public String getTranslatedColumnName (final int columnIndex);
+
+       /**
+        * Somewhat "getter" for value from given row and column index
+        *
+        * @param rowIndex Row index
+        * @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.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.
+        *
+        * @param columnIndex Column index
+        * @return Database column name
+        * TODO: This is needed for TableModel in Swing
+        */
+       public String getColumnName (final int columnIndex);
+
+       /**
+        * Getter for column count
+        * @return Column count
+        * TODO: This is needed for TableModel in Swing
+        */
+       public int getColumnCount ();
+}