| org.zkoss.zul.impl.HeaderElement org.zkoss.zul.Column
Column | public class Column extends HeaderElement (Code) | | A single column in a
Columns element.
Each child of the
Column element is placed in each successive
cell of the grid.
The column with the most child elements determines the number of rows
in each column.
The use of column is mainly to define attributes for each cell
in the grid.
author: tomyeh |
Method Summary | |
public Grid | getGrid() Returns the grid that contains this column. | public String | getOuterAttrs() | public String | getSclass() Returns the style class. | public Comparator | getSortAscending() Returns the ascending sorter, or null if not available. | public Comparator | getSortDescending() Returns the descending sorter, or null if not available. | public String | getSortDirection() Returns the sort direction. | protected void | invalidateWhole() Invalidates the whole grid. | public void | onSort() It invokes
Column.sort(boolean) to sort list items and maintain
Column.getSortDirection . | public void | setParent(Component parent) | public void | setSortAscending(Comparator sorter) Sets the ascending sorter, or null for no sorter for
the ascending order. | public void | setSortAscending(String clsnm) Sets the ascending sorter with the class name, or null for
no sorter for the ascending order. | public void | setSortDescending(Comparator sorter) Sets the descending sorter, or null for no sorter for the
descending order. | public void | setSortDescending(String clsnm) Sets the descending sorter with the class name, or null for
no sorter for the descending order. | public void | setSortDirection(String sortDir) Sets the sort direction. | public boolean | sort(boolean ascending) Sorts the rows (
Row ) based on
Column.getSortAscending and
Column.getSortDescending , if
Column.getSortDirection doesn't
matches the ascending argument.
It checks
Column.getSortDirection to see whether sorting
is required, and update
Column.setSortDirection after sorted.
For example, if
Column.getSortDirection returns "ascending" and
the ascending argument is false, nothing happens.
To enforce the sorting, you can invoke
Column.setSortDirection with "natural" before invoking this method.
Alternatively, you can invoke
Column.sort(boolean,boolean) instead.
It sorts the rows by use of
Components.sort , if not live
data (i.e.,
Grid.getModel is null).
On the other hand, it invokes
ListModelExt.sort to sort
the rows, if live data (i.e.,
Grid.getModel is not null).
In other words, if you use the live data, you have to implement
ListModelExt to sort the live data explicitly.
Parameters: ascending - whether to use Column.getSortAscending.If the corresponding comparator is not set, it returns falseand does nothing. | public boolean | sort(boolean ascending, boolean force) Sorts the rows (
Row ) based on
Column.getSortAscending and
Column.getSortDescending .
Parameters: ascending - whether to use Column.getSortAscending.If the corresponding comparator is not set, it returns falseand does nothing. Parameters: force - whether to enforce the sorting no matter what the sortdirection (Column.getSortDirection) is.If false, this method is the same as Column.sort(boolean). |
getGrid | public Grid getGrid()(Code) | | Returns the grid that contains this column.
|
getSortAscending | public Comparator getSortAscending()(Code) | | Returns the ascending sorter, or null if not available.
|
getSortDescending | public Comparator getSortDescending()(Code) | | Returns the descending sorter, or null if not available.
|
getSortDirection | public String getSortDirection()(Code) | | Returns the sort direction.
Default: "natural".
|
invalidateWhole | protected void invalidateWhole()(Code) | | Invalidates the whole grid.
|
setSortAscending | public void setSortAscending(Comparator sorter)(Code) | | Sets the ascending sorter, or null for no sorter for
the ascending order.
|
setSortDescending | public void setSortDescending(Comparator sorter)(Code) | | Sets the descending sorter, or null for no sorter for the
descending order.
|
setSortDirection | public void setSortDirection(String sortDir) throws WrongValueException(Code) | | Sets the sort direction. This does not sort the data, it only serves
as an indicator as to how the grid is sorted.
If you use
Column.sort(boolean) to sort rows (
Row ),
the sort direction is maintained automatically.
If you want to sort it in customized way, you have to set the
sort direction manaully.
Parameters: sortDir - one of "ascending", "descending" and "natural" |
sort | public boolean sort(boolean ascending)(Code) | | Sorts the rows (
Row ) based on
Column.getSortAscending and
Column.getSortDescending , if
Column.getSortDirection doesn't
matches the ascending argument.
It checks
Column.getSortDirection to see whether sorting
is required, and update
Column.setSortDirection after sorted.
For example, if
Column.getSortDirection returns "ascending" and
the ascending argument is false, nothing happens.
To enforce the sorting, you can invoke
Column.setSortDirection with "natural" before invoking this method.
Alternatively, you can invoke
Column.sort(boolean,boolean) instead.
It sorts the rows by use of
Components.sort , if not live
data (i.e.,
Grid.getModel is null).
On the other hand, it invokes
ListModelExt.sort to sort
the rows, if live data (i.e.,
Grid.getModel is not null).
In other words, if you use the live data, you have to implement
ListModelExt to sort the live data explicitly.
Parameters: ascending - whether to use Column.getSortAscending.If the corresponding comparator is not set, it returns falseand does nothing. whether the rows are sorted. exception: UiException - if Grid.getModel is notnull but ListModelExt is not implemented. |
|
|