ItEr48S15CUFiltradoNaPlanificacionItEr47S17: Showing feedback to user when launches the filtering process.

This commit is contained in:
Manuel Rego Casasnovas 2010-02-17 09:10:04 +01:00 committed by Javier Moran Rua
parent bf8f5675ab
commit 2d435f20e4
2 changed files with 30 additions and 11 deletions

View file

@ -50,7 +50,9 @@ import org.zkoss.ganttz.extensions.ICommand;
import org.zkoss.ganttz.extensions.IContext;
import org.zkoss.ganttz.resourceload.ScriptsRequiredByResourceLoadPanel;
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
import org.zkoss.ganttz.util.LongOperationFeedback;
import org.zkoss.ganttz.util.OnZKDesktopRegistry;
import org.zkoss.ganttz.util.LongOperationFeedback.ILongOperation;
import org.zkoss.ganttz.util.script.IScriptsRegister;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.WrongValueException;
@ -197,18 +199,34 @@ public class OrderPlanningController implements Composer {
}
private void filterByPredicate(final OrderElementPredicate predicate) {
model.forceLoadLabelsAndCriterionRequirements();
LongOperationFeedback.execute(orderElementFilter, new ILongOperation() {
final IContext<?> context = planner.getContext();
planner.setTaskListPredicate(new FilterAndParentExpandedPredicates(context) {
@Override
public boolean accpetsFilterPredicate(Task task) {
if (predicate == null) {
return true;
}
TaskElement taskElement = (TaskElement) context.getMapper()
.findAssociatedDomainObject(task);
return predicate.accepts(taskElement.getOrderElement());
public void doAction() throws Exception {
model.forceLoadLabelsAndCriterionRequirements();
final IContext<?> context = planner.getContext();
planner
.setTaskListPredicate(new FilterAndParentExpandedPredicates(
context) {
@Override
public boolean accpetsFilterPredicate(Task task) {
if (predicate == null) {
return true;
}
TaskElement taskElement = (TaskElement) context
.getMapper()
.findAssociatedDomainObject(task);
return predicate.accepts(taskElement
.getOrderElement());
}
});
}
@Override
public String getName() {
return _("filtering");
}
});

View file

@ -10,7 +10,8 @@
<datebox id="filterFinishDateOrderElement" constraint = "@{treeController.checkConstraintFinishDate}"
width="65px" />
<label value="${i18n:_('name')}"/>
<textbox id="filterNameOrderElement" width="50px" />
<textbox id="filterNameOrderElement" width="50px"
onOK="treeController.onApplyFilter()" />
<button label="${i18n:_('Filter')}" style="margin-top: -4px"
tooltiptext="${i18n:_('Apply filtering to order elements satisfying required critera')}"
onClick="treeController.onApplyFilter()"/>