Get zoom from session in advanced allocation view
Add a listener in order to update the value in the session when user changes the zoom. FEA: ItEr77S15FilteringEnhancements
This commit is contained in:
parent
3d1bb5b5c8
commit
a6153296b9
4 changed files with 32 additions and 19 deletions
|
|
@ -25,11 +25,12 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.web.planner.allocation.AdvancedAllocationController;
|
||||
import org.libreplan.web.planner.allocation.AllocationResult;
|
||||
import org.libreplan.web.planner.allocation.AdvancedAllocationController.AllocationInput;
|
||||
import org.libreplan.web.planner.allocation.AdvancedAllocationController.IAdvanceAllocationResultReceiver;
|
||||
import org.libreplan.web.planner.allocation.AdvancedAllocationController.IBack;
|
||||
import org.libreplan.web.planner.allocation.AllocationResult;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -54,20 +55,23 @@ public class ViewSwitcher implements Composer {
|
|||
isInPlanningOrder = true;
|
||||
}
|
||||
|
||||
public void goToAdvancedAllocation(AllocationResult allocationResult,
|
||||
public void goToAdvancedAllocation(Order order,
|
||||
AllocationResult allocationResult,
|
||||
IAdvanceAllocationResultReceiver resultReceiver) {
|
||||
planningOrder = ComponentsReplacer.replaceAllChildren(parent,
|
||||
"advance_allocation.zul", createArgsForAdvancedAllocation(
|
||||
allocationResult, resultReceiver));
|
||||
planningOrder = ComponentsReplacer.replaceAllChildren(
|
||||
parent,
|
||||
"advance_allocation.zul",
|
||||
createArgsForAdvancedAllocation(order, allocationResult,
|
||||
resultReceiver));
|
||||
isInPlanningOrder = false;
|
||||
}
|
||||
|
||||
private Map<String, Object> createArgsForAdvancedAllocation(
|
||||
private Map<String, Object> createArgsForAdvancedAllocation(Order order,
|
||||
AllocationResult allocationResult,
|
||||
IAdvanceAllocationResultReceiver resultReceiver) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("advancedAllocationController",
|
||||
new AdvancedAllocationController(createBack(),
|
||||
new AdvancedAllocationController(order, createBack(),
|
||||
asAllocationInput(allocationResult, resultReceiver)));
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import org.apache.commons.lang.Validate;
|
|||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.Period;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.planner.entities.AggregateOfResourceAllocations;
|
||||
import org.libreplan.business.planner.entities.AssignmentFunction;
|
||||
import org.libreplan.business.planner.entities.AssignmentFunction.AssignmentFunctionName;
|
||||
|
|
@ -56,6 +57,7 @@ import org.libreplan.business.planner.entities.TaskElement;
|
|||
import org.libreplan.business.resources.entities.Criterion;
|
||||
import org.libreplan.business.workingday.EffortDuration;
|
||||
import org.libreplan.web.common.EffortDurationBox;
|
||||
import org.libreplan.web.common.FilterUtils;
|
||||
import org.libreplan.web.common.IMessagesForUser;
|
||||
import org.libreplan.web.common.MessagesForUser;
|
||||
import org.libreplan.web.common.OnlyOneVisible;
|
||||
|
|
@ -377,24 +379,29 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
private Listbox advancedAllocationHorizontalPagination;
|
||||
private Listbox advancedAllocationVerticalPagination;
|
||||
|
||||
private boolean fixedZoomByUser = false;
|
||||
private ZoomLevel zoomLevel;
|
||||
|
||||
public AdvancedAllocationController(IBack back,
|
||||
private Order order;
|
||||
|
||||
public AdvancedAllocationController(Order order, IBack back,
|
||||
List<AllocationInput> allocationInputs) {
|
||||
setInputData(back, allocationInputs);
|
||||
setInputData(order, back, allocationInputs);
|
||||
}
|
||||
|
||||
private void setInputData(IBack back, List<AllocationInput> allocationInputs) {
|
||||
private void setInputData(Order order, IBack back,
|
||||
List<AllocationInput> allocationInputs) {
|
||||
Validate.notNull(order);
|
||||
Validate.notNull(back);
|
||||
Validate.noNullElements(allocationInputs);
|
||||
this.order = order;
|
||||
this.back = back;
|
||||
this.allocationInputs = allocationInputs;
|
||||
}
|
||||
|
||||
public void reset(IBack back, List<AllocationInput> allocationInputs) {
|
||||
public void reset(Order order, IBack back,
|
||||
List<AllocationInput> allocationInputs) {
|
||||
rowsCached = null;
|
||||
setInputData(back, allocationInputs);
|
||||
setInputData(order, back, allocationInputs);
|
||||
loadAndInitializeComponents();
|
||||
}
|
||||
|
||||
|
|
@ -576,7 +583,8 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
private void createComponents() {
|
||||
timeTracker = new TimeTracker(addMarginTointerval(), self);
|
||||
paginatorFilter = new PaginatorFilter();
|
||||
if (fixedZoomByUser && (zoomLevel != null)) {
|
||||
zoomLevel = FilterUtils.readZoomLevel(order);
|
||||
if (zoomLevel != null) {
|
||||
timeTracker.setZoomLevel(zoomLevel);
|
||||
}
|
||||
paginatorFilter.setZoomLevel(timeTracker.getDetailLevel());
|
||||
|
|
@ -588,7 +596,7 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
timeTracker.addZoomListener(new IZoomLevelChangedListener() {
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
fixedZoomByUser = true;
|
||||
FilterUtils.writeZoomLevel(order, detailLevel);
|
||||
zoomLevel = detailLevel;
|
||||
|
||||
paginatorFilter.setZoomLevel(detailLevel);
|
||||
|
|
|
|||
|
|
@ -264,7 +264,8 @@ public class AdvancedAllocationTabCreator {
|
|||
|
||||
private Map<String, Object> argsWithController(PlanningState planningState) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
advancedAllocationController = new AdvancedAllocationController(onBack,
|
||||
advancedAllocationController = new AdvancedAllocationController(
|
||||
planningState.getOrder(), onBack,
|
||||
createAllocationInputsFor(planningState));
|
||||
result.put("advancedAllocationController", advancedAllocationController);
|
||||
return result;
|
||||
|
|
@ -297,7 +298,7 @@ public class AdvancedAllocationTabCreator {
|
|||
}
|
||||
|
||||
private void resetController(PlanningState planningState) {
|
||||
advancedAllocationController.reset(onBack,
|
||||
advancedAllocationController.reset(planningState.getOrder(), onBack,
|
||||
createAllocationInputsFor(planningState));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ public class AdvancedAllocationTaskController extends GenericForwardComposer {
|
|||
return;
|
||||
}
|
||||
|
||||
getSwitcher().goToAdvancedAllocation(allocationResult,
|
||||
createResultReceiver(allocationResult));
|
||||
getSwitcher().goToAdvancedAllocation(planningState.getOrder(),
|
||||
allocationResult, createResultReceiver(allocationResult));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue