Move zoomLevel session management to FilterUtils
FEA: ItEr77S15FilteringEnhancements
This commit is contained in:
parent
880f51704a
commit
0f548e6e73
3 changed files with 26 additions and 8 deletions
|
|
@ -24,7 +24,9 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.web.common.components.finders.FilterPair;
|
||||
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
|
||||
import org.zkoss.zk.ui.Sessions;
|
||||
|
||||
/**
|
||||
|
|
@ -149,4 +151,22 @@ public class FilterUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static ZoomLevel readZoomLevel() {
|
||||
return (ZoomLevel) Sessions.getCurrent().getAttribute("zoomLevel");
|
||||
}
|
||||
|
||||
public static void writeZoomLevel(ZoomLevel zoomLevel) {
|
||||
Sessions.getCurrent().setAttribute("zoomLevel", zoomLevel);
|
||||
}
|
||||
|
||||
public static ZoomLevel readZoomLevel(Order order) {
|
||||
return (ZoomLevel) Sessions.getCurrent().getAttribute(
|
||||
order.getCode() + "-zoomLevel");
|
||||
}
|
||||
|
||||
public static void writeZoomLevel(Order order, ZoomLevel zoomLevel) {
|
||||
Sessions.getCurrent().setAttribute(order.getCode() + "-zoomLevel",
|
||||
zoomLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ import org.libreplan.business.scenarios.IScenarioManager;
|
|||
import org.libreplan.business.scenarios.entities.Scenario;
|
||||
import org.libreplan.business.users.daos.IUserDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.web.common.FilterUtils;
|
||||
import org.libreplan.web.common.components.finders.FilterPair;
|
||||
import org.libreplan.web.common.components.finders.TaskGroupFilterEnum;
|
||||
import org.libreplan.web.planner.TaskElementAdapter;
|
||||
|
|
@ -268,8 +269,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
|
||||
private ZoomLevel getZoomLevel(
|
||||
PlannerConfiguration<TaskElement> configuration) {
|
||||
ZoomLevel sessionZoom = (ZoomLevel) Sessions.getCurrent().getAttribute(
|
||||
"zoomLevel");
|
||||
ZoomLevel sessionZoom = FilterUtils.readZoomLevel();
|
||||
if (sessionZoom != null) {
|
||||
return sessionZoom;
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
Sessions.getCurrent().setAttribute("zoomLevel", detailLevel);
|
||||
FilterUtils.writeZoomLevel(detailLevel);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ import org.libreplan.business.users.entities.UserRole;
|
|||
import org.libreplan.business.workingday.EffortDuration;
|
||||
import org.libreplan.web.calendars.BaseCalendarModel;
|
||||
import org.libreplan.web.common.ConfirmCloseUtil;
|
||||
import org.libreplan.web.common.FilterUtils;
|
||||
import org.libreplan.web.common.ViewSwitcher;
|
||||
import org.libreplan.web.planner.adaptplanning.IAdaptPlanningCommand;
|
||||
import org.libreplan.web.planner.advances.AdvanceAssignmentPlanningController;
|
||||
|
|
@ -123,7 +124,6 @@ import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
|
|||
import org.zkoss.ganttz.util.Interval;
|
||||
import org.zkoss.ganttz.util.ProfilingLogFactory;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.Sessions;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
|
@ -406,8 +406,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
|
||||
private ZoomLevel getZoomLevel(
|
||||
PlannerConfiguration<TaskElement> configuration, Order order) {
|
||||
ZoomLevel sessionZoom = (ZoomLevel) Sessions.getCurrent().getAttribute(
|
||||
order.getCode() + "-zoomLevel");
|
||||
ZoomLevel sessionZoom = FilterUtils.readZoomLevel(order);
|
||||
if (sessionZoom != null) {
|
||||
return sessionZoom;
|
||||
}
|
||||
|
|
@ -425,8 +424,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
Sessions.getCurrent().setAttribute(
|
||||
order.getCode() + "-zoomLevel", detailLevel);
|
||||
FilterUtils.writeZoomLevel(order, detailLevel);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue