Package net.sf.freecol.client.gui.panel
Class PlayersTable.PlayersTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- net.sf.freecol.client.gui.panel.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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<Nation,Player>
nationMap
private NationOptions
nationOptions
private java.util.List<Nation>
nations
private PreGameController
preGameController
private Player
thisPlayer
-
Constructor Summary
Constructors Constructor Description PlayersTableModel(PreGameController preGameController, NationOptions nationOptions, Player thisPlayer)
Create a new PlayersTableModel.
-
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
-
-
-
-
Field Detail
-
preGameController
private final PreGameController preGameController
-
nationOptions
private final NationOptions nationOptions
-
thisPlayer
private final Player thisPlayer
-
nations
private final java.util.List<Nation> nations
-
-
Constructor Detail
-
PlayersTableModel
public PlayersTableModel(PreGameController preGameController, NationOptions nationOptions, Player thisPlayer)
Create a new PlayersTableModel.- Parameters:
preGameController
- ThePreGameController
to use notify of updates.nationOptions
- The currentNationOptions
.thisPlayer
- ThePlayer
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 interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.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 interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.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 interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.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 interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.AbstractTableModel
- Parameters:
value
- The new value.row
- The specified row.column
- The specified column.
-
-