com.yospace.yae.yogi
Interface DataModel

All Known Implementing Classes:
DefaultDataModel

public interface DataModel

The DataModel interface must be implemented by any class that is to be used as a data model for AbstractTable subclasses. It provides the methods neccessary to manipulate the data model, and to manage the model listeners so that notification can be posted when the state of the DataModel changes.


Method Summary
 void addItem(java.lang.Object item)
          Adds an item to the DataModel.
 void addModelListener(AbstractTable list)
          Adds a model listener to the DataModel.
 java.lang.Object getItem(int index)
          Gets an item from the DataModel.
 int getSize()
          Gets the size of the DataModel.
 void insertItem(java.lang.Object item, int index)
          Inserts an item at the specified position in the DataModel.
 void removeAll()
          Removes all items from the DataModel.
 void removeItem(int index)
          Removes the item at the specified position from the DataModel.
 void removeModelListener(AbstractTable list)
          Removes the specified model listener from the DataModel.
 

Method Detail

getItem

public java.lang.Object getItem(int index)
Gets an item from the DataModel.
Parameters:
index - The index of the item to get.
Returns:
Object the data at index.

getSize

public int getSize()
Gets the size of the DataModel.
Returns:
the number of elements in the DataModel.

addModelListener

public void addModelListener(AbstractTable list)
Adds a model listener to the DataModel. The model listener must be the object which is using the DataModel to store its data, and is therefore a subclass of AbstractTable.
Parameters:
list - the listener.

removeModelListener

public void removeModelListener(AbstractTable list)
Removes the specified model listener from the DataModel. The model listener must be the object which is using the DataModel to store its data, and is therefore a subclass of AbstractTable.
Parameters:
list - the listener.

addItem

public void addItem(java.lang.Object item)
Adds an item to the DataModel.
Parameters:
item - The item to add.

insertItem

public void insertItem(java.lang.Object item,
                       int index)
Inserts an item at the specified position in the DataModel.
Parameters:
item - The item to add.
index - The position at which to add the item.

removeItem

public void removeItem(int index)
Removes the item at the specified position from the DataModel.
Parameters:
index - The position from which to remove the item.

removeAll

public void removeAll()
Removes all items from the DataModel.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.