org.icepdf.ri.common.views
Class DocumentViewControllerImpl

java.lang.Object
  extended by org.icepdf.ri.common.views.DocumentViewControllerImpl
All Implemented Interfaces:
java.awt.event.ComponentListener, java.util.EventListener, org.icepdf.core.views.DocumentViewController

public class DocumentViewControllerImpl
extends java.lang.Object
implements org.icepdf.core.views.DocumentViewController, java.awt.event.ComponentListener

The DocumentViewControllerImpl is responsible for controlling the four default view models specified by the PDF specification. This class is used associated with the SwingController, but all view specific control is passed to this class.

Since:
2.5

Field Summary
protected  org.icepdf.core.AnnotationCallback annotationCallback
           
static java.awt.Color backgroundColor
           
protected  java.beans.PropertyChangeSupport changes
           
protected  int oldViewportFitMode
           
protected  int oldViewportHeight
           
protected  int oldViewportWidth
           
protected  int oldViewType
           
static int ONE_COLUMN_VIEW
          Displays a the pages in one column.
static int ONE_PAGE_VIEW
          Displays a one page at a time view.
static float ROTATION_FACTOR
          Rotation factor used with rotating document.
protected  org.icepdf.core.SecurityCallback securityCallback
           
static int TWO_COLUMN_LEFT_VIEW
          Displays the pages in two columns, with odd-numbered pages on the left.
static int TWO_COLUMN_RIGHT_VIEW
          Displays the pages in two columns, with even-numbered pages on the left.
static int TWO_PAGE_LEFT_VIEW
          Displays the pages two at a time, with odd-numbered pages on the left.
static int TWO_PAGE_RIGHT_VIEW
          Displays the pages two at a time, with event-numbered pages on the left.
protected  SwingController viewerController
           
protected  int viewportFitMode
           
protected  int viewportHeight
           
protected  int viewportWidth
           
protected  int viewType
           
static float ZOOM_FACTOR
          Zoom factor used when zooming in or out.
 
Fields inherited from interface org.icepdf.core.views.DocumentViewController
CURSOR_DEFAULT, CURSOR_HAND_ANNOTATION, CURSOR_HAND_CLOSE, CURSOR_HAND_OPEN, CURSOR_SELECT, CURSOR_TEXT_SELECTION, CURSOR_WAIT, CURSOR_ZOOM_IN, CURSOR_ZOOM_OUT, PAGE_FIT_ACTUAL_SIZE, PAGE_FIT_NONE, PAGE_FIT_WINDOW_HEIGHT, PAGE_FIT_WINDOW_WIDTH
 
