com.fdsapi
Class DataSetDecorator

java.lang.Object
  |
  +--com.fdsapi.DataSet
        |
        +--com.fdsapi.DataSetDecorator
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DataSetCol, DataSetRow

public class DataSetDecorator
extends DataSet

This class is used to wrap prefixes and suffixes around a DataSet. This is used to format a DataSet into HTML. The general concept is all dynamic HTML (whether it is a cell in a table, a row in a table, the table itself or even header information) contains a prefix, a value and a suffix.

The DataSet heirarchy of objects uses the decorator and composite patterns from the "Design Patterns" book by Gamma, Helm, Johnson and Vlissides and published by Addison Wesley.



View Code


Field Summary
protected  DataSetMap data
           
 
Fields inherited from class com.fdsapi.DataSet
dataSetParm, templateTagType, variables
 
Constructor Summary
protected DataSetDecorator()
           
 
Method Summary
 java.lang.Object clone()
          Note clone() returns a shallow copy of the object.
 DataSet createFactoryInstance()
          A Factory method that creates a clone of this DataSet (see gang of 4 "Factory method" pattern).
 DataSet createFactoryInstance(DataSetFactoryParm dsfParm)
          A Factory method that creates a clone of this DataSet with whatever data that makes this instance unique .
 java.lang.Object execute()
          This function should be implemented in DataSetDecorator class for the client program to call to get the process started.
 void execute(int y)
          Execute a command against the specified index.
 void getData(int x, int y)
           
protected  DataSet getDataSet(int x, int y)
           
 void getPrefix(int x, int y)
          This method returns the prefix for a particular row, column (i.e.
 void getSuffix(int x, int y)
          Returns the suffix for a particular row, column (i.e.
protected  void initialize(java.lang.String templateContents)
          by default does nothing.
 boolean next(int x, int y)
           
 void setDataSetParm(DataSetParm dsp)
          Method that sets the DataSetParm for the DataSet instance.
 
Methods inherited from class com.fdsapi.DataSet
createDataIterator, getCellData, getDataSetParm, getMiscDataMap, getStringBuffer, getTabularData, getTemplateVariables, getVariableValue, log, next, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected DataSetMap data
Constructor Detail

DataSetDecorator

protected DataSetDecorator()
Method Detail

createFactoryInstance

public DataSet createFactoryInstance(DataSetFactoryParm dsfParm)
Description copied from class: DataSet
A Factory method that creates a clone of this DataSet with whatever data that makes this instance unique .

Overrides:
createFactoryInstance in class DataSet

createFactoryInstance

public DataSet createFactoryInstance()
Description copied from class: DataSet
A Factory method that creates a clone of this DataSet (see gang of 4 "Factory method" pattern). This allows the type of DataSet to be determined at runtime.

Specified by:
createFactoryInstance in class DataSet

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from class: DataSet

Note clone() returns a shallow copy of the object. This means the cloned instance variables of a DataSet will only clone the references not the underlying objects. When instance variables are stateless this works ok, but a deeper copy will have to be implemented if the instance variables are stateful.

This is an implementation of the Prototype factory pattern as discussed in the Erich Gamma Design Patterns book.

The CloneNotSupportedException could only be thrown if this class didn't implement the Cloneable tag interface.

Overrides:
clone in class DataSet
java.lang.CloneNotSupportedException

setDataSetParm

public void setDataSetParm(DataSetParm dsp)
Description copied from class: DataSet
Method that sets the DataSetParm for the DataSet instance.

Overrides:
setDataSetParm in class DataSet

initialize

protected void initialize(java.lang.String templateContents)
Description copied from class: DataSet
by default does nothing. DataSetDecorators provide real behaviour.

Overrides:
initialize in class DataSet

execute

public java.lang.Object execute()
Description copied from class: DataSet
This function should be implemented in DataSetDecorator class for the client program to call to get the process started. After the first call the execute(int) method will be called.

Overrides:
execute in class DataSet

next

public boolean next(int x,
                    int y)

execute

public void execute(int y)
Description copied from class: DataSet
Execute a command against the specified index. Index can represent a particular column, cell or other entity

Specified by:
execute in class DataSet

getPrefix

public void getPrefix(int x,
                      int y)
This method returns the prefix for a particular row, column (i.e. x, y) combination. For example if the DataSet we are working with is a cell then the returned value could be ""


getData

public void getData(int x,
                    int y)

getDataSet

protected DataSet getDataSet(int x,
                             int y)

getSuffix

public void getSuffix(int x,
                      int y)
Returns the suffix for a particular row, column (i.e. x, y) combination. For example if the DataSet we are working with is a cell then the returned value could be ""