From c6b490df652417af3edc7bb5c8c9264d52a66b26 Mon Sep 17 00:00:00 2001 From: Susana Montes Pedreira Date: Wed, 14 Apr 2010 18:08:50 +0200 Subject: [PATCH] ItEr53S14CUVistaRecursosTempoPorProxectoItEr49S16 : fix the filter of the resource load screen. Now the selected filter is consistent with the showed information and the zoom level is maintained. --- .../resourceload/ResourcesLoadPanel.java | 20 +++++++++--- .../web/ganttz/zul/resourcesLoadLayout.zul | 8 ++--- .../resourceload/ResourceLoadController.java | 31 +++++++++++++------ 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java index a6239f493..5980f369a 100644 --- a/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java +++ b/ganttzk/src/main/java/org/zkoss/ganttz/resourceload/ResourcesLoadPanel.java @@ -73,9 +73,9 @@ public class ResourcesLoadPanel extends HtmlMacroComponent { private Listbox listZoomLevels; - private static final String filterResources = _("Filter by resources"); - private static final String filterCriterions = _("Filter by criterions"); - private boolean filterbyResources = true; + private static final String filterResources = _("by resources"); + private static final String filterCriterions = _("by criterions"); + private Boolean filterbyResources; public ResourcesLoadPanel(List groups, TimeTracker timeTracker) { @@ -104,10 +104,11 @@ public class ResourcesLoadPanel extends HtmlMacroComponent { } else { this.filterbyResources = false; } + onApplyFilter(); } public boolean getFilter() { - return filterbyResources; + return (filterbyResources == null) ? true : filterbyResources; } public void onApplyFilter() { @@ -142,12 +143,22 @@ public class ResourcesLoadPanel extends HtmlMacroComponent { public void add(final IToolbarCommand... commands) { Component toolbar = getToolbar(); + resetToolbar(toolbar); Separator separator = getSeparator(); for (IToolbarCommand c : commands) { toolbar.insertBefore(asButton(c), separator); } } + private void resetToolbar(Component toolbar) { + List children = toolbar.getChildren(); + List