net.sourceforge.jabm.view
Class JFrameReportVariables

java.lang.Object
  extended by net.sourceforge.jabm.view.JFrameReportVariables
All Implemented Interfaces:
javax.swing.table.TableModel, EventListener, Report, ReportVariables, ReportWithGUI, org.springframework.beans.factory.InitializingBean

public class JFrameReportVariables
extends java.lang.Object
implements ReportWithGUI, ReportVariables, javax.swing.table.TableModel, org.springframework.beans.factory.InitializingBean

JFrameReportVariables automatically record other ReportVariables to a swing JTable on a window whenever they are computed.

 

Field Summary
protected  java.util.LinkedList<javax.swing.event.TableModelListener> listeners
           
protected  ReportVariables reportVariables
          This report collects the data that we will write.
protected  javax.swing.JTable table
           
 
Constructor Summary
JFrameReportVariables()
           
 
Method Summary
 void addTableModelListener(javax.swing.event.TableModelListener l)
           
 void afterPropertiesSet()
           
 void compute(SimEvent event)
          Update variables.
 void dispose(SimEvent event)
          Clean up any side effects (eg close file).
 void eventOccurred(SimEvent event)
           
 java.lang.Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int columnIndex)
           
 javax.swing.JComponent getComponent()
           
 java.text.DecimalFormat getFormat()
           
 java.lang.String getName()
           
 ReportVariables getReportVariables()
           
 int getRowCount()
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 java.util.Map<java.lang.Object,java.lang.Number> getVariableBindings()
          Get the values calculated by this report.
 void initialise(SimEvent event)
          Initialise the variables in response to event.
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void notifyTableChanged()
           
 void removeTableModelListener(javax.swing.event.TableModelListener l)
           
 void setFormat(java.text.DecimalFormat format)
           
 void setReportVariables(ReportVariables reportVariables)
           
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected java.util.LinkedList<javax.swing.event.TableModelListener> listeners

reportVariables

protected ReportVariables reportVariables
This report collects the data that we will write.


table

protected javax.swing.JTable table
Constructor Detail

JFrameReportVariables

public JFrameReportVariables()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

compute

public void compute(SimEvent event)
Description copied from interface: ReportVariables
Update variables.

Specified by:
compute in interface ReportVariables

getVariableBindings

public java.util.Map<java.lang.Object,java.lang.Number> getVariableBindings()
Description copied from interface: Report
Get the values calculated by this report.

Specified by:
getVariableBindings in interface Report
Returns:
A Map of user-readable variable names to their associated values.

eventOccurred

public void eventOccurred(SimEvent event)
Specified by:
eventOccurred in interface EventListener

dispose

public void dispose(SimEvent event)
Description copied from interface: ReportVariables
Clean up any side effects (eg close file).

Specified by:
dispose in interface ReportVariables

initialise

public void initialise(SimEvent event)
Description copied from interface: ReportVariables
Initialise the variables in response to event.

Specified by:
initialise in interface ReportVariables

getReportVariables

public ReportVariables getReportVariables()

setReportVariables

public void setReportVariables(ReportVariables reportVariables)

getFormat

public java.text.DecimalFormat getFormat()

setFormat

public void setFormat(java.text.DecimalFormat format)

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getColumnName

public java.lang.String getColumnName(int columnIndex)
Specified by:
getColumnName in interface javax.swing.table.TableModel

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Specified by:
getValueAt in interface javax.swing.table.TableModel

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener l)
Specified by:
addTableModelListener in interface javax.swing.table.TableModel

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener l)
Specified by:
removeTableModelListener in interface javax.swing.table.TableModel

notifyTableChanged

public void notifyTableChanged()

getName

public java.lang.String getName()
Specified by:
getName in interface Report
Specified by:
getName in interface ReportVariables

getComponent

public javax.swing.JComponent getComponent()
Specified by:
getComponent in interface ReportWithGUI