Package org.eclipse.birt.report.model.api.elements.table

# Class LayoutUtil

java.lang.Object
org.eclipse.birt.report.model.api.elements.table.LayoutUtil

public class LayoutUtil extends Object
The utility class for `LayoutTable`.

## Constructor Summary

Constructors
Constructor
Description
`LayoutUtil()`

## Method Summary

Modifier and Type
Method
Description
`static org.eclipse.birt.report.model.elements.ReportItem`
`getCompoundContainer(IDesignElement element)`
Returns a nearest `TableItem/GridItem` container for `TableRow`, `TableGroup` and `TableItem` if applicable.
`static int`
`getEffectiveColumnSpan(CellHandle cell)`
Returns the effective column span of the given cell.
`static int`
`getEffectiveRowSpan(CellHandle cell)`
Returns the effective row span of the given cell.
`protected static List`
`getFlattenedLayoutSlots(LayoutTable table)`
Returns flattern slots of the layout table regardless GROUP/Table slots.
`protected static int`
`getRowCount(LayoutTable table)`
Calculates the row number in the table.
`static boolean`
`isValidLayout(org.eclipse.birt.report.model.elements.GridItem grid, org.eclipse.birt.report.model.core.Module module)`
Checks whether the layout grid is valid or not.
`static boolean`
`isValidLayout(org.eclipse.birt.report.model.elements.TableItem table, org.eclipse.birt.report.model.core.Module module)`
Checks whether the layout table is valid or not.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LayoutUtil

public LayoutUtil()

## Method Details

### getRowCount

protected static int getRowCount(LayoutTable table)
Calculates the row number in the table.

Parameters:
  `table` - the layout table
Returns:
  the row number in the table

### getFlattenedLayoutSlots

protected static List getFlattenedLayoutSlots(LayoutTable table)
Returns flattern slots of the layout table regardless GROUP/Table slots.

Parameters:
  `table` - the layout table
Returns:
  a list containing flattern slots

### getEffectiveColumnSpan

public static int getEffectiveColumnSpan(CellHandle cell)
Returns the effective column span of the given cell.

Parameters:
  `cell` - the cell to find
Returns:
  the 1-based effective column span of the given cell. 0 means the cell is in the table element but it do not show in the layout.

### getEffectiveRowSpan

public static int getEffectiveRowSpan(CellHandle cell)
Returns the effective row span of the given cell.

Parameters:
  `cell` - the cell to find
Returns:
  the 1-based effective row span of the given cell. 0 means the cell is in the table element but it do not show in the layout.

### getCompoundContainer

public static org.eclipse.birt.report.model.elements.ReportItem getCompoundContainer(IDesignElement element)
Returns a nearest `TableItem/GridItem` container for `TableRow`, `TableGroup` and `TableItem` if applicable.

If `TableRow` is in the `GridItem`, return `null`.

Parameters:
  `element` - the element where the search begins
Returns:
  a nearest `TableItem/GridItem` container

### isValidLayout

public static boolean isValidLayout(org.eclipse.birt.report.model.elements.GridItem grid, org.eclipse.birt.report.model.core.Module module)
Checks whether the layout grid is valid or not. The invalid grid has following cases:

- column count bigger than zero.
- no repeat value bigger than one in column slot

Parameters:
  `grid` - the table
  `module` - the root of the table
Returns:
  `true` if the table is valid. Otherwise `false`.

### isValidLayout

public static boolean isValidLayout(org.eclipse.birt.report.model.elements.TableItem table, org.eclipse.birt.report.model.core.Module module)
Checks whether the layout table is valid or not. The invalid table has following cases:

- has overlapped area.
- column counts in rows are different.
- empty rows and columns.

Parameters:
  `table` - the table
  `module` - the root of the table
Returns:
  `true` if the table is valid. Otherwise `false`.