## P4A_Sheet

Description

Sheets is the way to manage layouts in MerliWork masks.

A sheet is rendered as an HTML table, so it is divided into cells (SHEET_CELL), every sheel cell has all HTML capabilities such as rowspan, colspan and stylesheets.

- author: Fabrizio Balliano

Located in /p4a/objects/widgets/sheet.php (line 49)

    P4A_Object
       |
       --P4A_Widget
          |
          --P4A_Sheet

Variable Summary
integer $cols
string $default_align
string $default_valign
array $grid
boolean $grid_defined
integer $last_occupied_row
integer $rows
array $rows_infos
Method Summary
P4A_Sheet P4A_Sheet (string $name)
integer addRow ([integer $rows = 1])
sheet_cell &anchor (widget &$widget, [integer $row = NULL], [integer $col = 1], [integer $rowspan = 1], [integer $colspan = 1])
sheet_cell &anchorText (string $text, [integer $row = NULL], [integer $col = 1], [integer $rowspan = 1], [integer $colspan = 1])
sheet_cell &blankRow ()
boolean checkRowOccupied (integer $row)
void defineGrid ([integer $rows = 1], [integer $cols = 1])
string getAsString ()
integer getFreeRow ()
integer getLastOccupiedRow ()
integer getNumOfCols ()
integer getNumOfRows ()
boolean isGridDefined ()
boolean isRowOccupied (integer $row)
void respan (integer $row, integer $col, [integer $rowspan = 1], [integer $colspan = 1])
void setDefaultAlign (mixed $align)
void setDefaultValign (mixed $valign)
void setFree (integer $row, integer $col)
void setLastOccupiedRow (integer $index)
void setNumOfCols (integer $cols)
void setNumOfRows (integer $rows)
void setRowFree (integer $index)
void setRowOccupied (integer $index)
Variables
integer $cols = 0 (line 85)

The number of columns in the sheet.

- access: private

string $default_align = 'left' (line 99)

The default align for sheet cells

- access: private

string $default_valign = 'top' (line 106)

The default vertical align for sheet cells

- access: private

array $grid = array() (line 56)

The grid, were all cells are stored.

- access: public

boolean $grid_defined = false (line 63)

True if the grid is already defined.

- access: private

integer $last_occupied_row = 0 (line 92)

The index of the last occupied row.

- access: private

integer $rows = 0 (line 70)

The number of rows in the sheet.

- access: private

array $rows_infos = array() (line 78)

Stores infos about sheet rows.

These infos are: occupational state etc...

- access: private

#### Inherited Variables

Inherited from P4A_Widget

> P4A_Widget::$actions
> P4A_Widget::$enabled
> P4A_Widget::$label
> P4A_Widget::$map_actions
> P4A_Widget::$properties
> P4A_Widget::$style
> P4A_Widget::$template_name
> P4A_Widget::$use_template
> P4A_Widget::$value
> P4A_Widget::$visible
> P4A_Widget::$_temp_vars

Inherited from P4A_Object

> P4A_Object::$_id
> P4A_Object::$_map_actions
> P4A_Object::$_name
> P4A_Object::$_objects
> P4A_Object::$_parent_id

Methods
Constructor P4A_Sheet (line 112)

Sheet construction does nothing but calling his parent constructor.

P4A_Sheet P4A_Sheet (string $name)

- string $name: The name of the sheet

addRow (line 342)

Add one or more rows to the sheet.

- return: The index of the first row.
- access: public

integer addRow ([integer $rows = 1])

- integer $rows: The number of rows you want to add.

anchor (line 157)

Anchors a widget to a sheet cell in the grid.

In every cell there can be ONLY ONE widged. Only the $widget param is necessary, by defaut we'll search for the first free row in sheet and, if not found, istance a new row. If the grid is not yet defined than we'll define it 1x1 cells. Default spanning is always equal to 1: 1 widget in one grid cell.

