From: Roland Häder Date: Sat, 10 Jun 2017 19:09:30 +0000 (+0200) Subject: using gender for Mr./Mrs. is plain wrong, now "personal title" and "academic X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=661769cbcf33fec999e31cc360fd172c96d645f1;p=addressbook-swing.git using gender for Mr./Mrs. is plain wrong, now "personal title" and "academic title" are being used. Signed-off-by: Roland Häder --- diff --git a/docs/VERSIONS.txt b/docs/VERSIONS.txt index 9d25667..760221d 100644 --- a/docs/VERSIONS.txt +++ b/docs/VERSIONS.txt @@ -7,7 +7,7 @@ Inernet("public" service) and Intranet Version 1.0+: - Single-user local application - Fields: - + Gender + + Personal title + Surname + Family name + Company name diff --git a/docs/mindmaps/Addressbook Application.mm b/docs/mindmaps/Addressbook Application.mm index 42981fa..7a543c7 100644 --- a/docs/mindmaps/Addressbook Application.mm +++ b/docs/mindmaps/Addressbook Application.mm @@ -169,7 +169,7 @@ - + @@ -223,11 +223,11 @@ - + - + @@ -438,7 +438,7 @@ - + diff --git a/src/org/mxchange/addressbook/application/AddressbookApplication.java b/src/org/mxchange/addressbook/application/AddressbookApplication.java index ca1ab32..84e3fbf 100644 --- a/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -249,7 +249,7 @@ public class AddressbookApplication extends BaseApplication implements Applicati // Is the bundle initialized? if (!isBundledInitialized()) { // Temporary initialize default bundle - // TODO The enum Gender uses this + // TODO The enum PersonalTitle uses this this.initBundle(); } } diff --git a/src/org/mxchange/addressbook/client/AddressbookClient.java b/src/org/mxchange/addressbook/client/AddressbookClient.java index 57dbc65..5136aab 100644 --- a/src/org/mxchange/addressbook/client/AddressbookClient.java +++ b/src/org/mxchange/addressbook/client/AddressbookClient.java @@ -18,7 +18,7 @@ package org.mxchange.addressbook.client; import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.gender.Gender; +import org.mxchange.jcontacts.contact.title.PersonalTitle; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.exceptions.MenuInitializationException; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; @@ -106,13 +106,13 @@ public interface AddressbookClient extends Client { char enterChar (final char[] validChars, final String message); /** - * Asks the user to enter his/her gender (M=Male, F=Female, C=Company) + * Asks the user to enter his/her personal title (M=Male, F=Female, C=Company) *

* @param message Message to output *

