@Override public Memento save(ResourceSetCollector resourceSetCollector) { Memento state = new Memento(); state.setValue(MEMENTO_DATE, getCenterVisibleDate()); state.setValue(MEMENTO_ZOOM_PREFIX + 0, getMainBandZoomIndex()); state.setValue(MEMENTO_ZOOM_PREFIX + 1, getOverviewBandZoomIndex()); return state; }
@Override public void restore( Memento state, PersistableRestorationService restorationService, ResourceSetAccessor accessor) { setMainBandZoomIndex((Integer) state.getValue(MEMENTO_ZOOM_PREFIX + 0)); setOverviewBandZoomIndex((Integer) state.getValue(MEMENTO_ZOOM_PREFIX + 1)); // IMPORTANT: set date *AFTER* zoom restored setCenterVisibleDate((Date) state.getValue(MEMENTO_DATE)); }