Constructor Summary
DocumentViewControllerImpl(SwingController viewerController)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void assignSelectedAnnotation(org.icepdf.core.views.swing.AnnotationComponentImpl annotationComponent)
           
 void clearHighlightedText()
          Clear highlighted text in all pages that make up the current document
 void clearSelectedAnnotations()
           
 void clearSelectedText()
          Clear selected text in all pages that make up the current document
 void closeDocument()
           
 void componentHidden(java.awt.event.ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void componentMoved(java.awt.event.ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void componentResized(java.awt.event.ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void componentShown(java.awt.event.ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void deleteCurrentAnnotation()
           
 void dispose()
           
 void firePropertyChange(java.lang.String event, int oldValue, int newValue)
           
 void firePropertyChange(java.lang.String event, java.lang.Object oldValue, java.lang.Object newValue)
          Fires property change events for Page view UI changes such as: focus gained/lost annotation state change such as move or resize new annotation crreated, currently only for new link annotations
 org.icepdf.core.AnnotationCallback getAnnotationCallback()
          Gets the annotation callback.
 int getCurrentPageDisplayValue()
           
 int getCurrentPageIndex()
           
 org.icepdf.core.pobjects.Document getDocument()
           
 org.icepdf.core.views.DocumentView getDocumentView()
           
 org.icepdf.core.views.DocumentViewModel getDocumentViewModel()
           
 int getFitMode()
           
 java.awt.Adjustable getHorizontalScrollBar()
           
 org.icepdf.core.Controller getParentController()
           
 float getRotation()
          Returns the zoom factor of the page visualization.
 org.icepdf.core.SecurityCallback getSecurityCallback()
          Gets the security callback.
 java.lang.String getSelectedText()
           
 int getToolMode()
           
 java.awt.Adjustable getVerticalScrollBar()
           
 java.awt.Container getViewContainer()
          The controller will own the scrollpane and will insert different views into it.
 java.awt.Cursor getViewCursor(int currsorType)
           
 int getViewMode()
           
 float getZoom()
           
 float[] getZoomLevels()
           
 boolean isToolModeSelected(int viewToolMode)
           
 void redo()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void requestViewFocusInWindow()
           
 void selectAllText()
          Sets the selectall status flag as true.
 void setAnnotationCallback(org.icepdf.core.AnnotationCallback annotationCallback)
          Set an annotation callback.
 boolean setCurrentPageIndex(int pageIndex)
           
 int setCurrentPageNext()
           
 int setCurrentPagePrevious()
           
 void setDestinationTarget(org.icepdf.core.pobjects.Destination destination)
           
 void setDocument(org.icepdf.core.pobjects.Document newDocument)
           
 void setDocumentViewType(int documentView, int fitMode)
           
 boolean setFitMode(int fitMode)
           
 float setRotateLeft()
           
 float setRotateRight()
           
 boolean setRotation(float viewRotation)
           
 void setSecurityCallback(org.icepdf.core.SecurityCallback securityCallback)
           
 boolean setToolMode(int viewToolMode)
           
 void setViewCursor(int currsorType)
           
 void setViewKeyListener(java.awt.event.KeyListener l)
           
 void setViewType(int documentViewType)
          View Builder for known doc view types
 boolean setZoom(float viewZoom)
          Sets the zoom factor of the page visualization.
 boolean setZoomIn()
           
 boolean setZoomIn(java.awt.Point p)
          Increases the current page visualization zoom factor by 20%.
 void setZoomLevels(float[] zoomLevels)
           
 boolean setZoomOut()
           
 boolean setZoomOut(java.awt.Point p)
          Decreases the current page visualization zoom factor by 20%.
 void undo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONE_PAGE_VIEW

public static final int ONE_PAGE_VIEW
Displays a one page at a time view.

See Also:
Constant Field Values

ONE_COLUMN_VIEW

public static final int ONE_COLUMN_VIEW
Displays a the pages in one column.

See Also:
Constant Field Values

TWO_PAGE_LEFT_VIEW

public static final int TWO_PAGE_LEFT_VIEW
Displays the pages two at a time, with odd-numbered pages on the left.

See Also:
Constant Field Values

TWO_COLUMN_LEFT_VIEW

public static final int TWO_COLUMN_LEFT_VIEW
Displays the pages in two columns, with odd-numbered pages on the left.

See Also:
Constant Field Values

TWO_PAGE_RIGHT_VIEW

public static final int TWO_PAGE_RIGHT_VIEW
Displays the pages two at a time, with event-numbered pages on the left.

See Also:
Constant Field Values

TWO_COLUMN_RIGHT_VIEW

public static final int TWO_COLUMN_RIGHT_VIEW
Displays the pages in two columns, with even-numbered pages on the left.

See Also:
Constant Field Values

ZOOM_FACTOR

public static final float ZOOM_FACTOR
Zoom factor used when zooming in or out.

See Also:
Constant Field Values

ROTATION_FACTOR

public static final float ROTATION_FACTOR
Rotation factor used with rotating document.

See Also:
Constant Field Values

backgroundColor

public static java.awt.Color backgroundColor

viewportWidth

protected int viewportWidth

oldViewportWidth

protected int oldViewportWidth

viewportHeight

protected int viewportHeight

oldViewportHeight

protected int oldViewportHeight

viewType

protected int viewType

oldViewType

protected int oldViewType

viewportFitMode

protected int viewportFitMode

oldViewportFitMode

protected int oldViewportFitMode

viewerController

protected SwingController viewerController

annotationCallback

protected org.icepdf.core.AnnotationCallback annotationCallback

securityCallback

protected org.icepdf.core.SecurityCallback securityCallback

changes

protected java.beans.PropertyChangeSupport changes
Constructor Detail

DocumentViewControllerImpl

public DocumentViewControllerImpl(SwingController viewerController)
Method Detail

getDocument

public org.icepdf.core.pobjects.Document getDocument()
Specified by:
getDocument in interface org.icepdf.core.views.DocumentViewController

setDocument

public void setDocument(org.icepdf.core.pobjects.Document newDocument)
Specified by:
setDocument in interface org.icepdf.core.views.DocumentViewController

closeDocument

public void closeDocument()
Specified by:
closeDocument in interface org.icepdf.core.views.DocumentViewController

getHorizontalScrollBar

public java.awt.Adjustable getHorizontalScrollBar()
Specified by:
getHorizontalScrollBar in interface org.icepdf.core.views.DocumentViewController

getVerticalScrollBar

public java.awt.Adjustable getVerticalScrollBar()
Specified by:
getVerticalScrollBar in interface org.icepdf.core.views.DocumentViewController

setAnnotationCallback

public void setAnnotationCallback(org.icepdf.core.AnnotationCallback annotationCallback)
Set an annotation callback.

Specified by:
setAnnotationCallback in interface org.icepdf.core.views.DocumentViewController
Parameters:
annotationCallback - annotation callback associated with this document view.

setSecurityCallback

public void setSecurityCallback(org.icepdf.core.SecurityCallback securityCallback)
Specified by:
setSecurityCallback in interface org.icepdf.core.views.DocumentViewController

clearSelectedAnnotations

public void clearSelectedAnnotations()
Specified by:
clearSelectedAnnotations in interface org.icepdf.core.views.DocumentViewController

assignSelectedAnnotation

public void assignSelectedAnnotation(org.icepdf.core.views.swing.AnnotationComponentImpl annotationComponent)
Specified by:
assignSelectedAnnotation in interface org.icepdf.core.views.DocumentViewController

clearSelectedText

public void clearSelectedText()
Clear selected text in all pages that make up the current document

Specified by:
clearSelectedText in interface org.icepdf.core.views.DocumentViewController

clearHighlightedText

public void clearHighlightedText()
Clear highlighted text in all pages that make up the current document

Specified by:
clearHighlightedText in interface org.icepdf.core.views.DocumentViewController

selectAllText

public void selectAllText()
Sets the selectall status flag as true. Text selection requires that a pages content has been parsed and can be quite expensive for long documents. The page component will pick up on this plag and paint the selected state. If the content is copied to the clipboard we go thought he motion of parsing every page.

Specified by:
selectAllText in interface org.icepdf.core.views.DocumentViewController

getSelectedText

public java.lang.String getSelectedText()
Specified by:
getSelectedText in interface org.icepdf.core.views.DocumentViewController

getAnnotationCallback

public org.icepdf.core.AnnotationCallback getAnnotationCallback()
Gets the annotation callback.

Specified by:
getAnnotationCallback in interface org.icepdf.core.views.DocumentViewController
Returns:
annotation callback associated with this document.

getSecurityCallback

public org.icepdf.core.SecurityCallback getSecurityCallback()
Gets the security callback.

Specified by:
getSecurityCallback in interface org.icepdf.core.views.DocumentViewController
Returns:
security callback associated with this document.

getDocumentView

public org.icepdf.core.views.DocumentView getDocumentView()

setViewKeyListener

public void setViewKeyListener(java.awt.event.KeyListener l)
Specified by:
setViewKeyListener in interface org.icepdf.core.views.DocumentViewController

setDestinationTarget

public void setDestinationTarget(org.icepdf.core.pobjects.Destination destination)
Specified by:
setDestinationTarget in interface org.icepdf.core.views.DocumentViewController

dispose

public void dispose()
Specified by:
dispose in interface org.icepdf.core.views.DocumentViewController

getViewContainer

public java.awt.Container getViewContainer()
The controller will own the scrollpane and will insert different views into it.

Specified by:
getViewContainer in interface org.icepdf.core.views.DocumentViewController

getParentController

public org.icepdf.core.Controller getParentController()
Specified by:
getParentController in interface org.icepdf.core.views.DocumentViewController

getViewMode

public int getViewMode()
Specified by:
getViewMode in interface org.icepdf.core.views.DocumentViewController

setViewType

public void setViewType(int documentViewType)
View Builder for known doc view types

Specified by:
setViewType in interface org.icepdf.core.views.DocumentViewController
Parameters:
documentViewType - view type,

setFitMode

public boolean setFitMode(int fitMode)
Specified by:
setFitMode in interface org.icepdf.core.views.DocumentViewController

getFitMode

public int getFitMode()
Specified by:
getFitMode in interface org.icepdf.core.views.DocumentViewController

setDocumentViewType

public void setDocumentViewType(int documentView,
                                int fitMode)
Specified by:
setDocumentViewType in interface org.icepdf.core.views.DocumentViewController

setCurrentPageIndex

public boolean setCurrentPageIndex(int pageIndex)
Specified by:
setCurrentPageIndex in interface org.icepdf.core.views.DocumentViewController

setCurrentPageNext

public int setCurrentPageNext()
Specified by:
setCurrentPageNext in interface org.icepdf.core.views.DocumentViewController

setCurrentPagePrevious

public int setCurrentPagePrevious()
Specified by:
setCurrentPagePrevious in interface org.icepdf.core.views.DocumentViewController

getCurrentPageIndex

public int getCurrentPageIndex()
Specified by:
getCurrentPageIndex in interface org.icepdf.core.views.DocumentViewController

getCurrentPageDisplayValue

public int getCurrentPageDisplayValue()
Specified by:
getCurrentPageDisplayValue in interface org.icepdf.core.views.DocumentViewController

getZoomLevels

public float[] getZoomLevels()
Specified by:
getZoomLevels in interface org.icepdf.core.views.DocumentViewController

setZoomLevels

public void setZoomLevels(float[] zoomLevels)
Specified by:
setZoomLevels in interface org.icepdf.core.views.DocumentViewController

setZoom

public boolean setZoom(float viewZoom)
Sets the zoom factor of the page visualization. A zoom factor of 1.0f is equal to 100% or actual size. A zoom factor of 0.5f is equal to 50% of the original size.

Specified by:
setZoom in interface org.icepdf.core.views.DocumentViewController
Parameters:
viewZoom - zoom factor
Returns:
if zoom actually changed

setZoomIn

public boolean setZoomIn()
Specified by:
setZoomIn in interface org.icepdf.core.views.DocumentViewController

setZoomOut

public boolean setZoomOut()
Specified by:
setZoomOut in interface org.icepdf.core.views.DocumentViewController

getZoom

public float getZoom()
Specified by:
getZoom in interface org.icepdf.core.views.DocumentViewController

getRotation

public float getRotation()
Returns the zoom factor of the page visualization. A zoom factor of 1.0f is equal to 100% or actual size. A zoom factor of 0.5f is equal to 50% of the original size.

Specified by:
getRotation in interface org.icepdf.core.views.DocumentViewController
Returns:
zoom factor

setRotateRight

public float setRotateRight()
Specified by:
setRotateRight in interface org.icepdf.core.views.DocumentViewController

setRotateLeft

public float setRotateLeft()
Specified by:
setRotateLeft in interface org.icepdf.core.views.DocumentViewController

setRotation

public boolean setRotation(float viewRotation)
Specified by:
setRotation in interface org.icepdf.core.views.DocumentViewController

setToolMode

public boolean setToolMode(int viewToolMode)
Specified by:
setToolMode in interface org.icepdf.core.views.DocumentViewController

isToolModeSelected

public boolean isToolModeSelected(int viewToolMode)
Specified by:
isToolModeSelected in interface org.icepdf.core.views.DocumentViewController

getToolMode

public int getToolMode()
Specified by:
getToolMode in interface org.icepdf.core.views.DocumentViewController

setViewCursor

public void setViewCursor(int currsorType)
Specified by:
setViewCursor in interface org.icepdf.core.views.DocumentViewController

getViewCursor

public java.awt.Cursor getViewCursor(int currsorType)
Specified by:
getViewCursor in interface org.icepdf.core.views.DocumentViewController

requestViewFocusInWindow

public void requestViewFocusInWindow()
Specified by:
requestViewFocusInWindow in interface org.icepdf.core.views.DocumentViewController

setZoomIn

public boolean setZoomIn(java.awt.Point p)
Increases the current page visualization zoom factor by 20%.

Specified by:
setZoomIn in interface org.icepdf.core.views.DocumentViewController
Parameters:
p - Recenter the scrollpane here

setZoomOut

public boolean setZoomOut(java.awt.Point p)
Decreases the current page visualization zoom factor by 20%.

Specified by:
setZoomOut in interface org.icepdf.core.views.DocumentViewController
Parameters:
p - Recenter the scrollpane here

getDocumentViewModel

public org.icepdf.core.views.DocumentViewModel getDocumentViewModel()
Specified by:
getDocumentViewModel in interface org.icepdf.core.views.DocumentViewController

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation

Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation

Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation

Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation

Specified by:
componentShown in interface java.awt.event.ComponentListener

firePropertyChange

public void firePropertyChange(java.lang.String event,
                               int oldValue,
                               int newValue)
Specified by:
firePropertyChange in interface org.icepdf.core.views.DocumentViewController

firePropertyChange

public void firePropertyChange(java.lang.String event,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
Fires property change events for Page view UI changes such as:
  • focus gained/lost
  • annotation state change such as move or resize
  • new annotation crreated, currently only for new link annotations
  • Specified by:
    firePropertyChange in interface org.icepdf.core.views.DocumentViewController
    Parameters:
    event - property being changes
    oldValue - old value, null if no old value
    newValue - new annotation value.

    addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

    deleteCurrentAnnotation

    public void deleteCurrentAnnotation()
    Specified by:
    deleteCurrentAnnotation in interface org.icepdf.core.views.DocumentViewController

    undo

    public void undo()
    Specified by:
    undo in interface org.icepdf.core.views.DocumentViewController

    redo

    public void redo()
    Specified by:
    redo in interface org.icepdf.core.views.DocumentViewController

    removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener l)