Class LibraryTableModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    public class LibraryTableModel
    extends javax.swing.table.AbstractTableModel
    A table model containing a list of libraries used in a project.

    Used in the LibraryPanel class.

    Author:
    David Gilbert
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • Constructor Summary

      Constructors 
      Constructor Description
      LibraryTableModel​(java.util.List libraries)
      Constructs a LibraryTableModel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getColumnCount()
      Returns the number of columns in the table model.
      java.lang.String getColumnName​(int column)
      Returns the name of a column in the table model.
      Library[] getLibraries()
      Returns an array of the libraries in the table.
      int getRowCount()
      Returns the number of rows in the table model.
      java.lang.Object getValueAt​(int row, int column)
      Returns the value for a cell in the table model.
      • Methods inherited from class javax.swing.table.AbstractTableModel

        addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LibraryTableModel

        public LibraryTableModel​(java.util.List libraries)
        Constructs a LibraryTableModel.
        Parameters:
        libraries - the libraries.
    • Method Detail

      • getRowCount

        public int getRowCount()
        Returns the number of rows in the table model.
        Returns:
        the number of rows.
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table model. In this case, there are always four columns (name, version, licence and other info).
        Returns:
        the number of columns in the table model.
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Returns the name of a column in the table model.
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
        Parameters:
        column - the column index (zero-based).
        Returns:
        the name of the specified column.
      • getValueAt

        public java.lang.Object getValueAt​(int row,
                                           int column)
        Returns the value for a cell in the table model.
        Parameters:
        row - the row index (zero-based).
        column - the column index (zero-based).
        Returns:
        the value.
      • getLibraries

        public Library[] getLibraries()
        Returns an array of the libraries in the table.
        Returns:
        An array of libraries.