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.AbstractTableModelThe TableModel for the players table.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<Nation,Player>nationMapprivate NationOptionsnationOptionsprivate java.util.List<Nation>nationsprivate PreGameControllerpreGameControllerprivate PlayerthisPlayer
-
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.intgetColumnCount()Get the number of columns in this table.java.lang.StringgetColumnName(int column)Get the name of a column.intgetRowCount()Get the number of rows in this table.java.lang.ObjectgetValueAt(int row, int column)Get the value at the requested location.booleanisCellEditable(int row, int column)Is a cell editable?voidsetValueAt(java.lang.Object value, int row, int column)Sets the value at the specified location.voidupdate()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- ThePreGameControllerto use notify of updates.nationOptions- The currentNationOptions.thisPlayer- ThePlayerthat 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:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel- Parameters:
column- The column to return the class of.- Returns:
- The
Classof 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:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein 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:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein 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:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin classjavax.swing.table.AbstractTableModel- Parameters:
value- The new value.row- The specified row.column- The specified column.
-
-