Style Intelligence v12.0

inetsoft.report
Class BaseLayout

java.lang.Object
  extended by inetsoft.report.BaseLayout
All Implemented Interfaces:
inetsoft.util.XMLSerializable, Serializable, Cloneable
Direct Known Subclasses:
FreehandLayout, TableLayout

public abstract class BaseLayout
extends Object
implements Serializable, Cloneable, inetsoft.util.XMLSerializable

BaseLayout, the data structure to manage base table layout, include regions and span.

See Also:
Serialized Form

Nested Class Summary
 class BaseLayout.Region
          Defines a region of rows.
 
Field Summary
protected  int ncol
           
protected  BaseLayout.Region[] regions
           
protected  Dimension[][] spans
           
 
Constructor Summary
BaseLayout()
           
 
Method Summary
 void addRegion(TableDataPath path, BaseLayout.Region region)
          Add a region to the layout, the region will be added to last position.
 void addRegion(TableDataPath path, int idx, BaseLayout.Region reg)
          Add a region to specified index.
 void clear()
          Clear all settings in the layout.
 Object clone()
          Make a copy of the layout.
 int convertToGlobalRow(BaseLayout.Region region, int subRow)
          Convert a row in region to layout row.
 int convertToRegionRow(int row)
          Convert a row in global row index in table layout to a special region's sub row index.
 int convertToRegionRow(int row, boolean all)
           
protected  CellBinding createCellBinding()
          Create cell binding.
 void debug()
           
 boolean equals(Object obj)
          Check if equals another object.
 boolean equals(Object obj, boolean all)
          Check if equals another object.
 boolean equalsContent(Object obj)
          Check the obj is eqauls with this object or not.
 Rectangle findSpan(int row, int col)
          Find the span cells that covers this cell.
abstract  TableDataPath fixPathForRegion(TableDataPath path)
          Fix the table data path for region data path.
 CellBinding getCellBinding(int r, int c)
          Get cell binding.
 int getColCount()
          Get the number of columns in the table layout.
 boolean[] getMergedGroup()
          Check the merge group cell option.
 BaseLayout.Region getRegion(int index)
          Get the region in the specified index.
 BaseLayout.Region getRegion(TableDataPath path)
          Get the region defined for the data path.
 int getRegionCount()
          Get region count.
 List getRegionDataPaths()
          Get all the data path that have region defined.
 TableDataPath getRegionPath(BaseLayout.Region region)
          Get the specified region's path.
 BaseLayout.Region[] getRegions()
          Get all regions defined in this layout.
 int getRowCount()
          Get row count.
 int getRowCount(boolean all)
          Get row count.
 int getRowHeight(int r)
          Get row height.
 Dimension getSpan(int r, int c)
          Get the span setting for the specified row and column.
 int getVisibleRowCount()
          Get row count, ignore the invisble region's row count.
 boolean hasCrossRegionSpan(int r, int c)
          Get the span setting for the specified row and column.
 void insertColumn(int col)
          Insert a column before the specified column.
 void insertRow(BaseLayout.Region region, int subRow)
          Insert a row to the specified region.
 void insertRow(int row)
          Insert a row above the specified row.
 BaseLayout.Region locateRegion(int row)
          Locate a region by the global row index.
 BaseLayout.Region locateRegion(TableDataPath path)
          Locate region by table data path.
 int locateRegionIndex(int row)
          Locate region index by the global row index.
 int locateRow(TableDataPath path)
          Locate row by table data path.
protected  void parseRegions(Element tag)
          Parse regions.
protected  void parseSpan(Element tag)
          Parse span.
 void removeColumn(int col)
          Remove a column.
 void removeEmptyRegions()
          Remove all empty regions (regions with zero row).
 void removeRegion(BaseLayout.Region region)
          Remove region.
 void removeRegion(TableDataPath path)
          Remove a region for a row path.
 void removeRow(BaseLayout.Region region, int subRow)
          Remove a row from a region.
 void removeRow(int row)
          Remove a row.
 void setCellBinding(int r, int c, CellBinding binding)
          Set cell binding.
 void setColCount(int ncol)
          Set the number of columns in the table layout.
 void setMergedGroup(boolean[] merge)
          Set merging group cell option.
 void setRowHeight(int r, int h)
          Set row height.
 void setSpan(int r, int c, Dimension span)
          Set the cell span setting for the cell.
 String toString()
          To string, print its data structure.
protected  void writeRegions(PrintWriter writer)
          Write regions.
protected  void writeSpan(PrintWriter writer)
          Write span.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface inetsoft.util.XMLSerializable
parseXML, writeXML
 

Field Detail

ncol

protected int ncol

regions

protected BaseLayout.Region[] regions

spans

protected Dimension[][] spans
Constructor Detail

BaseLayout

public BaseLayout()
Method Detail

removeEmptyRegions

public void removeEmptyRegions()
Remove all empty regions (regions with zero row).


getVisibleRowCount

public int getVisibleRowCount()
Get row count, ignore the invisble region's row count.


getRowCount

public int getRowCount()
Get row count.


getRowCount

public int getRowCount(boolean all)
Get row count.

Parameters:
all - include hidden regions or not.

getColCount

public int getColCount()
Get the number of columns in the table layout.


setColCount

public void setColCount(int ncol)
Set the number of columns in the table layout.


insertColumn

