com.sas.servlet.beans.mdtable
Class BaseMDTable

java.lang.Object
  |
  +--com.sas.Component
        |
        +--com.sas.servlet.beans.BaseTransformation
              |
              +--com.sas.servlet.beans.mdtable.BaseMDTable
Direct Known Subclasses:
MDTable

public abstract class BaseMDTable
extends BaseTransformation

This is an abstract class that contains all methods needed to create a table that represents a multidimensional table that are not specific to a particular implementation such as HTML.

See Also:
Serialized Form

Field Summary
protected  AxisInterface columnAxis
          columnAxis - column Axis object for the current model.
protected  int columnCount
          columnCount - total number of columns available on the current model.
protected  AxisLabelInterface[][] columnLabels
          columnLabels - array containing columnLabel information used internally to execute commands on the model.
protected  LevelInterface[] columnLevels
          columnLevels - array containing all Level objects on the column axis of the model.
protected  OrderedCollection columnUpAxisLabels
          columnUpAxisLabels - collection of AxisLabelInterfaces that represent the Up labels in the column dimension.
protected  int endColumn
          endColumn - last column in the table to display.
protected  int endRow
          endRow - last row in the table to display.
protected  OrderedCollection executedCommands
          executedCommands - collection containing com.sas.servlet.beans.mdtabel.MDCommand objects that have been executed.
protected  OrderedCollection mdCommands
          mdCommands - collection containing com.sas.servlet.beans.mdtabel.MDCommand objects.
protected  AxisInterface rowAxis
          rowAxis - row Axis object for the current model.
protected  int rowCount
          rowCount - total number of rows available on the current model.
protected  AxisLabelInterface[][] rowLabels
          rowLabels - array containing rowLabel information used internally to execute commands on the model.
protected  LevelInterface[] rowLevels
          rowLevels - array containing all Level objects on the row axis of the model.
protected  OrderedCollection rowUpAxisLabels
          rowUpAxisLabels - collection of AxisLabelInterfaces that represent the Up labels in the row dimension.
protected  int startColumn
          startColumn - first column in the table to display.
protected  int startRow
          startRow - first row in the table to display.
 
Constructor Summary
BaseMDTable()
           
 
Method Summary
protected  MDCommand buildMDCommand(AxisLabelInterface label, String action, String axis)
          This method is used internally by the writeColumnHeadings and writeRows methods.
protected  MDCommand buildMDCommand(String action, String axis, int startValue, int endValue)
          This method is used internally by the writeNavigationBars method.
 void executeCommand(String name)
          This methods executes the com.sas.servlet.beans.mdtabel.MDCommand object associated with the name which is passed as a String argument to the method.
 int getBorderWidth()
          Gets the width of the outer border around the table.
 int getCellPadding()
          Gets the number of pixels between the border of a cell and the cell's contents.
 int getCellSpacing()
          Gets the number of pixels between the border of each cell.
 int getMaxColumns()
          Returns the maximum number of columns to be formatted for each display of the table.
 int getMaxRows()
          Returns the maximum number of row to be formatted for each display of the table.
protected  void getModelInformation(MultidimensionalTableV2Interface mi)
          This method is only relevent to someone who is extending BaseMDTable and is implementing the writeTable(), writeNavigationBars(), writeTableTitles(), writeColumnHeadings(), or writeRows() methods.
 Vector getRequiredInterfaces()
          Sets the required interface that a model must implement in order to attach to this bean.
 int getWidth()
          Gets the width of the table in pixels.
 int getWidthPercentage()
          Gets the width of the table as a percentage
 void initialize()
          Initialize the MDTable Object.
 void setBorderWidth(int border)
          Sets the width of the outer border around the table in pixels.
 void setCellPadding(int padding)
          Sets the number of pixels between the border of a cell and the cell's contents.
 void setCellSpacing(int spacing)
          Sets the number of pixels between the border of each cell.
 void setMaxColumns(int n)
          Sets the maximum number of columns to be formatted for each display of the table.
 void setMaxRows(int n)
          Sets the maximum number of row to be formatted for each display of the table.
 void setModelInterface(ModelInterface newValue)
          Specifies the model to display in the view.
 void setWidth(int pixels)
          Sets the width of the table in pixels.
 void setWidthPercentage(int width)
          Sets the width of the table as a percentage.
 String toString()
           
 void write(PrintWriter out)
          Writes the transformed representation of the object
protected  void writeColumnHeadings(OutputStream out)
          Writes the column headings.
protected abstract  void writeColumnHeadings(PrintWriter out)
          Writes the column headings.
