silverorange Code


Swat.SwatTableViewOrderableColumn
/Swat/SwatTableViewOrderableColumn.php at line 22

Class SwatTableViewOrderableColumn

SwatObject
└─SwatUIObject
└─SwatCellRendererContainer
└─SwatTableViewColumn
└─SwatTableViewOrderableColumn

public class SwatTableViewOrderableColumn
extends SwatTableViewColumn

An orderable table view column.

This column has a clickable header that allows the user to change the ordering of the column. This behaviour is commonly used for databound table columns.

TODO: Implement this functionality with AJAX.

Copyright:
2005-2006 silverorange
License:
http://www.gnu.org/copyleft/lesser.html LGPL License 2.1

Field Summary
final mixed

ORDER_BY_DIR_ASCENDING

Indicates ascending ordering is done.

final mixed

ORDER_BY_DIR_DESCENDING

Indicates descending ordering is done.

final mixed

$ORDER_BY_DIR_NONE

Indicates no ordering is done.

string

$link

The base of the link used when building column header links.

array

$unset_get_vars

HTTP GET variables to remove from the column header link.

Fields inherited from Swat.SwatTableViewColumn
abbreviated_title, has_auto_id, id, input_cell, title, view, visible
Fields inherited from Swat.SwatCellRendererContainer
renderers
Fields inherited from Swat.SwatUIObject
classes, html_head_entry_set, parent, visible
Method Summary
void

displayHeader()

Displays the column header for this table view column.

protected array

getBaseCSSClassNames()

Gets the base CSS class names of this orderable table-view column.

string

getDirectionAsString(integer direction_id)

Gets the direction of ordering as a string.

private string

getLink()

Gets the link for this column's header.

private integer

getNextDirection()

Gets the next direction or ordering in the rotation.

void

init()

Initializes this column.

private void

initFromGetVariables()

Process GET variables and set class variables.

void

setDirection(mixed direction, $direction integer, $set_as_orderby_column boolean)

Sets the direction of ordering.

private void

setDirectionByString(string direction)

Sets direction of ordering by a string.

Methods inherited from Swat.SwatTableViewColumn
addChild, copy, display, displayHeader, displayHeaderCell, displayRenderers, displayRenderersInternal, getBaseCSSClassNames, getCSSClassNames, getDescendants, getFirstDescendant, getHtmlHeadEntrySet, getInlineJavaScript, getInputCell, getMessages, getTdAttributes, getThAttributes, getTrAttributes, getXhtmlColspan, hasHeader, hasMessage, init, process, setInputCell, setupRenderers
Methods inherited from Swat.SwatCellRendererContainer
addChild, addMappingToRenderer, addRenderer, copy, getDescendantStates, getDescendants, getFirstDescendant, getFirstRenderer, getHtmlHeadEntrySet, getRenderer, getRendererByPosition, getRendererInlineJavaScript, getRenderers, setDescendantStates
Methods inherited from Swat.SwatUIObject
addComment, addJavaScript, addStyleSheet, addTangoAttribution, copy, getCSSClassNames, getCSSClassString, getFirstAncestor, getHtmlHeadEntrySet, getInlineJavaScript, getUniqueId, isVisible

Field Detail

/Swat/SwatTableViewOrderableColumn.php at line 39

ORDER_BY_DIR_ASCENDING

public final mixed ORDER_BY_DIR_ASCENDING = 2

Indicates ascending ordering is done


/Swat/SwatTableViewOrderableColumn.php at line 34

ORDER_BY_DIR_DESCENDING

public final mixed ORDER_BY_DIR_DESCENDING = 1

Indicates descending ordering is done


/Swat/SwatTableViewOrderableColumn.php at line 29

ORDER_BY_DIR_NONE

public final mixed $ORDER_BY_DIR_NONE

Indicates no ordering is done


/Swat/SwatTableViewOrderableColumn.php at line 54
public string $link = ''

The base of the link used when building column header links

Additional GET variables are appended to this link in the getLink() method.

See Also:
SwatTableViewOrderableColumn::getLink()

/Swat/SwatTableViewOrderableColumn.php at line 63

unset_get_vars

public array $unset_get_vars = array()

HTTP GET variables to remove from the column header link

An array of GET variable names to unset before building new links.


Method Detail

/Swat/SwatTableViewOrderableColumn.php at line 150

displayHeader

public void displayHeader()

Displays the column header for this table view column

This method displays an appropriate header based on the current direction of ordering of this table view column. If the column has been ordered, an image indicating the ordering is also displayed in the header.


/Swat/SwatTableViewOrderableColumn.php at line 251

getBaseCSSClassNames

protected array getBaseCSSClassNames()

Gets the base CSS class names of this orderable table-view column

Returns:
the array of base CSS class names for this orderable table-view column.

/Swat/SwatTableViewOrderableColumn.php at line 222

getDirectionAsString

public string getDirectionAsString(integer direction_id)

Gets the direction of ordering as a string

Retrieves the current ordering direction of this column or an arbitrary direction constant as a string. The string is returned the lowercase abbreviated form 'asc' or 'desc'.

Parameters:
direction_id - an optional direction constant to convert to a string rather than using this column's current direction.
Returns:
the direction of ordering.

/Swat/SwatTableViewOrderableColumn.php at line 305

getLink

private string getLink()

Gets the link for this column's header

This method builds the link by appending special GET variables and unsetting other ones.

Returns:
the link for this column's header.

/Swat/SwatTableViewOrderableColumn.php at line 355

getNextDirection

private integer getNextDirection()

Gets the next direction or ordering in the rotation

As a user clicks on the comun headers the direction of ordering changes from NONE => ASCSENDING => DESCENDING => NONE in a loop.

Returns:
the next direction of ordering for this column.

/Swat/SwatTableViewOrderableColumn.php at line 106

init

public void init()

Initializes this column

The current direction of ordering is grabbed from GET variables.


/Swat/SwatTableViewOrderableColumn.php at line 381

initFromGetVariables

private void initFromGetVariables()

Process GET variables and set class variables


/Swat/SwatTableViewOrderableColumn.php at line 126

setDirection

public void setDirection(mixed direction, $direction integer, $set_as_orderby_column boolean)

Sets the direction of ordering

This method sets the direction of ordering of the column, either asc, desc, or none.

Parameters:
integer - One of the ORDER_BY_DIR_* class contants
boolean - Whether to set this column as the column currently used for ordering of the view

/Swat/SwatTableViewOrderableColumn.php at line 274

setDirectionByString

private void setDirectionByString(string direction)

Sets direction of ordering by a string

Sets the current ordering direction of this column.

Parameters:
direction - ordering direction as a string. The direction is case insensitive and may be the short form 'asc' or 'desc' or the long form 'ascending' or 'descending'.

silverorange Code