public void insertColumn(int col)
Insert a column before the specified column.

Parameters:
col - column index in the layout.

removeColumn

public void removeColumn(int col)
Remove a column.

Parameters:
col - column index in the layout.

insertRow

public void insertRow(int row)
Insert a row above the specified row.

Parameters:
row - row index in the layout.

insertRow

public void insertRow(BaseLayout.Region region,
                      int subRow)
Insert a row to the specified region.


removeRow

public void removeRow(int row)
Remove a row.

Parameters:
row - row index in the layout.

removeRow

public void removeRow(BaseLayout.Region region,
                      int subRow)
Remove a row from a region.


getRegionDataPaths

public List getRegionDataPaths()
Get all the data path that have region defined.


getRegionPath

public TableDataPath getRegionPath(BaseLayout.Region region)
Get the specified region's path.


getRegions

public BaseLayout.Region[] getRegions()
Get all regions defined in this layout.


addRegion

public void addRegion(TableDataPath path,
                      BaseLayout.Region region)
Add a region to the layout, the region will be added to last position.

Parameters:
path - a row data path.
region - a cell region to display the row.

addRegion

public void addRegion(TableDataPath path,
                      int idx,
                      BaseLayout.Region reg)
Add a region to specified index.


removeRegion

public void removeRegion(BaseLayout.Region region)
Remove region.


removeRegion

public void removeRegion(TableDataPath path)
Remove a region for a row path.

Parameters:
path - row data path.

getRegionCount

public int getRegionCount()
Get region count.


getRegion

public BaseLayout.Region getRegion(int index)
Get the region in the specified index.


getRegion

public BaseLayout.Region getRegion(TableDataPath path)
Get the region defined for the data path.

Parameters:
path - row data path.

locateRow

public int locateRow(TableDataPath path)
Locate row by table data path.


locateRegion

public BaseLayout.Region locateRegion(TableDataPath path)
Locate region by table data path.


locateRegion

public BaseLayout.Region locateRegion(int row)
Locate a region by the global row index.

Parameters:
row - the global row index in table layout.

locateRegionIndex

public int locateRegionIndex(int row)
Locate region index by the global row index.


convertToRegionRow

public int convertToRegionRow(int row)
Convert a row in global row index in table layout to a special region's sub row index.

Parameters:
row - the global row index in table layout.

convertToRegionRow

public int convertToRegionRow(int row,
                              boolean all)

convertToGlobalRow

public int convertToGlobalRow(BaseLayout.Region region,
                              int subRow)
Convert a row in region to layout row.


getRowHeight

public int getRowHeight(int r)
Get row height.

Parameters:
r - the global row index in the table layout.

setRowHeight

public void setRowHeight(int r,
                         int h)
Set row height.


setCellBinding

public void setCellBinding(int r,
                           int c,
                           CellBinding binding)
Set cell binding.


getCellBinding

public CellBinding getCellBinding(int r,
                                  int c)
Get cell binding.


getSpan

public Dimension getSpan(int r,
                         int c)
Get the span setting for the specified row and column.

Parameters:
r - the global row index in table layout.
c - the global column index in table layout.

hasCrossRegionSpan

public boolean hasCrossRegionSpan(int r,
                                  int c)
Get the span setting for the specified row and column.

Parameters:
r - the global row index in table layout.
c - the global column index in table layout.

setSpan

public void setSpan(int r,
                    int c,
                    Dimension span)
Set the cell span setting for the cell.

Parameters:
r - global row index.
c - global column index.
span - span.width is the number of columns, and span.height is the number of rows.

findSpan

public Rectangle findSpan(int row,
                          int col)
Find the span cells that covers this cell.

Parameters:
row - the global row index in the table layout.
col - the global column index in the table layout.
Returns:
if a span cell covers this cell, return the following:

x - negative distance to the left of the span cell.
y - negative distance to the top of the span cell.
width - number of columns to the right of the span cell, including the current column.
height - number of rows to the bottom of the span cell, including the current row.


setMergedGroup

public void setMergedGroup(boolean[] merge)
Set merging group cell option. If set, group cells of the same group are merged into one span cell.


getMergedGroup

public boolean[] getMergedGroup()
Check the merge group cell option.


clear

public void clear()
Clear all settings in the layout.


clone

public Object clone()
Make a copy of the layout.

Overrides:
clone in class Object

equals

public boolean equals(Object obj)
Check if equals another object.

Overrides:
equals in class Object
Returns:
ture if equals, false otherwise

equalsContent

public boolean equalsContent(Object obj)
Check the obj is eqauls with this object or not.


equals

public boolean equals(Object obj,
                      boolean all)
Check if equals another object.

Returns:
ture if equals, false otherwise

toString

public String toString()
To string, print its data structure.

Overrides:
toString in class Object

writeRegions

protected void writeRegions(PrintWriter writer)
Write regions.


parseRegions

protected void parseRegions(Element tag)
                     throws Exception
Parse regions.

Throws:
Exception

writeSpan

protected void writeSpan(PrintWriter writer)
Write span.


parseSpan

protected void parseSpan(Element tag)
Parse span.


fixPathForRegion

public abstract TableDataPath fixPathForRegion(TableDataPath path)
Fix the table data path for region data path.


createCellBinding

protected CellBinding createCellBinding()
Create cell binding.


debug

public void debug()

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.