universe.server.gui
Class GameOptionPanels.CivilizationTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--universe.server.gui.GameOptionPanels.CivilizationTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Enclosing class:
GameOptionPanels

class GameOptionPanels.CivilizationTableModel
extends javax.swing.table.AbstractTableModel

This class implements a table model that utilizes as its data a single vector of CivOptions objects. Each row corresponds to one of the CivOptions objects. Each column in the model accesses a different attribute of the CivOptions object that is to be displayed and/or manipulated. Currently only two columns, Founding Species and Civ Type, are shown. As new attributes are added to the CivOptions objects, additional columns should be added.


Field Summary
private  java.util.Vector civOptionsList
           
private  java.lang.String[] columnNames
           
static int PLAYER_TYPE_COL
           
private  javax.swing.JLabel rowCountLabel
           
static int SPECIES_COL
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
GameOptionPanels.CivilizationTableModel(java.util.Vector aVector, javax.swing.JLabel aLabel)
          The constructor for instances of this class.
 
Method Summary
 void decreaseCivCount()
           
 CivOptions getCivilizationAtRow(int row)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int col)
           
 int getRowCount()
           
 java.lang.Object getValueAt(int row, int col)
           
 void increaseCivCount()
           
 boolean isCellEditable(int row, int col)
           
 void setValueAt(java.lang.Object aValue, int row, int col)
          Sets the value of the civilization option corresponding to the given row and column to the given value.
 void updateRowCount()
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rowCountLabel

private javax.swing.JLabel rowCountLabel

civOptionsList

private java.util.Vector civOptionsList

columnNames

private final java.lang.String[] columnNames

SPECIES_COL

public static final int SPECIES_COL
See Also:
Constant Field Values

PLAYER_TYPE_COL

public static final int PLAYER_TYPE_COL
See Also:
Constant Field Values
Constructor Detail

GameOptionPanels.CivilizationTableModel

public GameOptionPanels.CivilizationTableModel(java.util.Vector aVector,
                                               javax.swing.JLabel aLabel)
The constructor for instances of this class.

Parameters:
aVector - The list of CivOptions objects to be shown and manipulated.
aLabel - A label where the current number of rows is to be shown.
Method Detail

getRowCount

public int getRowCount()

getColumnCount

public int getColumnCount()

getColumnName

public java.lang.String getColumnName(int col)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int col)
Sets the value of the civilization option corresponding to the given row and column to the given value.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
aValue - The new value.

getCivilizationAtRow

public CivOptions getCivilizationAtRow(int row)

decreaseCivCount

public void decreaseCivCount()

increaseCivCount

public void increaseCivCount()

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

updateRowCount

public void updateRowCount()


Copyright © 2001 Universe Dev Team All Rights Reserved.