Sort the list of resources and triggers the sort after refreshing it.

FEA: ItEr77S10ResourceAllocationLoadInformation
This commit is contained in:
Javier Moran Rua 2012-10-13 17:36:43 +02:00 committed by Manuel Rego Casasnovas
parent c90fd3aaed
commit 95c044afee
2 changed files with 12 additions and 1 deletions

View file

@ -75,6 +75,7 @@ import org.zkoss.zul.Treecell;
import org.zkoss.zul.Treeitem;
import org.zkoss.zul.TreeitemRenderer;
import org.zkoss.zul.Treerow;
import org.zkoss.zul.api.Listheader;
/**
* Controller for searching for {@link Resource}.
@ -287,6 +288,16 @@ public class NewAllocationSelectorController extends
private void refreshListBoxResources(
List<ResourceWithItsLoadRatios> resources) {
listBoxResources.setModel(new SimpleListModel(resources));
triggerSortListBoxResources();
}
private void triggerSortListBoxResources() {
for (Object child : listBoxResources.getListhead().getChildren()) {
final Listheader hd = (Listheader) child;
if (!"natural".equals(hd.getSortDirection())) {
hd.sort("ascending".equals(hd.getSortDirection()), true);
}
}
}
private void returnToSpecificDueToResourceSelection() {

View file

@ -78,7 +78,7 @@
<listhead>
<listheader label="${i18n:_('Found resources')}"
tooltiptext="${i18n:_('Resources matching selected criteria')}"
sort="auto"/>
sort="auto" sortDirection="ascending"/>
<listheader label="${i18n:_('Availability')}" hflex="min"/>
<listheader label="${i18n:_('Overtime')}" hflex="min"/>
</listhead>