protected  void writeColumnHeadings(Writer out)
          Writes the column headings.
protected  void writeRows(OutputStream out)
          Write the table rows.
protected abstract  void writeRows(PrintWriter out)
          Write the table rows.
protected  void writeRows(Writer out)
          Write the table rows.
protected  void writeTable(PrintWriter out)
          Formats and writes the contents of the entire table.
protected  void writeTableFooter(OutputStream out)
          Writes the table footer
protected abstract  void writeTableFooter(PrintWriter out)
          Writes the table footer
protected  void writeTableFooter(Writer out)
          Writes the table footer
protected  void writeTableHeader(OutputStream out)
          Writes the table header.
protected abstract  void writeTableHeader(PrintWriter out)
          Writes the table header.
protected  void writeTableHeader(Writer out)
          Writes the table header.
protected  void writeTableNavigationBars(OutputStream out)
          Writes the table navigation bars if needed.
protected abstract  void writeTableNavigationBars(PrintWriter out)
          Writes the table navigation bars if needed.
protected  void writeTableNavigationBars(Writer out)
          Writes the table navigation bars if needed.
protected  void writeTableTitles(OutputStream out)
          Writes the table subset information.
protected abstract  void writeTableTitles(PrintWriter out)
          Writes the table subset information.
protected  void writeTableTitles(Writer out)
          Writes the table subset information.
 
Methods inherited from class com.sas.servlet.beans.BaseTransformation
getCustomAttributes, getDescription, getName, getParent, getRequest, getResponse, setCustomAttributes, setDescription, setName, setParent, setRequest, setResponse, write, write, write
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getExtendedBeanInfo, getLinkInfo, getModelInterface, getResources, getStringResource, getViewInterfaceSupportInfo, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mdCommands

protected OrderedCollection mdCommands
mdCommands - collection containing com.sas.servlet.beans.mdtabel.MDCommand objects. These commands are used internally to perform drilldown, scrolling etc. .

executedCommands

protected OrderedCollection executedCommands
executedCommands - collection containing com.sas.servlet.beans.mdtabel.MDCommand objects that have been executed. These commands are used internally to undo drilldowns, scrolls, etc. .

columnLabels

protected AxisLabelInterface[][] columnLabels
columnLabels - array containing columnLabel information used internally to execute commands on the model.

rowLabels

protected AxisLabelInterface[][] rowLabels
rowLabels - array containing rowLabel information used internally to execute commands on the model.

rowAxis

protected AxisInterface rowAxis
rowAxis - row Axis object for the current model.

columnAxis

protected AxisInterface columnAxis
columnAxis - column Axis object for the current model.

columnLevels

protected LevelInterface[] columnLevels
columnLevels - array containing all Level objects on the column axis of the model.

rowLevels

protected LevelInterface[] rowLevels
rowLevels - array containing all Level objects on the row axis of the model.

columnCount

protected int columnCount
columnCount - total number of columns available on the current model.

rowCount

protected int rowCount
rowCount - total number of rows available on the current model.

startRow

protected int startRow
startRow - first row in the table to display. Used internally to perform table scrolling.

endRow

protected int endRow
endRow - last row in the table to display. Used internally to perform table scrolling.

startColumn

protected int startColumn
startColumn - first column in the table to display. Used internally to perform table scrolling.

endColumn

protected int endColumn
endColumn - last column in the table to display. Used internally to perform table scrolling.

rowUpAxisLabels

protected OrderedCollection rowUpAxisLabels
rowUpAxisLabels - collection of AxisLabelInterfaces that represent the Up labels in the row dimension. These are used internally to undo a drilldown.

columnUpAxisLabels

protected OrderedCollection columnUpAxisLabels
columnUpAxisLabels - collection of AxisLabelInterfaces that represent the Up labels in the column dimension. These are used internally to undo a drilldown.
Constructor Detail

BaseMDTable

public BaseMDTable()
Method Detail

getRequiredInterfaces

public Vector getRequiredInterfaces()
Sets the required interface that a model must implement in order to attach to this bean. Models must implement com.sas.sasserver.MultidimensionalTableV2Interface and com.sas.mdtable.StaticFormattedDataInterface in order to be used by this transformation bean
Returns:
An array of interface names
Overrides:
getRequiredInterfaces in class Component

setModelInterface

public void setModelInterface(ModelInterface newValue)
Specifies the model to display in the view. Models must implement com.sas.mdtable.sasserver.MultidimensionalTableV2Interface and com.sas.mdtable.StaticFormattedDataInterface in order to be used by this transformation bean Pass null to disassociate the view from its model.
Parameters:
newValue - The new value to assign the modelInterface property.
Overrides:
setModelInterface in class Component

