From 8d35a116334371547bb805d3b1648866d8c7f667 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 23 Jul 2015 08:19:55 +0200 Subject: [PATCH] =?utf8?q?Fixed=20call=20+=20introduced=20getColumnCount()?= =?utf8?q?=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../mxchange/addressbook/contact/BaseContact.java | 5 +++++ .../addressbook/manager/contact/ContactManager.java | 12 +++++++++++- .../manager/contact/ManageableContact.java | 7 +++++++ .../addressbook/model/address/AddressTableModel.java | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/org/mxchange/addressbook/contact/BaseContact.java b/src/org/mxchange/addressbook/contact/BaseContact.java index 2a1ecb73..78d4f079 100644 --- a/src/org/mxchange/addressbook/contact/BaseContact.java +++ b/src/org/mxchange/addressbook/contact/BaseContact.java @@ -28,6 +28,11 @@ import org.mxchange.addressbook.client.Client; * @since 0.0 */ public class BaseContact extends BaseFrameworkSystem { + /** + * Amount of columns + */ + public static final int COLUMN_COUNT = 14; + /** * Birth day */ diff --git a/src/org/mxchange/addressbook/manager/contact/ContactManager.java b/src/org/mxchange/addressbook/manager/contact/ContactManager.java index 69a9a624..e89b7081 100644 --- a/src/org/mxchange/addressbook/manager/contact/ContactManager.java +++ b/src/org/mxchange/addressbook/manager/contact/ContactManager.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.List; import org.mxchange.addressbook.UnhandledUserChoiceException; import org.mxchange.addressbook.client.Client; +import org.mxchange.addressbook.contact.BaseContact; import org.mxchange.addressbook.contact.Contact; import org.mxchange.addressbook.database.frontend.contact.ContactDatabaseFrontend; import org.mxchange.addressbook.database.frontend.contact.ContactWrapper; @@ -34,7 +35,6 @@ import org.mxchange.addressbook.manager.BaseManager; * * @author Roland Haeder * @version 0.0 - * @since 0.0 */ public class ContactManager extends BaseManager implements ManageableContact { @@ -354,6 +354,7 @@ public class ContactManager extends BaseManager implements ManageableContact { /** * Asks the user for own ZIP code + * * @return ZIP code */ @Override @@ -361,6 +362,15 @@ public class ContactManager extends BaseManager implements ManageableContact { return this.getClient().enterInt(0, 99_999, "Bitte geben Sie Ihre Postleitzahl ein: "); } + @Override + public int getColumnCount () { + /* + * Return constant, may look useful. But without this, e.g. the + * AddressTableModel have a hard-coded value. + */ + return BaseContact.COLUMN_COUNT; + } + /** * Getter for whole contact list * diff --git a/src/org/mxchange/addressbook/manager/contact/ManageableContact.java b/src/org/mxchange/addressbook/manager/contact/ManageableContact.java index 5a824c32..736053d2 100644 --- a/src/org/mxchange/addressbook/manager/contact/ManageableContact.java +++ b/src/org/mxchange/addressbook/manager/contact/ManageableContact.java @@ -123,6 +123,13 @@ public interface ManageableContact extends Manageable { */ public int enterOwnZipCode (); + /** + * Getter for column count + * + * @return Column count + */ + public int getColumnCount (); + /** * List all contacts */ diff --git a/src/org/mxchange/addressbook/model/address/AddressTableModel.java b/src/org/mxchange/addressbook/model/address/AddressTableModel.java index 0019773d..d386b951 100644 --- a/src/org/mxchange/addressbook/model/address/AddressTableModel.java +++ b/src/org/mxchange/addressbook/model/address/AddressTableModel.java @@ -47,7 +47,7 @@ public class AddressTableModel extends BaseModel implements TableModel { @Override public int getColumnCount () { // Deligate this call to the contact manager - return this.getClient().getContactManager().size(); + return this.getClient().getContactManager().getColumnCount(); } @Override -- 2.39.5