- return: The cells where the widget has been anchored.
- access: public

sheet_cell &anchor (widget &$widget, [integer $row = NULL], [integer $col = 1], [integer $rowspan = 1], [integer $colspan = 1])

- widget &$widget: The widget to be anchored.
- integer $row: The row of the anchoration.
- integer $col: The column of the anchoration.
- integer $rowspan: The number of rows the widget must occupy.
- integer $colspan: The number of colums the widget must occupy.

anchorText (line 211)

Anchors a text string to a sheet cell in the grid.

- return: The cells where the widget has been anchored.
- see: P4A_Sheet::anchor()
- access: public

sheet_cell &anchorText (string $text, [integer $row = NULL], [integer $col = 1], [integer $rowspan = 1], [integer $colspan = 1])

- string $text: The string to be anchored.
- integer $row: The row of the anchoration.
- integer $col: The column of the anchoration.
- integer $rowspan: The number of rows the widget must occupy.
- integer $colspan: The number of colums the widget must occupy.

blankRow (line 223)

Adds a row to the sheet and sets it as occupied.

During rendering phase this will generate a blank row. Returns the first cell of the row so you can use it in any way such as setting height.

sheet_cell &blankRow ()
checkRowOccupied (line 302)

Returns the occupational state of the desidered row.

The check is done scanning the row to find if a row is really occupied. This is slower than is_row_occupied but sometimes is necessary for internal use. We think you should use is_row_occupied.

- return: Occupational state of the desidered row
- access: private

boolean checkRowOccupied (integer $row)

- integer $row: The desired row

defineGrid (line 128)

Defines and istance all the sheet cells.

This operation is the same that creating an HTML table, so the entities we have are: SHEET, ROWS, COLS, CELLS.

- access: public

void defineGrid ([integer $rows = 1], [integer $cols = 1])

- integer $rows: The number of rows of the grid.
- integer $cols: The number of columns of the grid.

getAsString (line 466)

Renders the sheet in HTML string.

- return: HTML rendered sheet
- access: public

string getAsString ()

Redefinition of:

P4A_Widget::getAsString()
  Returns the HTML rendered widget.

getFreeRow (line 320)

Return the index of the first free row in sheet.

If there is a free row in the sheet returns its index else istance a new row a returns its index.

- return: The index of the first free row in sheet.
- access: public

integer getFreeRow ()
getLastOccupiedRow (line 389)

Returns the index of last occupied row.

- return: The index of the last occupied row.
- access: public

integer getLastOccupiedRow ()
getNumOfCols (line 436)

Returns the number of columns in sheet.

- return: The number of columns in sheet.
- access: public

integer getNumOfCols ()
getNumOfRows (line 379)

Returns the number of rows in the sheet.

- return: The number of rows in the sheet.
- access: public

integer getNumOfRows ()
isGridDefined (line 495)

Returns true if the grid has been defined.

- access: public

boolean isGridDefined ()
isRowOccupied (line 287)

Returns the occupational state of the desidered row.

The check is done only reading the internal occupation map so it is extremely fast.

- return: Occupational state of the desidered row
- access: public

boolean isRowOccupied (integer $row)

- integer $row: The desired row

respan (line 240)

Reinizialize the span values for a sheet cell.

For semplicity this is done by setting free the cell and than re-anchoring the widget with the new attributes.

void respan (integer $row, integer $col, [integer $rowspan = 1], [integer $colspan = 1])

- integer $row: The row index of the desidered cell.
- integer $col: The column index of the desidered cell.
- integer $rowspan: The new rowspan for the desidered cell.
- integer $colspan: The new colspan for the desidered cell.

setDefaultAlign (line 504)

Sets default align for sheet cells

- access: public

void setDefaultAlign (mixed $align)
setDefaultValign (line 513)

Sets default vertical align for sheet cells

- access: public

void setDefaultValign (mixed $valign)
setFree (line 257)

