org.enhydra.barracuda.core.comp
Class AbstractTableModel

java.lang.Object
  extended byorg.enhydra.barracuda.core.comp.AbstractTableModel
All Implemented Interfaces:
Contextual, Model, TableModel

public abstract class AbstractTableModel
extends Object
implements TableModel

This class provides the abstract implementation for a Table Model.

Note: this interface is designed to be used to ways. You can either implement to return a specific number of rows/cols (in which case hasMoreXXX() methods should return false) OR you can implement using the hasMoreXXX() methods (in which case the getColumnCount(), getRowCount() methods should return -1.

The getXXXCount() method is more like the Swing JTable interface; the hasMoreXXX() method makes it easier to implement tables where you don't know the total number of records when you start.

Classes implementing this interface should generally support both methods: in other words, for every row/column, invoke the getItemAt() method, then while the model has more rows/columns, it should again invoke getItemAt().


Field Summary
protected  List listeners
           
protected  ViewContext viewContext
           
 
Constructor Summary
AbstractTableModel()
           
 
Method Summary
 void addModelListener(ModelListener ml)
          Add a listener to the template that's notified each time a change to the data model occurs.
 void fireModelChanged()
          Forwards the given notification event to all TemplateModelListeners that registered themselves as listeners for this template model.
 ViewContext getViewContext()
          Get the current ViewContext
 void removeModelListener(ModelListener ml)
          Remove a listener
 void resetModel()
          Reset the model to its initial (unprocessed) state.
 void setViewContext(ViewContext ivc)
          Specify the ViewContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.enhydra.barracuda.core.comp.TableModel
getColumnCount, getItemAt, getRowCount
 

Field Detail

viewContext

protected ViewContext viewContext

listeners

protected List listeners
Constructor Detail

AbstractTableModel

public AbstractTableModel()
Method Detail

addModelListener

public void addModelListener(ModelListener ml)
Add a listener to the template that's notified each time a change to the data model occurs.

Specified by:
addModelListener in interface Model
Parameters:
ml - the TemplateModelListener

removeModelListener

public void removeModelListener(ModelListener ml)
Remove a listener

Specified by:
removeModelListener in interface Model
Parameters:
ml - the TemplateModelListener

fireModelChanged

public void fireModelChanged()
Forwards the given notification event to all TemplateModelListeners that registered themselves as listeners for this template model.


resetModel

public void resetModel()
Reset the model to its initial (unprocessed) state. This is a convenience method that gets invoked prior to the entire model being rendered. You only need to override this method if you want to do something (like reset internal counters) before the model is queried

Specified by:
resetModel in interface TableModel

setViewContext

public void setViewContext(ViewContext ivc)
Specify the ViewContext. This method will generally be called by the class that is using the model to actually render the data in a view. The context will be specified prior to a render pass, and the context will be reset to null after the render pass.

Specified by:
setViewContext in interface Contextual
Parameters:
ivc - the current ViewContext

getViewContext

public ViewContext getViewContext()
Get the current ViewContext

Specified by:
getViewContext in interface Contextual
Returns:
the current ViewContext


Copyright © 2003 BarracudaMVC.org All Rights Reserved.