From: Roland Haeder Date: Fri, 24 Jul 2015 10:41:00 +0000 (+0200) Subject: Implemented getColumnName() + added it to ContactManager as this class holds the... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d73c2b92d68de84a73be4b65203de5a301fe7795;p=jfinancials-lib.git Implemented getColumnName() + added it to ContactManager as this class holds the column names + added some for testing Signed-off-by:Roland Häder --- diff --git a/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties b/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties index e6907ee..1239e97 100644 --- a/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties +++ b/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties @@ -24,3 +24,10 @@ AddressbookFrame.menuItem.addOwnData.text=Eigene Adresse hinzuf\u00fcgen AddressbookFrame.menuItem.addOwnData.toolTipText=Erlaubt das Hinzuf\u00fcgen eigener Daten. AddressbookFrame.menuItem.editOwnData.text=Eigene Adresse \u00e4ndern AddressbookFrame.menuItem.editOwnData.toolTipText=Erlaubt das \u00c4ndern eigener Daten. +ContactManager.columnName.gender.text=Anrede +ContactManager.columnName.surname.text=Vorname +ContactManager.columnName.familyName.text=Nachname +ContactManager.columnName.street.text=Strasse +ContactManager.columnName.houseNumber.text=Hausnummer +ContactManager.columnName.zipCode.text=Postleitzahl +ContactManager.columnName.city.text=Stadt diff --git a/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties b/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties index c929532..e8c1bf4 100644 --- a/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties +++ b/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties @@ -24,3 +24,10 @@ AddressbookFrame.menuItem.addOwnData.text=Add own address AddressbookFrame.menuItem.addOwnData.toolTipText=Allows the user to add own address data AddressbookFrame.menuItem.editOwnData.text=Edit own data AddressbookFrame.menuItem.editOwnData.toolTipText=Allows the user to edit own address data +ContactManager.columnName.gender.text=Gender +ContactManager.columnName.surname.text=Surname +ContactManager.columnName.familyName.text=Family name +ContactManager.columnName.street.text=Street +ContactManager.columnName.houseNumber.text=House number +ContactManager.columnName.zipCode.text=ZIP code +ContactManager.columnName.city.text=City diff --git a/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java b/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java index e950e42..c958c1d 100644 --- a/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java +++ b/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java @@ -485,7 +485,7 @@ public class ContactManager extends BaseManager implements ManageableContact { String key = iterator.next(); // Does the key start with ContactManager.columnName ? - if (key.startsWith("ContactM,anager.columnName")) { + if (key.startsWith("ContactManager.columnName")) { // This is the wanted entry. this.getLogger().debug(MessageFormat.format("key={0}", key)); @@ -498,6 +498,18 @@ public class ContactManager extends BaseManager implements ManageableContact { this.getLogger().trace(MessageFormat.format("getColumnCount()={0}: EXIT!", this.getColumnCount())); } + /** + * Getter for column name at given index. + * + * @param columnIndex Column index + * @return Human-readable column name + */ + @Override + public String getColumnName (final int columnIndex) { + // Get column name at index + return this.columnNames.get(columnIndex); + } + /** * Flushes all entries by calling database backend */ diff --git a/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java b/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java index 6914a26..928df17 100644 --- a/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java +++ b/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java @@ -135,6 +135,14 @@ public interface ManageableContact extends Manageable { */ public void doListContacts (); + /** + * Getter for column name at given index. + * + * @param columnIndex Column index + * @return Human-readable column name + */ + public String getColumnName (final int columnIndex); + /** * Adds given contact to address book * diff --git a/Addressbook/src/org/mxchange/addressbook/model/address/AddressTableModel.java b/Addressbook/src/org/mxchange/addressbook/model/address/AddressTableModel.java index c3fcbc6..0041637 100644 --- a/Addressbook/src/org/mxchange/addressbook/model/address/AddressTableModel.java +++ b/Addressbook/src/org/mxchange/addressbook/model/address/AddressTableModel.java @@ -46,17 +46,19 @@ public class AddressTableModel extends BaseModel implements TableModel { @Override public int getColumnCount () { - // Deligate this call to the contact manager + // Deligate this call to contact manager return this.getClient().getContactManager().getColumnCount(); } @Override public String getColumnName (final int columnIndex) { - throw new UnsupportedOperationException("Not supported yet. columnIndex=" + columnIndex); //To change body of generated methods, choose Tools | Templates. + // Deligate this call to contact manager + return this.getClient().getContactManager().getColumnName(columnIndex); } @Override public int getRowCount () { + // Deligate this call to contact manager return this.getClient().getContactManager().size(); }