public abstract class AbstractDocumentViewModel extends java.lang.Object implements DocumentViewModel
The AbstractDocumentViewModel is responsible for keeping the state of the documetn view. The AbstractDocumentViewModel also stores an list of PageViewComponetnts who's state is update as the model changes. The AbstractDocumentViewModel can be swapped into different page views quickly and efficently.
DocumentViewModelImpl| Modifier and Type | Field and Description |
|---|---|
protected AnnotationComponent |
currentAnnotation |
protected org.icepdf.core.pobjects.Document |
currentDocument |
protected int |
currentPageIndex |
protected static int |
MAX_PAGE_SIZE_READ_AHEAD |
protected int |
oldPageIndex |
protected float |
oldUserRotation |
protected int |
oldUserToolModeFlag |
protected float |
oldUserZoom |
protected int |
pageBoundary |
protected java.util.List<AbstractPageViewComponent> |
pageComponents |
protected UndoCaretaker |
undoCaretaker |
protected float |
userRotation |
protected int |
userToolModeFlag |
protected float |
userZoom |
DISPLAY_TOOL_CIRCLE_ANNOTATION, DISPLAY_TOOL_FREE_TEXT_ANNOTATION, DISPLAY_TOOL_HIGHLIGHT_ANNOTATION, DISPLAY_TOOL_INK_ANNOTATION, DISPLAY_TOOL_LINE_ANNOTATION, DISPLAY_TOOL_LINE_ARROW_ANNOTATION, DISPLAY_TOOL_LINK_ANNOTATION, DISPLAY_TOOL_NONE, DISPLAY_TOOL_PAN, DISPLAY_TOOL_SELECTION, DISPLAY_TOOL_SQUARE_ANNOTATION, DISPLAY_TOOL_SQUIGGLY_ANNOTATION, DISPLAY_TOOL_STRIKEOUT_ANNOTATION, DISPLAY_TOOL_TEXT_ANNOTATION, DISPLAY_TOOL_TEXT_SELECTION, DISPLAY_TOOL_UNDERLINE_ANNOTATION, DISPLAY_TOOL_WAIT, DISPLAY_TOOL_ZOOM_DYNAMIC, DISPLAY_TOOL_ZOOM_IN, DISPLAY_TOOL_ZOOM_OUT| Constructor and Description |
|---|
AbstractDocumentViewModel(org.icepdf.core.pobjects.Document currentDocument) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMemento(org.icepdf.core.Memento oldMementoState,
org.icepdf.core.Memento newMementoState)
Adds memento state to the care taker.
|
void |
addSelectedPageText(AbstractPageViewComponent pageViewComponent)
Adds the specified page to selected page cache.
|
void |
clearSelectedPageText()
Clears cache used to store which pages have selected state.
|
void |
dispose()
Free resources associated with this model.
|
UndoCaretaker |
getAnnotationCareTaker()
Gets annotation caretaker responsible for saving states as defined
by the momento pattern.
|
AnnotationComponent |
getCurrentAnnotation()
Gets the currently selected annotation in the document model.
|
javax.swing.Timer |
getDirtyTimer()
Get an instance of the dirty Timer use by all child PageComponents.
|
org.icepdf.core.pobjects.Document |
getDocument()
Gets the PDF document object associated with this views.
|
int |
getPageBoundary()
Gets the page boundry used to paint document pages.
|
java.awt.Rectangle |
getPageBounds(int pageIndex)
Gets the page bound of the specified page Index.
|
java.util.List<AbstractPageViewComponent> |
getPageComponents()
Gets the page components associated with this view model.
|
java.util.ArrayList<java.lang.ref.WeakReference<AbstractPageViewComponent>> |
getSelectedPageText()
Gets the list of components that have a selected state.
|
int |
getViewCurrentPageIndex()
Gets the current page index represented in this model.
|
float |
getViewRotation()
Returns the zoom factor of the page visualization.
|
int |
getViewToolMode()
Gets the tool mode.
|
float |
getViewZoom()
Gets the view model zoom level.
|
void |
invalidate()
Invalidate the underlying Document Page models.
|
boolean |
isSelectAll()
Gets the selected all state of the doucment pages view.
|
boolean |
isViewToolModeSelected(int viewToolMode)
Checks if the specified tool mode is set in the view model.
|
void |
setCurrentAnnotation(AnnotationComponent currentAnnotation)
Sets the current annotation.
|
void |
setPageBoundary(int pageBoundary)
Sets the page boundtry used to paint a page.
|
void |
setSelectAll(boolean selectAll)
Sets the select all state of the text in the document.
|
boolean |
setViewCurrentPageIndex(int pageIndex)
Sets the view model current page index.
|
boolean |
setViewRotation(float viewRotation)
Sets the view rotaiton of this model.
|
boolean |
setViewToolMode(int viewToolMode)
Sets the view tool mode.
|
boolean |
setViewZoom(float viewZoom)
Sets the zoom factor of the page visualization.
|
protected org.icepdf.core.pobjects.Document currentDocument
protected java.util.List<AbstractPageViewComponent> pageComponents
protected UndoCaretaker undoCaretaker
protected AnnotationComponent currentAnnotation
protected float userZoom
protected float oldUserZoom
protected float userRotation
protected float oldUserRotation
protected int currentPageIndex
protected int oldPageIndex
protected int pageBoundary
protected int userToolModeFlag
protected int oldUserToolModeFlag
protected static final int MAX_PAGE_SIZE_READ_AHEAD
public AbstractDocumentViewModel(org.icepdf.core.pobjects.Document currentDocument)
public org.icepdf.core.pobjects.Document getDocument()
DocumentViewModelgetDocument in interface DocumentViewModelpublic java.util.List<AbstractPageViewComponent> getPageComponents()
DocumentViewModelgetPageComponents in interface DocumentViewModelpublic boolean setViewCurrentPageIndex(int pageIndex)
DocumentViewModelsetViewCurrentPageIndex in interface DocumentViewModelpageIndex - zero based current pages page index of the document.public int getViewCurrentPageIndex()
DocumentViewModelgetViewCurrentPageIndex in interface DocumentViewModelpublic java.util.ArrayList<java.lang.ref.WeakReference<AbstractPageViewComponent>> getSelectedPageText()
getSelectedPageText in interface DocumentViewModelpublic boolean isSelectAll()
isSelectAll in interface DocumentViewModelpublic void setSelectAll(boolean selectAll)
setSelectAll in interface DocumentViewModelselectAll - to to specify all text is selected, false to sepcify
no text is selectedpublic void addSelectedPageText(AbstractPageViewComponent pageViewComponent)
addSelectedPageText in interface DocumentViewModelpageViewComponent - pageview component to add to list.public void clearSelectedPageText()
clearSelectedPageText in interface DocumentViewModelpublic boolean setViewZoom(float viewZoom)
setViewZoom in interface DocumentViewModelviewZoom - zoom factorpublic void invalidate()
invalidate in interface DocumentViewModelpublic float getViewZoom()
DocumentViewModelgetViewZoom in interface DocumentViewModelpublic boolean setViewRotation(float viewRotation)
DocumentViewModelsetViewRotation in interface DocumentViewModelviewRotation - rotation in degreespublic float getViewRotation()
getViewRotation in interface DocumentViewModelpublic boolean setViewToolMode(int viewToolMode)
DocumentViewModelsetViewToolMode in interface DocumentViewModelviewToolMode - selected tool mode, pan, zoom and et.public int getViewToolMode()
DocumentViewModelgetViewToolMode in interface DocumentViewModelpublic boolean isViewToolModeSelected(int viewToolMode)
DocumentViewModelisViewToolModeSelected in interface DocumentViewModelviewToolMode - tool model to check if selected.public void setPageBoundary(int pageBoundary)
setPageBoundary in interface DocumentViewModelpageBoundary - page boundspublic int getPageBoundary()
DocumentViewModelgetPageBoundary in interface DocumentViewModelpublic java.awt.Rectangle getPageBounds(int pageIndex)
DocumentViewModelgetPageBounds in interface DocumentViewModelpageIndex - zero based page index.public void dispose()
DocumentViewModeldispose in interface DocumentViewModelpublic AnnotationComponent getCurrentAnnotation()
getCurrentAnnotation in interface DocumentViewModelpublic void setCurrentAnnotation(AnnotationComponent currentAnnotation)
setCurrentAnnotation in interface DocumentViewModelcurrentAnnotation - annotation to make current.public UndoCaretaker getAnnotationCareTaker()
public void addMemento(org.icepdf.core.Memento oldMementoState,
org.icepdf.core.Memento newMementoState)
DocumentViewModeladdMemento in interface DocumentViewModeloldMementoState - origional state.newMementoState - new state.public javax.swing.Timer getDirtyTimer()
DocumentViewModelgetDirtyTimer in interface DocumentViewModel