NextApp Echo2
v2.1.1

nextapp.echo2.webcontainer.syncpeer
Class GridProcessor

java.lang.Object
  extended by nextapp.echo2.webcontainer.syncpeer.GridProcessor

public class GridProcessor
extends java.lang.Object

Provides analysis of a Grid for rendering purposes.

This object defines the Grid in terms of two axes, "x" and "y". The axes are transposed based on whether the origin property of the Grid is horizontal or vertical. For horizontally-oriented Grids, the x-axis represents columns and the y-axis represents rows. For vertically oriented Grids, the x-axis represents rows and the y-axis represents columns.

Once a GridProcessor has been instantiated, the rendering GridPeer can make inquiries to it to determine how the HTML table representing the Grid should be rendered.

Upon instantiation, the dimensions of the grid are calculated, and the content of each cell within those dimensions is determined. By specifying an "x" and "y" coordinate to various getXXX() methods, the renderer can determine what Component exists at a particular coordinate, how many rows and columns that Component spans, and the index of the Component within its parent Grid's children.

This class should not be extended or used by classes outside of the Echo framework.


Constructor Summary
GridProcessor(nextapp.echo2.app.Grid grid)
          Creates a new GridProcessor for the specified Grid.
 
Method Summary
 int getColumnCount()
          Returns the number of columns that should be rendered.
 int getColumnSpan(int column, int row)
          Returns the column span of the cell at the specified rendered index.
 nextapp.echo2.app.Extent getColumnWidth(int column)
          Returns the width of the specified column index
 int getComponentIndex(int column, int row)
          Returns the index of the Component that should be rendered at the specified position within its parent Grid container.
 nextapp.echo2.app.Component getContent(int column, int row)
          Returns the Component that should be rendered at the specified position.
 int getRowCount()
          Returns the number of rows that should be rendered.
 nextapp.echo2.app.Extent getRowHeight(int row)
          Returns the height of the specified row index
 int getRowSpan(int column, int row)
          Returns the row span of the cell at the specified rendered index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridProcessor

public GridProcessor(nextapp.echo2.app.Grid grid)
Creates a new GridProcessor for the specified Grid. Creating a new GridProcessor will cause immediately analyze the Grid which will immediately consume processor and memory resources. Such operations should be done at most once per rendering.

Parameters:
grid - the Grid
Method Detail

getContent

public nextapp.echo2.app.Component getContent(int column,
                                              int row)
Returns the Component that should be rendered at the specified position.

Parameters:
column - the column index
row - the row index
Returns:
the Component (may be null)

getComponentIndex

public int getComponentIndex(int column,
                             int row)
Returns the index of the Component that should be rendered at the specified position within its parent Grid container.

Parameters:
column - the column index
row - the row index
Returns:
the index of the Component within its container.

getColumnCount

public int getColumnCount()
Returns the number of columns that should be rendered.

Returns:
the number of rendered columns

getRowCount

public int getRowCount()
Returns the number of rows that should be rendered.

Returns:
the number of rendered rows

getColumnWidth

public nextapp.echo2.app.Extent getColumnWidth(int column)
Returns the width of the specified column index

Parameters:
column - the column index
Returns:
the width

getRowHeight

public nextapp.echo2.app.Extent getRowHeight(int row)
Returns the height of the specified row index

Parameters:
row - the row index
Returns:
the height

getColumnSpan

public int getColumnSpan(int column,
                         int row)
Returns the column span of the cell at the specified rendered index.

Parameters:
column - the column index
row - the row index
Returns:
the column span (-1 will be returned in the event that no cell exists at the specified index)

getRowSpan

public int getRowSpan(int column,
                      int row)
Returns the row span of the cell at the specified rendered index.

Parameters:
column - the column index
row - the row index
Returns:
the row span (-1 will be returned in the event that no cell exists at the specified index)

NextApp Echo2
v2.1.1