- * @return Gender enum + * @return PersonalTitle enum */ - Gender enterGender (final String message); + PersonalTitle enterPersonalTitle (final String message); /** * Reads an integer (int) from the user diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index 935a347..a5f59d6 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -32,8 +32,8 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.addressbook.menu.item.console.ConsoleMenuItem; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcontacts.contact.gender.Gender; -import org.mxchange.jcontacts.contact.gender.GenderUtils; +import org.mxchange.jcontacts.contact.title.PersonalTitle; +import org.mxchange.jcontacts.contact.title.PersonalTitleUtils; import org.mxchange.jcontactsbusiness.exceptions.BusinessContactAlreadyAddedException; import org.mxchange.jcore.application.Application; import org.mxchange.jcore.exceptions.MenuInitializationException; @@ -103,11 +103,11 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC throw new NullPointerException("contact is null"); //NOI18N } - // Get translated gender as the user may want to see "Mr.", "Mrs." - String gender = GenderUtils.getTranslatedGender(contact); + // Get translated title as the user may want to see "Mr.", "Mrs." + String title = PersonalTitleUtils.getTranslatedPersonalTitle(contact); - // Now put all together: gender, surname, family name - this.outputMessage(MessageFormat.format("Anrede, Vorname, Name: {0} {1} {2}", gender, contact.getContactFirstName(), contact.getContactFamilyName())); + // Now put all together: title, surname, family name + this.outputMessage(MessageFormat.format("Anrede, Vorname, Name: {0} {1} {2}", title, contact.getContactFirstName(), contact.getContactFamilyName())); // Trace message this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N @@ -193,8 +193,8 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC // Get manager and cast it ContactFacade manager = (ContactFacade) this.getFacade(); - // Gender: - Gender gender = manager.enterOwnGender(); + // PersonalTitle: + PersonalTitle title = manager.enterOwnPersonalTitle(); // Surname String firstName = manager.enterOwnFirstName(); @@ -203,7 +203,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC String familyName = manager.enterOwnFamilyName(); // Update contact instance - contact.setContactGender(gender); + contact.setContactPersonalTitle(title); contact.setContactFirstName(firstName); contact.setContactFamilyName(familyName); @@ -265,8 +265,8 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC // Get manager and cast it ContactFacade manager = (ContactFacade) this.getFacade(); - // First ask for gender - Gender gender = manager.enterOwnGender(); + // First ask for title + PersonalTitle title = manager.enterOwnPersonalTitle(); // 2nd for first name String firstName = manager.enterOwnFirstName(); @@ -275,7 +275,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC String familyName = manager.enterOwnFamilyName(); // Construct UserContact instance - Contact contact = new UserContact(gender, firstName, familyName); + Contact contact = new UserContact(title, firstName, familyName); // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N @@ -402,23 +402,23 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } @Override - public Gender enterGender (final String message) { + public PersonalTitle enterPersonalTitle (final String message) { // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("message={0} - CALLED!", message)); //NOI18N // Get valid chars - char[] validChars = Gender.validChars(); + char[] validChars = PersonalTitle.validChars(); // Debug message //* NOISY-DEBUG: */ System.out.println(validChars); // Call inner method - char gender = this.enterChar(validChars, message); + char title = this.enterChar(validChars, message); - // Now get a Gender instance back - Gender g = Gender.fromChar(gender); + // Now get a PersonalTitle instance back + PersonalTitle g = PersonalTitle.fromChar(title); // g must not be null - assert (g instanceof Gender) : "g is not set."; //NOI18N + assert (g instanceof PersonalTitle) : "g is not set."; //NOI18N // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("g={0} - EXIT!", g)); //NOI18N diff --git a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 975c032..aab109f 100644 --- a/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -50,7 +50,7 @@ import org.mxchange.addressbook.BaseAddressbookSystem; import org.mxchange.addressbook.application.AddressbookApplication; import org.mxchange.addressbook.facade.contact.ContactFacade; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.gender.Gender; +import org.mxchange.jcontacts.contact.title.PersonalTitle; import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; import org.mxchange.jcore.application.Application; import org.mxchange.jcore.client.Client; @@ -777,19 +777,19 @@ public class AddressbookFrame extends BaseAddressbookSystem implements ClientFra // Set border to titled version namePanel.setBorder(new TitledBorder(this.generateBorderTitle("name"))); //NOI18N - // Gender text field - JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.gender.text")); + // PersonalTitle text field + JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.title.text")); - // Get all genders - Gender[] genders = Gender.values(); + // Get all titles + PersonalTitle[] titles = PersonalTitle.values(); - // Init gender combo box with tool tip - JComboBox gender = new JComboBox<>(new DefaultComboBoxModel<>(genders)); - gender.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.toolTipText")); + // Init title combo box with tool tip + JComboBox title = new JComboBox<>(new DefaultComboBoxModel<>(titles)); + title.setToolTipText(this.getBundle().getString("AddressbookFrame.title.toolTipText")); - // Add both to gender panel + // Add both to title panel namePanel.add(gLabel); - namePanel.add(gender); + namePanel.add(title); // Add text field for surname this.addTextFieldWithLabelToPanel(namePanel, "surname", 20); //NOI18N diff --git a/src/org/mxchange/addressbook/client/gui/SwingClient.java b/src/org/mxchange/addressbook/client/gui/SwingClient.java index 926382d..0582aa8 100644 --- a/src/org/mxchange/addressbook/client/gui/SwingClient.java +++ b/src/org/mxchange/addressbook/client/gui/SwingClient.java @@ -22,7 +22,7 @@ import org.mxchange.addressbook.client.AddressbookClient; import org.mxchange.addressbook.client.BaseAddressbookClient; import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.gender.Gender; +import org.mxchange.jcontacts.contact.title.PersonalTitle; import org.mxchange.jcore.application.Application; import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; @@ -136,7 +136,7 @@ public class SwingClient extends BaseAddressbookClient implements AddressbookCli } @Override - public Gender enterGender (final String message) { + public PersonalTitle enterPersonalTitle (final String message) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N } diff --git a/src/org/mxchange/addressbook/facade/contact/AddressbookContactFacade.java b/src/org/mxchange/addressbook/facade/contact/AddressbookContactFacade.java index 01f8be0..74d3653 100644 --- a/src/org/mxchange/addressbook/facade/contact/AddressbookContactFacade.java +++ b/src/org/mxchange/addressbook/facade/contact/AddressbookContactFacade.java @@ -25,7 +25,7 @@ import java.util.Iterator; import java.util.List; import org.mxchange.addressbook.client.AddressbookClient; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.gender.Gender; +import org.mxchange.jcontacts.contact.title.PersonalTitle; import org.mxchange.jcontactsbusiness.exceptions.BusinessContactAlreadyAddedException; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; @@ -409,14 +409,14 @@ public class AddressbookContactFacade extends BaseFacade implements ContactFacad } @Override - public Gender enterOwnGender () { + public PersonalTitle enterOwnPersonalTitle () { // Trace message this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N // Get and cast client instance AddressbookClient client = (AddressbookClient) this.getClient(); - return client.enterGender("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): "); + return client.enterPersonalTitle("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): "); } @Override diff --git a/src/org/mxchange/addressbook/facade/contact/ContactFacade.java b/src/org/mxchange/addressbook/facade/contact/ContactFacade.java index 290ebfc..894bfc2 100644 --- a/src/org/mxchange/addressbook/facade/contact/ContactFacade.java +++ b/src/org/mxchange/addressbook/facade/contact/ContactFacade.java @@ -18,7 +18,7 @@ package org.mxchange.addressbook.facade.contact; import java.io.IOException; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.gender.Gender; +import org.mxchange.jcontacts.contact.title.PersonalTitle; import org.mxchange.jcontactsbusiness.exceptions.BusinessContactAlreadyAddedException; import org.mxchange.jcore.facade.Facade; import org.mxchange.jcountry.data.Country; @@ -57,7 +57,7 @@ public interface ContactFacade extends Facade { void doChangeAddressData (final Contact contact); /** - * The user can change name data, like gender, surname, family name and + * The user can change name data, like title, surname, family name and * company name (if business contact). *