Frees a cell.

This method sets free a cell in the sheet resetting his visibility, rowspan and colspan attributes. This is done by calling the method set_free (internal of the sheet cell) for every cell that the one we are setting free occupied.

- access: public

void setFree (integer $row, integer $col)

- integer $row: The row index.
- integer $col: The column index.

setLastOccupiedRow (line 406)

Sets the index of the last occupied row.

This is a private method.

- access: private

void setLastOccupiedRow (integer $index)

- integer $index: The index of the row.

setNumOfCols (line 456)

Sets the number of columns in the sheet.

- access: private

void setNumOfCols (integer $cols)

- integer $cols: The desired row

setNumOfRows (line 446)

Sets the number of rows in the sheet.

- access: private

void setNumOfRows (integer $rows)

- integer $rows: The number of rows in the sheet

setRowFree (line 426)

Marks a row as free.

- access: private

void setRowFree (integer $index)

- integer $index: The index of the row

setRowOccupied (line 416)

Marks a row as occupied.

- access: private

void setRowOccupied (integer $index)

- integer $index: The index of the row

#### Inherited Methods

Inherited From P4A_Widget

> P4A_Widget::addAction()
> P4A_Widget::addTempVar()
> P4A_Widget::changeEvent()
> P4A_Widget::clearTemplateVars()
> P4A_Widget::clearTempVars()
> P4A_Widget::composeStringActions()
> P4A_Widget::composeStringClassStyle()
> P4A_Widget::composeStringProperties()
> P4A_Widget::composeStringStyle()
> P4A_Widget::disable()
> P4A_Widget::display()
> P4A_Widget::dropAction()
> P4A_Widget::dropTempVar()
> P4A_Widget::enable()
> P4A_Widget::fetchTemplate()
> P4A_Widget::getAccessKey()
> P4A_Widget::getAsString()
> P4A_Widget::getHeight()
> P4A_Widget::getLabel()
> P4A_Widget::getProperty()
> P4A_Widget::getStyleProperty()
> P4A_Widget::getValue()
> P4A_Widget::getWidth()
> P4A_Widget::isEnabled()
> P4A_Widget::isVisible()
> P4A_Widget::onChange()
> P4A_Widget::onClick()
> P4A_Widget::onKeyPress()
> P4A_Widget::onMouseOver()
> P4A_Widget::onReturnPress()
> P4A_Widget::p4a_widget()
> P4A_Widget::raise()
> P4A_Widget::requireConfirmation()
> P4A_Widget::setAccessKey()
> P4A_Widget::setBgcolor()
> P4A_Widget::setBgimage()
> P4A_Widget::setDefaultLabel()
> P4A_Widget::setFontColor()
> P4A_Widget::setFontWeight()
> P4A_Widget::setHeight()
> P4A_Widget::setInvisible()
> P4A_Widget::setLabel()
> P4A_Widget::setProperty()
> P4A_Widget::setStyleProperty()
> P4A_Widget::setValue()
> P4A_Widget::setVisible()
> P4A_Widget::setWidth()
> P4A_Widget::unrequireConfirmation()
> P4A_Widget::unsetProperty()
> P4A_Widget::unsetStyleProperty()
> P4A_Widget::useTemplate()

Inherited From P4A_Object

> P4A_Object::actionHandler()
> P4A_Object::build()
> P4A_Object::destroy()
> P4A_Object::errorHandler()
> P4A_Object::getId()
> P4A_Object::getName()
> P4A_Object::getObjectType()
> P4A_Object::getParentID()
> P4A_Object::implementMethod()
> P4A_Object::intercept()
> P4A_Object::isActionTriggered()
> P4A_Object::p4a_object()
> P4A_Object::setName()
> P4A_Object::setParentID()
> P4A_Object::void()

Documentation generated on Fri, 26 May 2006 12:43:32 +0200 by phpDocumentor 1.3.0RC5