org.eclipse.emf.emfstore.internal.client.ui.views.historybrowserview
Class PaginationManager

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.client.ui.views.historybrowserview.PaginationManager

public class PaginationManager
extends Object

Class handling pagination. See constructor PaginationManager(ProjectSpace, EObject, int, int)

Author:
Aumann

Constructor Summary
PaginationManager(ProjectSpace projectSpace, org.eclipse.emf.ecore.EObject modelElement, int aboveCenterCount, int belowCenterCount)
          Creates a new PaginationManager with given page range around the central version.
 
Method Summary
 void nextPage()
          Swaps to the next page.
 void previousPage()
          Swaps to the previous page.
 List<HistoryInfo> retrieveHistoryInfos()
           
 void setShowAllVersions(boolean allVersions)
          Allows to switch between showing all history info items (across all branches) or just those relevant to the current project branch.
 boolean setVersion(int id)
          Swaps to a page containing the specified version.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaginationManager

public PaginationManager(ProjectSpace projectSpace,
                         org.eclipse.emf.ecore.EObject modelElement,
                         int aboveCenterCount,
                         int belowCenterCount)
Creates a new PaginationManager with given page range around the central version. The central version is initialized to be the base version. Note that the real number of versions shown might be smaller if there are not enough versions above (e.g. base version == head version) or below the center version (e.g. only x revisions yet, but below is larger).

Parameters:
projectSpace - The project space to operate on.
modelElement - An optional modelElement to show the history for. null to show the history for the project space.
aboveCenterCount - The number of versions shown above the central version.
belowCenterCount - The number of versions shown below the central version.
Method Detail

retrieveHistoryInfos

public List<HistoryInfo> retrieveHistoryInfos()
                                       throws ESException
Returns:
The history info objects to be displayed on the current page.
Throws:
ESException - If an exception gets thrown contacting the server.

setShowAllVersions

public void setShowAllVersions(boolean allVersions)
Allows to switch between showing all history info items (across all branches) or just those relevant to the current project branch.

Parameters:
allVersions - if true versions across all branches are shown, otherwise only versions for the current branch including ancestor versions

nextPage

public void nextPage()
Swaps to the next page. Call retrieveHistoryInfos() to retrieve the new page.


previousPage

public void previousPage()
Swaps to the previous page. Call retrieveHistoryInfos() to retrieve the new page.


setVersion

public boolean setVersion(int id)
                   throws ESException
Swaps to a page containing the specified version. Call retrieveHistoryInfos() to retrieve the new page.

Parameters:
id - The identifier of the version to display.
Returns:
true if a version range surrounding the id has been found, false otherwise. Note that the range does not necessarily contain the id, for example if only versions for a certain branch are shown.
Throws:
ESException - When an error occurs while retrieving versions from the server.


Copyright © 2015. All Rights Reserved.