import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import javax.swing.table.TableModel;
-import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.manager.Manageable;
import org.mxchange.jcore.model.contact.Contact;
import org.mxchange.jswingcore.model.BaseModel;
import org.mxchange.jswingcore.model.Model;
public class ContactTableModel extends BaseModel implements Model, TableModel {
/**
- * Constructor with Client instance which holds the contact manager
+ * Constructor with manager instance which holds the contact manager
*
- * @param client Client instance
+ * @param manager Manageable instance
*/
- public ContactTableModel (final Client client) {
+ public ContactTableModel (final Manageable manager) {
// Trace message
- this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("manager={1} - CALLED!", manager)); //NOI18N
- // Client must not be null
- if (null == client) {
+ // Manager must not be null
+ if (null == manager) {
// Abort here
- throw new NullPointerException("client is null"); //NOI18N
+ throw new NullPointerException("manager is null"); //NOI18N
}
- // Set client
- this.setClient(client);
+ // Set manager
+ this.setManager(manager);
}
@Override
@Override
public int getColumnCount () {
- // Get manager
- ManageableDatabase manager = (ManageableDatabase) this.getClient().getManager();
-
// Deligate this call to contact manager
- return manager.getColumnCount();
+ return this.getManager().getColumnCount();
}
@Override
public String getColumnName (final int columnIndex) {
- // Get manager
- ManageableDatabase manager = (ManageableDatabase) this.getClient().getManager();
-
// Deligate this call to contact manager
- return manager.getTranslatedColumnName(columnIndex);
+ return this.getManager().getTranslatedColumnName(columnIndex);
}
@Override
public int getRowCount () {
- // Get manager
- ManageableDatabase manager = (ManageableDatabase) this.getClient().getManager();
-
try {
// Deligate this call to contact manager
- return manager.size();
+ return this.getManager().size();
} catch (final IOException ex) {
// Log warning
this.logException(ex);
@Override
public Object getValueAt (final int rowIndex, final int columnIndex) {
- // Get manager
- ManageableDatabase manager = (ManageableDatabase) this.getClient().getManager();
-
// Init value
Object value = null;
try {
// Deligate this call to contact manager
- value = manager.getValueFromRowColumn(rowIndex, columnIndex);
+ value = this.getManager().getValueFromRowColumn(rowIndex, columnIndex);
} catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Abort here
this.abortProgramWithException(ex);