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;
// 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);
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;
}
// Get manager and cast it
- ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+ ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
// Own street and number
String streetNumber = manager.enterOwnStreet();
}
// Get manager and cast it
- ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+ ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
// Gender:
Gender gender = manager.enterOwnGender();
}
// Get manager and cast it
- ManageableAddressbookContact manager = (ManageableAddressbookContact) this.getManager();
+ ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
// Phone number
String phoneNumber = manager.enterOwnPhoneNumber();
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();
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 {
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) {
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;
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
@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?
@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);
}
*/
@Override
public void actionPerformed (final ActionEvent e) {
- ((ManageableAddressbookContact) self.getClient().getManager()).doAddOtherAddress();
+ ((ManageableContactAddressbook) self.getClient().getManager()).doAddOtherAddress();
}
});
* @author Roland Haeder
* @version 0.0
*/
-public class AddressbookContactManager extends BaseManager implements ManageableAddressbookContact {
+public class AddressbookContactManager extends BaseManager implements ManageableContactAddressbook {
/**
* Column name list
+++ /dev/null
-/*
- * 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 ();
-}
--- /dev/null
+/*
+ * 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 ();
+}