Class GameListModel

java.lang.Object
  extended byGameListModel
All Implemented Interfaces:
javax.swing.ListModel

public class GameListModel
extends java.lang.Object
implements javax.swing.ListModel

Model for JList.

Implements interface ListModel.

This model contains a list of the race information. All information (GameInfo) is given at the same time with the setElements(GameInfo [] gis) method.

Version:
1.0
Author:
Stefan Brockmann, Tero Kuusela
See Also:
Tracksail

Field Summary
private  GameInfo[] elements
          race information as an array
private  java.util.ArrayList listeners
          list of list data listeners
 
Constructor Summary
GameListModel()
           
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener l)
          Adds a list data listener.
 java.lang.Object getElementAt(int index)
          Returns the requested GameInfo object.
 int getSize()
          Returns the number of race information objects.
 void removeListDataListener(javax.swing.event.ListDataListener l)
          Removes a list data listener.
 void setElements(GameInfo[] gis)
          Sets the given race information as the content of the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.ArrayList listeners
list of list data listeners


elements

private GameInfo[] elements
race information as an array

Constructor Detail

GameListModel

public GameListModel()
Method Detail

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener l)
Adds a list data listener.

Specified by:
addListDataListener in interface javax.swing.ListModel
Parameters:
l - ListDataListener object

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener l)
Removes a list data listener.

Specified by:
removeListDataListener in interface javax.swing.ListModel
Parameters:
l - ListDataListener object.

getElementAt

public java.lang.Object getElementAt(int index)
Returns the requested GameInfo object.

Specified by:
getElementAt in interface javax.swing.ListModel
Parameters:
index - index of the requested location
Returns:
The GameInfo object of the requested index.

getSize

public int getSize()
Returns the number of race information objects.

Specified by:
getSize in interface javax.swing.ListModel
Returns:
Size of the model, which is the number of GameInfo objects.

setElements

public void setElements(GameInfo[] gis)
Sets the given race information as the content of the model.

Parameters:
gis - GameInfo objects as an array.