toString

public String toString()
Overrides:
toString in class BaseTransformation

initialize

public void initialize()
Initialize the MDTable Object. This method should be called any time the model is initialized. There are currently only 2 models within webAF that can be used with this class, com.sas.sasserver.mdtable.MultidimensionalInterface or com.sas.sasserver.mdtable.MultidimensionalV2Interface. Anytime initilizeTable() is called on these models, the initialize() method needs to be called.
Overrides:
initialize in class Component

setWidth

public void setWidth(int pixels)
Sets the width of the table in pixels. If the width is set using setWidth() and setWidthPercentage() the width in pixels will be override the width percentage.
Parameters:
width - The width in pixels
See Also:
getWidth()

getWidth

public int getWidth()
Gets the width of the table in pixels.
Returns:
The width in pixels
See Also:
setWidth(int)

setWidthPercentage

public void setWidthPercentage(int width)
Sets the width of the table as a percentage. If the width is set using setWidth() and setWidthPercentage() the width in pixels will be override the width percentage.
Parameters:
width - The width as a percentage
See Also:
getWidthPercentage()

getWidthPercentage

public int getWidthPercentage()
Gets the width of the table as a percentage
Returns:
The width as a percentage
See Also:
setWidthPercentage(int)

setBorderWidth

public void setBorderWidth(int border)
Sets the width of the outer border around the table in pixels. The default is 0.
Parameters:
border - The border width in pixels
See Also:
getBorderWidth()

getBorderWidth

public int getBorderWidth()
Gets the width of the outer border around the table.
Returns:
The border width in pixels
See Also:
setBorderWidth(int)

setCellSpacing

public void setCellSpacing(int spacing)
Sets the number of pixels between the border of each cell. The default is 1.
Parameters:
spacing - The number of pixels between each cell
See Also:
getCellSpacing()

getCellSpacing

public int getCellSpacing()
Gets the number of pixels between the border of each cell.
Returns:
The number of pixels between each cell
See Also:
setCellSpacing(int)

setCellPadding

public void setCellPadding(int padding)
Sets the number of pixels between the border of a cell and the cell's contents. The default is 0.
Parameters:
padding - The number of pixels between the cell border and the cell content.
See Also:
getCellPadding()

getCellPadding

public int getCellPadding()
Gets the number of pixels between the border of a cell and the cell's contents.
Returns:
The number of pixels between the cell border and the cell content
See Also:
setCellPadding(int)

setMaxRows

public void setMaxRows(int n)
Sets the maximum number of row to be formatted for each display of the table. The default value is -1, format all rows.
Parameters:
n - - maximum number of rows to be formatted.
See Also:
getMaxRows()

getMaxRows

public int getMaxRows()
Returns the maximum number of row to be formatted for each display of the table. The default value is -1, format all rows.
Returns:
The maximum number of rows to be formatted.
See Also:
setMaxRows(int)

setMaxColumns

public void setMaxColumns(int n)
Sets the maximum number of columns to be formatted for each display of the table. The default value is -1, format all columns.
Parameters:
n - - maximum number of columns to be formatted.
See Also:
getMaxColumns()

getMaxColumns

public int getMaxColumns()
Returns the maximum number of columns to be formatted for each display of the table. The default value is -1, format all columns.
Returns:
The maximum number of columns to be formatted.
See Also:
setMaxColumns(int)

write

public void write(PrintWriter out)
           throws IOException
Writes the transformed representation of the object
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
Overrides:
write in class BaseTransformation

writeTable

protected void writeTable(PrintWriter out)
                   throws IOException
Formats and writes the contents of the entire table. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
com.sas.servlet.beans.mdtable.BaseMDTable#getModelInformation.

writeTableHeader

protected void writeTableHeader(Writer out)
                         throws IOException
Writes the table header.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableHeader

protected void writeTableHeader(OutputStream out)
                         throws IOException
Writes the table header.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableHeader

protected abstract void writeTableHeader(PrintWriter out)
                                  throws IOException
Writes the table header.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeColumnHeadings

protected void writeColumnHeadings(Writer out)
                            throws IOException
Writes the column headings. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
getModelInformation(com.sas.sasserver.mdtable.MultidimensionalTableV2Interface)

writeColumnHeadings

protected void writeColumnHeadings(OutputStream out)
                            throws IOException
Writes the column headings. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
getModelInformation(com.sas.sasserver.mdtable.MultidimensionalTableV2Interface)

writeColumnHeadings

