| org.zkoss.zul.impl.HeaderElement org.zkoss.zul.Listheader
Listheader | public class Listheader extends HeaderElement (Code) | | The list header which defines the attributes and header of a columen
of a list box.
Its parent must be
Listhead .
Difference from XUL:
- There is no listcol in ZUL because it is merged into
Listheader .
Reason: easier to write Listbox.
author: tomyeh |
Method Summary | |
public Object | clone() | public String | getColumnHtmlPrefix() Returns the prefix of the first column (in HTML tags), null if this
is not first column. | public int | getColumnIndex() Returns the column index, starting from 0. | public Listbox | getListbox() Returns the listbox that this belongs to. | public Listhead | getListhead() Returns the listhead that this belongs to. | public int | getMaxlength() Returns the maximal length of each item's label. | 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 box. | public void | onSort() It invokes
Listheader.sort(boolean) to sort list items and maintain
Listheader.getSortDirection . | public void | setMaxlength(int maxlength) Sets the maximal length of each item's label. | public void | setParent(Component parent) | public void | setSort(String type) Sets the type of the sorter. | 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 list items based on
Listheader.getSortAscending and
Listheader.getSortDescending , if
Listheader.getSortDirection doesn't
matches the ascending argument.
It checks
Listheader.getSortDirection to see whether sorting
is required, and update
Listheader.setSortDirection after sorted.
For example, if
Listheader.getSortDirection returns "ascending" and
the ascending argument is false, nothing happens.
To enforce the sorting, you can invoke
Listheader.setSortDirection with "natural" before invoking this method.
Alternatively, you can invoke
Listheader.sort(boolean,boolean) instead.
It sorts the listitem by use of
Components.sort data (i.e.,
Grid.getModel is null).
On the other hand, it invokes
ListModelExt.sort to sort
the list item, if live data (i.e.,
Listbox.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 Listheader.getSortAscending.If the corresponding comparator is not set, it returns falseand does nothing. | public boolean | sort(boolean ascending, boolean force) Sorts the list items based on
Listheader.getSortAscending and
Listheader.getSortDescending .
Parameters: ascending - whether to use Listheader.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 (Listheader.getSortDirection) is.If false, this method is the same as Listheader.sort(boolean). |
Listheader | public Listheader()(Code) | | |
getColumnHtmlPrefix | public String getColumnHtmlPrefix()(Code) | | Returns the prefix of the first column (in HTML tags), null if this
is not first column. Called only by listheader.dsp.
since: 3.0.1 |
getColumnIndex | public int getColumnIndex()(Code) | | Returns the column index, starting from 0.
|
getListbox | public Listbox getListbox()(Code) | | Returns the listbox that this belongs to.
|
getListhead | public Listhead getListhead()(Code) | | Returns the listhead that this belongs to.
|
getMaxlength | public int getMaxlength()(Code) | | Returns the maximal length of each item's label.
Default: 0 (no limit).
|
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 box.
|
setMaxlength | public void setMaxlength(int maxlength)(Code) | | Sets the maximal length of each item's label.
|
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 list is sorted.
If you use
Listheader.sort(boolean) to sort list items,
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 list items based on
Listheader.getSortAscending and
Listheader.getSortDescending , if
Listheader.getSortDirection doesn't
matches the ascending argument.
It checks
Listheader.getSortDirection to see whether sorting
is required, and update
Listheader.setSortDirection after sorted.
For example, if
Listheader.getSortDirection returns "ascending" and
the ascending argument is false, nothing happens.
To enforce the sorting, you can invoke
Listheader.setSortDirection with "natural" before invoking this method.
Alternatively, you can invoke
Listheader.sort(boolean,boolean) instead.
It sorts the listitem by use of
Components.sort data (i.e.,
Grid.getModel is null).
On the other hand, it invokes
ListModelExt.sort to sort
the list item, if live data (i.e.,
Listbox.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 Listheader.getSortAscending.If the corresponding comparator is not set, it returns falseand does nothing. whether the list items are sorted. exception: UiException - if Listbox.getModel is notnull but ListModelExt is not implemented. |
|
|