net.sf.jasperreports.engine.export
Class JRGridLayout

java.lang.Object
  extended by net.sf.jasperreports.engine.export.JRGridLayout

public class JRGridLayout
extends java.lang.Object

Utility class used by grid exporters to create a grid for page layout.

Version:
$Id: JRGridLayout.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Nested Class Summary
protected static class JRGridLayout.BoxKey
           
static interface JRGridLayout.ExporterElements
           
protected static class JRGridLayout.SortedList
           
 
Field Summary
static JRGridLayout.ExporterElements NO_IMAGES_EXPORTER
           
static JRGridLayout.ExporterElements TEXT_EXPORTER
           
static JRGridLayout.ExporterElements UNIVERSAL_EXPORTER
           
 
Constructor Summary
JRGridLayout(java.util.List elements, java.util.List alterYs, int width, int height, int offsetX, int offsetY, JRGridLayout.ExporterElements elementsExporter, boolean deep, boolean spanCells, boolean setElementIndexes, java.lang.Integer[] initialIndex)
          Constructor.
 
Method Summary
protected  void createCuts(java.util.List elementsList, java.util.List alterYList, int elementOffsetX, int elementOffsetY)
           
protected  void createFrameCuts(JRPrintFrame frame, int x0, int y0)
           
protected  java.lang.Integer[] getElementIndex(int elementIndex, java.lang.Integer[] parentElements)
           
 JRExporterGridCell[][] getGrid()
          Returns the constructed element grid.
 boolean[] getIsColumnNotEmpty()
          Returns an array containing for each grid column a flag set to true if the column is not empty.
 boolean[] getIsRowNotEmpty()
          Returns an array containing for each grid row a flag set to true if the row is not empty.
static int getRowHeight(JRExporterGridCell[] row)
           
static int getRowHeight(JRExporterGridCell[][] grid, int rowIdx)
           
 int getWidth()
          Returns the width available for the grid.
 java.util.List getXCuts()
          Returns the list of cut points on the X axis for the grid.
 java.util.List getYCuts()
          Returns the list of cut points on the Y axis for the grid.
protected  boolean isOverlap(int x1, int y1, int x2, int y2)
           
protected  void layoutGrid()
          Constructs the element grid.
protected  void setFrameCellsStyle(JRPrintFrame frame, int x1, int x2, int y1, int y2)
           
protected  void setFrameGridElements(JRPrintFrame frame, int x0, int y0, int elementIndex, java.lang.Integer[] parentIndexes)
           
protected  void setGridElement(JRPrintElement element, int x1, int y1, int x2, int y2, int elementIndex, java.lang.Integer[] parentElements)
           
protected  void setGridElements(java.util.List elementsList, java.util.List alterYList, int elementOffsetX, int elementOffsetY, java.lang.Integer[] parentIndexes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIVERSAL_EXPORTER

public static final JRGridLayout.ExporterElements UNIVERSAL_EXPORTER

NO_IMAGES_EXPORTER

public static final JRGridLayout.ExporterElements NO_IMAGES_EXPORTER

TEXT_EXPORTER

public static final JRGridLayout.ExporterElements TEXT_EXPORTER
Constructor Detail

JRGridLayout

public JRGridLayout(java.util.List elements,
                    java.util.List alterYs,
                    int width,
                    int height,
                    int offsetX,
                    int offsetY,
                    JRGridLayout.ExporterElements elementsExporter,
                    boolean deep,
                    boolean spanCells,
                    boolean setElementIndexes,
                    java.lang.Integer[] initialIndex)
Constructor.

Parameters:
elements - the elements that should arranged in a grid
alterYs - list of modified Y element coordinates
width - the width available for the grid
height - the height available for the grid
offsetX - horizontal element position offset
offsetY - vertical element position offset
elementsExporter - implementation of ExporterElements used to decide which elements to skip during grid creation
deep - whether to include in the grid sub elements of frame elements
spanCells - whether the exporter handles cells span
setElementIndexes - whether to set element indexes
initialIndex - initial element index
Method Detail

layoutGrid

protected void layoutGrid()
Constructs the element grid.


createCuts

protected void createCuts(java.util.List elementsList,
                          java.util.List alterYList,
                          int elementOffsetX,
                          int elementOffsetY)

createFrameCuts

protected void createFrameCuts(JRPrintFrame frame,
                               int x0,
                               int y0)

setGridElements

protected void setGridElements(java.util.List elementsList,
                               java.util.List alterYList,
                               int elementOffsetX,
                               int elementOffsetY,
                               java.lang.Integer[] parentIndexes)

isOverlap

protected boolean isOverlap(int x1,
                            int y1,
                            int x2,
                            int y2)

setGridElement

protected void setGridElement(JRPrintElement element,
                              int x1,
                              int y1,
                              int x2,
                              int y2,
                              int elementIndex,
                              java.lang.Integer[] parentElements)

getElementIndex

protected java.lang.Integer[] getElementIndex(int elementIndex,
                                              java.lang.Integer[] parentElements)

setFrameGridElements

protected void setFrameGridElements(JRPrintFrame frame,
                                    int x0,
                                    int y0,
                                    int elementIndex,
                                    java.lang.Integer[] parentIndexes)

setFrameCellsStyle

protected void setFrameCellsStyle(JRPrintFrame frame,
                                  int x1,
                                  int x2,
                                  int y1,
                                  int y2)

getGrid

public JRExporterGridCell[][] getGrid()
Returns the constructed element grid.

Returns:
the constructed element grid

getIsRowNotEmpty

public boolean[] getIsRowNotEmpty()
Returns an array containing for each grid row a flag set to true if the row is not empty.

Returns:
array of non empty flags for grid rows

getIsColumnNotEmpty

public boolean[] getIsColumnNotEmpty()
Returns an array containing for each grid column a flag set to true if the column is not empty.

Returns:
array of non empty flags for grid columns

getXCuts

public java.util.List getXCuts()
Returns the list of cut points on the X axis for the grid.

Returns:
the list of cut points on the X axis for the grid

getYCuts

public java.util.List getYCuts()
Returns the list of cut points on the Y axis for the grid.

Returns:
the list of cut points on the X axis for the grid

getWidth

public int getWidth()
Returns the width available for the grid.

Returns:
the width available for the grid

getRowHeight

public static int getRowHeight(JRExporterGridCell[][] grid,
                               int rowIdx)

getRowHeight

public static int getRowHeight(JRExporterGridCell[] row)


© 2001-2006 JasperSoft Corporation www.jaspersoft.com