protected abstract void writeColumnHeadings(PrintWriter out)
                                     throws IOException
Writes the column headings. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
getModelInformation(com.sas.sasserver.mdtable.MultidimensionalTableV2Interface)

writeRows

protected void writeRows(Writer out)
                  throws IOException
Write the table rows. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
getModelInformation(com.sas.sasserver.mdtable.MultidimensionalTableV2Interface)

writeRows

protected void writeRows(OutputStream out)
                  throws IOException
Write the table rows. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
getModelInformation(com.sas.sasserver.mdtable.MultidimensionalTableV2Interface)

writeRows

protected abstract void writeRows(PrintWriter out)
                           throws IOException
Write the table rows. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs
See Also:
getModelInformation(com.sas.sasserver.mdtable.MultidimensionalTableV2Interface)

writeTableFooter

protected void writeTableFooter(Writer out)
                         throws IOException
Writes the table footer
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableFooter

protected void writeTableFooter(OutputStream out)
                         throws IOException
Writes the table footer
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableFooter

protected abstract void writeTableFooter(PrintWriter out)
                                  throws IOException
Writes the table footer
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

getModelInformation

protected void getModelInformation(MultidimensionalTableV2Interface mi)
This method is only relevent to someone who is extending BaseMDTable and is implementing the writeTable(), writeNavigationBars(), writeTableTitles(), writeColumnHeadings(), or writeRows() methods. The getModelInformation method populates rowAxis, columnAxis, rowLevels, columnLevels, rowLabels, columnLabels, rowCount, and columnCount from the model and sets the appropriate values of startRow, endRow, startColumn, and endColumn. This method is called internally in the writeTable method before writing any part of the table out, since the values created by this method are used by writeNavigationBars(), writeTableTitles(), writeColumnHeadings(), & writeRows(). This is much more efficient than duplication of the same code in each of these methods. Anytime writeNavigationBars(), writeTableTitles(), writeColumnHeadings(), or writeRows() is called getModelInformation must be called prior to calling the above mentioned methods.
See Also:
writeTable(java.io.PrintWriter), com.sas.servlet.beans.mdtable.BaseMDTable#writeNavigationBars, writeTableTitles(java.io.Writer), writeColumnHeadings(java.io.Writer), writeRows(java.io.Writer)

executeCommand

public void executeCommand(String name)
This methods executes the com.sas.servlet.beans.mdtabel.MDCommand object associated with the name which is passed as a String argument to the method.

buildMDCommand

protected MDCommand buildMDCommand(AxisLabelInterface label,
                                   String action,
                                   String axis)
This method is used internally by the writeColumnHeadings and writeRows methods. Only developers wanting to override these methods would be interested in this method. Convenience method to build a com.sas.servlet.beans.mdtable.MDCommand to drill-down or go up.
Parameters:
label - AxisLabelInterface object associated with this MDCommand object
action - action associated with this command, DRILLDOWN or UP
axis - axis associated with this command, ROW or COLUMN
Returns:
MDCommand object

buildMDCommand

protected MDCommand buildMDCommand(String action,
                                   String axis,
                                   int startValue,
                                   int endValue)
This method is used internally by the writeNavigationBars method. Only developers wanting to override these methods would be interested in this method. This is a convenience method to build a com.sas.servlet.beans.mdtable.MDCommand to scroll.
Parameters:
action - associated with this command, SCROLLDOWN, SCROLLDOWNMAX, SCROLLUP, SCROLLUPMAX, SCROLLLEFT, SCROLLLEFTMAX, SCROLLRIGHT, SCROLLRIGHTMAX.
axis - axis associated with this command, ROW or COLUMN
Returns:
MDCommand object

writeTableTitles

protected void writeTableTitles(Writer out)
                         throws IOException
Writes the table subset information. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableTitles

protected void writeTableTitles(OutputStream out)
                         throws IOException
Writes the table subset information. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableTitles

protected abstract void writeTableTitles(PrintWriter out)
                                  throws IOException
Writes the table subset information. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableNavigationBars

protected void writeTableNavigationBars(Writer out)
                                 throws IOException
Writes the table navigation bars if needed. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableNavigationBars

protected void writeTableNavigationBars(OutputStream out)
                                 throws IOException
Writes the table navigation bars if needed. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableNavigationBars

protected abstract void writeTableNavigationBars(PrintWriter out)
                                          throws IOException
Writes the table navigation bars if needed. If this method is overridden the developer will need to information generated by the getModelInformation method.
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs


Version: 1.2.20000317.001 Formatted: 2000/07/06 15:57:33PM