* @param contact Instance to change data @@ -169,11 +169,11 @@ public interface ContactFacade extends Facade { String enterOwnFirstName (); /** - * Allows the user to enter own gender. + * Allows the user to enter own title. *

- * @return Gender + * @return PersonalTitle */ - Gender enterOwnGender (); + PersonalTitle enterOwnPersonalTitle (); /** * Allows the user to enter own phone number. diff --git a/src/org/mxchange/localization/bundle_de_DE.properties b/src/org/mxchange/localization/bundle_de_DE.properties index bc2ec9c..cc12ea1 100644 --- a/src/org/mxchange/localization/bundle_de_DE.properties +++ b/src/org/mxchange/localization/bundle_de_DE.properties @@ -32,8 +32,8 @@ AddressbookFrame.menuItem.addNewContact.text=Neue Adresse hinzuf\u00fcgen AddressbookFrame.menuItem.addNewContact.toolTipText=Eine neue Adresse hinzuf\u00fcgen. AddressbookFrame.dialog.addContact.title.text=Neue Adresse hinzuf\u00fcgen AddressbookFrame.main.title.text=Adressen auflisten -AddressbookFrame.gender.text=Anrede: -AddressbookFrame.gender.toolTipText=W\u00e4hlen Sie die Anrede aus. +AddressbookFrame.title.text=Anrede: +AddressbookFrame.title.toolTipText=W\u00e4hlen Sie die Anrede aus. AddressbookFrame.surname.text=Vorname: AddressbookFrame.surname.toolTipText=Geben Sie den Vornamen ein. AddressbookFrame.familyName.text=Nachname: @@ -56,10 +56,9 @@ AddressbookFrame.faxNumber.text=Fax: AddressbookFrame.faxNumber.toolTipText=Geben Sie die Faxnummer ein. AddressbookFrame.comment.text=Anmerkungen: AddressbookFrame.comment.toolTipText=Geben Sie eine Anmerkung (Freifeld) ein. -GENDER_MALE=Herr -GENDER_FEMALE=Frau -GENDER_COMPANY=Firma -ContactManager.columnName.gender.text=Anrede +PERSONAL_TITLE_MR=Herr +PERSONAL_TITLE_MRS=Frau +ContactManager.columnName.title.text=Anrede ContactManager.columnName.surname.text=Vorname ContactManager.columnName.familyName.text=Nachname ContactManager.columnName.street.text=Strasse diff --git a/src/org/mxchange/localization/bundle_en_US.properties b/src/org/mxchange/localization/bundle_en_US.properties index a5d3e0f..3c11200 100644 --- a/src/org/mxchange/localization/bundle_en_US.properties +++ b/src/org/mxchange/localization/bundle_en_US.properties @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -AddressbookFrame.border.name.title.text=Gender, surname, family name: +AddressbookFrame.border.name.title.text=Title, surname, family name: AddressbookFrame.border.address.title.text=Address: AddressbookFrame.border.other.title.text=Other data: AddressbookFrame.button.addAddress.text=Add address @@ -32,8 +32,8 @@ AddressbookFrame.menuItem.addNewContact.text=Add new address AddressbookFrame.menuItem.addNewContact.toolTipText=Add a new address. AddressbookFrame.dialog.addContact.title.text=Add new address AddressbookFrame.main.title.text=List addresses -AddressbookFrame.gender.text=Gender: -AddressbookFrame.gender.toolTipText=Choose gender. +AddressbookFrame.title.text=Title: +AddressbookFrame.title.toolTipText=Choose title. AddressbookFrame.surname.text=Surname: AddressbookFrame.surname.toolTipText=Enter surname. AddressbookFrame.familyName.text=Family name: @@ -56,10 +56,9 @@ AddressbookFrame.faxNumber.text=Fax: AddressbookFrame.faxNumber.toolTipText=Enter fax number. AddressbookFrame.comment.text=Note: AddressbookFrame.comment.toolTipText=Enter a note (free field). -GENDER_MALE=Mr. -GENDER_FEMALE=Mrs. -GENDER_COMPANY=Company -ContactManager.columnName.gender.text=Gender +PERSONAL_TITLE_MR=Mr. +PERSONAL_TITLE_MRS=Mrs. +ContactManager.columnName.title.text=Title ContactManager.columnName.surname.text=Surname ContactManager.columnName.familyName.text=Family name ContactManager.columnName.street.text=Street