Class PlayersTable.PlayersTableModel

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

    private static class PlayersTable.PlayersTableModel
    extends javax.swing.table.AbstractTableModel
    The TableModel for the players table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<?> getColumnClass​(int column)
      Gets the class of the objects in the given column.
      int getColumnCount()
      Get the number of columns in this table.
      java.lang.String getColumnName​(int column)
      Get the name of a column.
      int getRowCount()
      Get the number of rows in this table.
      java.lang.Object getValueAt​(int row, int column)
      Get the value at the requested location.
      boolean isCellEditable​(int row, int column)
      Is a cell editable?
      void setValueAt​(java.lang.Object value, int row, int column)
      Sets the value at the specified location.
      void update()
      Update the nation map following any change.
      • Methods inherited from class javax.swing.table.AbstractTableModel

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

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

      • thisPlayer

        private final Player thisPlayer
      • nations

        private final java.util.List<Nation> nations
      • nationMap

        private final java.util.Map<Nation,​Player> nationMap
    • Constructor Detail

      • PlayersTableModel

        public PlayersTableModel​(PreGameController preGameController,
                                 NationOptions nationOptions,
                                 Player thisPlayer)
        Create a new PlayersTableModel.
        Parameters:
        preGameController - The PreGameController to use notify of updates.
        nationOptions - The current NationOptions.
        thisPlayer - The Player that owns the client.
    • Method Detail

      • update

        public void update()
        Update the nation map following any change.
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int column)
        Gets the class of the objects in the given column.
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
        Parameters:
        column - The column to return the class of.
        Returns:
        The Class of the objects in the given column.
      • getColumnCount

        public int getColumnCount()
        Get the number of columns in this table.
        Returns:
        The number of columns.
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Get the name of a column.
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
        Parameters:
        column - The column number to look up.
        Returns:
        The name of the specified column.
      • getRowCount

        public int getRowCount()
        Get the number of rows in this table.
        Returns:
        The number of rows.
      • getValueAt

        public java.lang.Object getValueAt​(int row,
                                           int column)
        Get the value at the requested location.
        Parameters:
        row - The requested row.
        column - The requested column.
        Returns:
        The value at the requested location.
      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int column)
        Is a cell editable?
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
        Parameters:
        row - The specified row.
        column - The specified column.
        Returns:
        True if the specified cell is editable.
      • setValueAt

        public void setValueAt​(java.lang.Object value,
                               int row,
                               int column)
        Sets the value at the specified location.
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel
        Parameters:
        value - The new value.
        row - The specified row.
        column - The specified column.