Get zoom from session in company Gantt 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
abe2313b69
commit
ee7c6d708a
1 changed files with 30 additions and 3 deletions
|
|
@ -233,13 +233,13 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
addPrintSupport(configuration);
|
||||
disableSomeFeatures(configuration);
|
||||
|
||||
ZoomLevel defaultZoomLevel = OrderPlanningModel
|
||||
.calculateDefaultLevel(configuration);
|
||||
planner.setInitialZoomLevel(defaultZoomLevel);
|
||||
planner.setInitialZoomLevel(getZoomLevel(configuration));
|
||||
|
||||
configuration.setSecondLevelModificators(BankHolidaysMarker.create(getDefaultCalendar()));
|
||||
planner.setConfiguration(configuration);
|
||||
|
||||
setupZoomLevelListener(planner);
|
||||
|
||||
if(expandPlanningViewChart) {
|
||||
//if the chart is expanded, we load the data now
|
||||
setupChartAndItsContent(planner, chartComponent);
|
||||
|
|
@ -266,6 +266,33 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
}
|
||||
}
|
||||
|
||||
private ZoomLevel getZoomLevel(
|
||||
PlannerConfiguration<TaskElement> configuration) {
|
||||
ZoomLevel sessionZoom = (ZoomLevel) Sessions.getCurrent().getAttribute(
|
||||
"zoomLevel");
|
||||
if (sessionZoom != null) {
|
||||
return sessionZoom;
|
||||
}
|
||||
return OrderPlanningModel.calculateDefaultLevel(configuration);
|
||||
}
|
||||
|
||||
private void setupZoomLevelListener(Planner planner) {
|
||||
planner.getTimeTracker().addZoomListener(getSessionZoomLevelListener());
|
||||
}
|
||||
|
||||
private IZoomLevelChangedListener getSessionZoomLevelListener() {
|
||||
IZoomLevelChangedListener zoomListener = new IZoomLevelChangedListener() {
|
||||
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
Sessions.getCurrent().setAttribute("zoomLevel", detailLevel);
|
||||
}
|
||||
};
|
||||
|
||||
keepAliveZoomListeners.add(zoomListener);
|
||||
return zoomListener;
|
||||
}
|
||||
|
||||
private BaseCalendar getDefaultCalendar() {
|
||||
return configurationDAO.getConfiguration().getDefaultCalendar();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue