use of org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder in project midpoint by Evolveum.
the class TableHeadersToolbar method newSortableHeader.
@Override
protected WebMarkupContainer newSortableHeader(String headerId, final String property, final ISortStateLocator locator) {
IDataProvider provider = getTable().getDataProvider();
if (provider instanceof BaseSortableDataProvider) {
BaseSortableDataProvider sortableDataProvider = (BaseSortableDataProvider) provider;
if (sortableDataProvider.isOrderingDisabled()) {
return new WebMarkupContainer(headerId);
}
}
return new AjaxFallbackOrderByBorder(headerId, property, locator) {
@Override
protected void onSortChanged() {
getTable().setCurrentPage(0);
}
@Override
protected void onAjaxClick(AjaxRequestTarget target) {
refreshTable(target);
}
@Override
public void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
ISortState sortState = locator.getSortState();
SortOrder dir = sortState.getPropertySortOrder(property);
String cssClass;
if (dir == SortOrder.ASCENDING) {
cssClass = "sortable asc";
} else if (dir == SortOrder.DESCENDING) {
cssClass = "sortable desc";
} else {
cssClass = "sortable";
}
if (!Strings.isEmpty(cssClass)) {
tag.append("class", cssClass, " ");
}
}
};
}
Aggregations