All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jdplus.toolkit.desktop.plugin.util.ListTableModel Maven / Gradle / Ivy

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jdplus.toolkit.desktop.plugin.util;

import javax.swing.table.AbstractTableModel;
import java.util.List;

/**
 *
 * @author Philippe Charles
 */
public abstract class ListTableModel extends AbstractTableModel {

    abstract protected List getColumnNames();

    abstract protected List getValues();

    abstract protected Object getValueAt(T row, int columnIndex);

    @Override
    public int getColumnCount() {
        return getColumnNames().size();
    }

    @Override
    public String getColumnName(int column) {
        return getColumnNames().get(column);
    }

    @Override
    public int getRowCount() {
        return getValues().size();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return getValueAt(getValues().get(rowIndex), columnIndex);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy