NextApp Echo
App Container 1.0.5

nextapp.echoservlet.ui
Class GridRenderingModel

java.lang.Object
  extended bynextapp.echoservlet.ui.GridRenderingModel
All Implemented Interfaces:
java.io.Serializable

final class GridRenderingModel
extends java.lang.Object
implements java.io.Serializable

A utility class used when rendering Grid components.


Nested Class Summary
private static class GridRenderingModel.FlowOrderComparator
          A comparator used to determine the order in which cells will "flow" within a grid to consume empty space.
private static class GridRenderingModel.OriginCell
          An object used to describe the origin of (top-left coordinate) of a grid cell.
private static class GridRenderingModel.PointerCell
          An object used to describe a grid coordinate that is occupied by a multi-row and/or multi-column cell, but is not the origin (top-left cell) of that cell.
 
Field Summary
static int CELL_TYPE_EMPTY
           
static int CELL_TYPE_ORIGIN
           
static int CELL_TYPE_POINTER
           
private  java.lang.Object[][] cellArray
           
private  int columnCount
           
private  int[] columnMapping
           
private  int[] columnWidths
           
private  boolean columnWidthsUsePercentUnits
           
private static GridRenderingModel.FlowOrderComparator FLOW_ORDER_COMPARATOR
           
private  nextapp.echo.Grid grid
           
private  int rowCount
           
private  int[] rowHeights
           
private  boolean rowHeightsUsePercentUnits
           
private  int[] rowMapping
           
private  boolean[] visibleColumns
           
private  boolean[] visibleRows
           
 
Constructor Summary
GridRenderingModel(nextapp.echo.Grid grid)
          Creates a GridRenderingModel for the specified Grid.
 
Method Summary
private  void flowCell(nextapp.echo.Grid.Cell cell)
          Grows cells that have a flow property set.
 nextapp.echo.Grid.Cell getCell(int column, int row)
          Returns the Grid.Cell at the specified coordinate.
 int getCellHeight()
          Returns the height of the specified cell in pixels, or EchoConstants.UNDEFINED_SIZE if it cannot be determined.
 int getCellHeight(int column, int row)
          Returns the height of the specified cell, or EchoConstants.UNDEFINED_SIZE if it cannot be determined.
 int getCellType(int column, int row)
          Returns the cell type at the specified coordinate.
 int getCellWidth(int column, int row)
          Returns the width of the specified cell, or EchoConstants.UNDEFINED_SIZE if it cannot be determined.
 int getColumnCount()
          Returns the number of columns in the rendered version of the grid.
 int getColumnSpan(int column, int row)
          Returns the column span of the cell at the specified coordinates in the rendered version of the grid.
 int getColumnWidth(int column)
          Returns the rendered width of the given column.
 int getRowCount()
          Returns the number of rows in the rendered version of the grid.
 int getRowHeight(int row)
          Returns the rendered height of the given row.
 int getRowSpan(int column, int row)
          Returns the row span of the cell at the specified coordinates in the rendered version of the grid.
private  void reduceColumns()
          Removes empty columns that are spanned across in every row of the grid.
private  void reduceRows()
          Removes empty rows that are spanned across in every column of the grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLOW_ORDER_COMPARATOR

private static final GridRenderingModel.FlowOrderComparator FLOW_ORDER_COMPARATOR

CELL_TYPE_EMPTY

public static final int CELL_TYPE_EMPTY
See Also:
Constant Field Values

CELL_TYPE_ORIGIN

public static final int CELL_TYPE_ORIGIN
See Also:
Constant Field Values

CELL_TYPE_POINTER

public static final int CELL_TYPE_POINTER
See Also:
Constant Field Values

cellArray

private java.lang.Object[][] cellArray

visibleRows

private boolean[] visibleRows

visibleColumns

private boolean[] visibleColumns

rowMapping

private int[] rowMapping

rowHeights

private int[] rowHeights

columnMapping

private int[] columnMapping

columnWidths

private int[] columnWidths

columnCount

private int columnCount

rowCount

private int rowCount

grid

private nextapp.echo.Grid grid

columnWidthsUsePercentUnits

private boolean columnWidthsUsePercentUnits

rowHeightsUsePercentUnits

private boolean rowHeightsUsePercentUnits
Constructor Detail

GridRenderingModel

public GridRenderingModel(nextapp.echo.Grid grid)
Creates a GridRenderingModel for the specified Grid.

Parameters:
grid - The Grid to be rendered.
Method Detail

flowCell

private void flowCell(nextapp.echo.Grid.Cell cell)
Grows cells that have a flow property set.

Parameters:
cell - The cell to flow. This cell must be visible.

getCell

public nextapp.echo.Grid.Cell getCell(int column,
                                      int row)
Returns the Grid.Cell at the specified coordinate. The cells position and row and column spans may have changed if the cell flow-filled up or to the left and/or rows and columns of the grid were reduced.


getCellHeight

public int getCellHeight()
Returns the height of the specified cell in pixels, or EchoConstants.UNDEFINED_SIZE if it cannot be determined.


getCellType

public int getCellType(int column,
                       int row)
Returns the cell type at the specified coordinate. The cell type may be one of the following values:


getCellHeight

public int getCellHeight(int column,
                         int row)
Returns the height of the specified cell, or EchoConstants.UNDEFINED_SIZE if it cannot be determined. Will throw IllegalArgumentException if OriginCell does not exist at specified coordinate.


getCellWidth

public int getCellWidth(int column,
                        int row)
Returns the width of the specified cell, or EchoConstants.UNDEFINED_SIZE if it cannot be determined. Will throw IllegalArgumentException if OriginCell does not exist at specified coordinate.


getColumnCount

public int getColumnCount()
Returns the number of columns in the rendered version of the grid.


getColumnSpan

public int getColumnSpan(int column,
                         int row)
Returns the column span of the cell at the specified coordinates in the rendered version of the grid.


getColumnWidth

public int getColumnWidth(int column)
Returns the rendered width of the given column.


getRowCount

public int getRowCount()
Returns the number of rows in the rendered version of the grid.


getRowHeight

public int getRowHeight(int row)
Returns the rendered height of the given row.


getRowSpan

public int getRowSpan(int column,
                      int row)
Returns the row span of the cell at the specified coordinates in the rendered version of the grid.


reduceColumns

private void reduceColumns()
Removes empty columns that are spanned across in every row of the grid. Having these columns present may confuse browsers. The appearence of the table is unchanged.


reduceRows

private void reduceRows()
Removes empty rows that are spanned across in every column of the grid. Having these rows present may confuse browsers. The appearence of the table is unchanged.


NextApp Echo
App Container 1.0.5