com.icesoft.pdf.ri.common.views
Class DocumentViewControllerImpl

java.lang.Object
  extended bycom.icesoft.pdf.ri.common.views.DocumentViewControllerImpl
All Implemented Interfaces:
ComponentListener, DocumentViewController, EventListener

public class DocumentViewControllerImpl
extends Object
implements DocumentViewController, 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  AnnotationCallback annotationCallback
           
protected  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.
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 com.icesoft.pdf.views.DocumentViewController
CURSOR_DEFAULT, CURSOR_HAND_ANNOTATION, CURSOR_HAND_CLOSE, CURSOR_HAND_OPEN, CURSOR_SELECT, 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(PropertyChangeListener l)
           
 void closeDocument()
           
 void componentHidden(ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void componentMoved(ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void componentResized(ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void componentShown(ComponentEvent e)
          SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation
 void dispose()
           
 void firePropertyChange(String event, int oldValue, int newValue)
           
 AnnotationCallback getAnnotationCallback()
          Gets the annotation callback.
 int getCurrentPageDisplayValue()
           
 int getCurrentPageIndex()
           
 Document getDocument()
           
 DocumentView getDocumentView()
           
 int getFitMode()
           
 Adjustable getHorizontalScrollBar()
           
 Controller getParentController()
           
 float getRotation()
          Returns the zoom factor of the page visualization.
 int getToolMode()
           
 Adjustable getVerticalScrollBar()
           
 Container getViewContainer()
          The controller will own the scrollpane and will insert different views into it.
 Cursor getViewCursor(int currsorType)
           
 int getViewMode()
           
 float getZoom()
           
 float[] getZoomLevels()
           
 boolean isToolModeSelected(int viewToolMode)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void requestViewFocusInWindow()
           
 void setAnnotationCallback(AnnotationCallback annotationCallback)
          Set an annotation callback.
 boolean setCurrentPageIndex(int pageIndex)
           
 int setCurrentPageNext()
           
 int setCurrentPagePrevious()
           
 void setDestinationTarget(Destination destination)
           
 void setDocument(Document newDocument)
           
 void setDocumentViewType(int documentView, int fitMode)
           
 boolean setFitMode(int fitMode)
           
 float setRotateLeft()
           
 float setRotateRight()
           
 boolean setRotation(float viewRotation)
           
 boolean setToolMode(int viewToolMode)
           
 void setViewCursor(int currsorType)
           
 void setViewKeyListener(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(Point p)
          Increases the current page visualization zoom factor by 20%.
 void setZoomLevels(float[] zoomLevels)
           
 boolean setZoomOut()
           
 boolean setZoomOut(Point p)
          Decreases the current page visualization zoom factor by 20%.
 
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

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 AnnotationCallback annotationCallback

changes

protected PropertyChangeSupport changes
Constructor Detail

DocumentViewControllerImpl

public DocumentViewControllerImpl(SwingController viewerController)
Method Detail

getDocument

public Document getDocument()
Specified by:
getDocument in interface DocumentViewController

setDocument

public void setDocument(Document newDocument)
Specified by:
setDocument in interface DocumentViewController

closeDocument

public void closeDocument()
Specified by:
closeDocument in interface DocumentViewController

getHorizontalScrollBar

public Adjustable getHorizontalScrollBar()
Specified by:
getHorizontalScrollBar in interface DocumentViewController

getVerticalScrollBar

public Adjustable getVerticalScrollBar()
Specified by:
getVerticalScrollBar in interface DocumentViewController

setAnnotationCallback

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

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

getAnnotationCallback

public AnnotationCallback getAnnotationCallback()
Gets the annotation callback.

Specified by:
getAnnotationCallback in interface DocumentViewController
Returns:
annotation callback associated with this document.

getDocumentView

public DocumentView getDocumentView()

setViewKeyListener

public void setViewKeyListener(KeyListener l)
Specified by:
setViewKeyListener in interface DocumentViewController

setDestinationTarget

public void setDestinationTarget(Destination destination)
Specified by:
setDestinationTarget in interface DocumentViewController

dispose

public void dispose()
Specified by:
dispose in interface DocumentViewController

getViewContainer

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

Specified by:
getViewContainer in interface DocumentViewController

getParentController

public Controller getParentController()
Specified by:
getParentController in interface DocumentViewController

getViewMode

public int getViewMode()
Specified by:
getViewMode in interface DocumentViewController

setViewType

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

Specified by:
setViewType in interface DocumentViewController
Parameters:
documentViewType -

setFitMode

public boolean setFitMode(int fitMode)
Specified by:
setFitMode in interface DocumentViewController

getFitMode

public int getFitMode()
Specified by:
getFitMode in interface DocumentViewController

setDocumentViewType

public void setDocumentViewType(int documentView,
                                int fitMode)
Specified by:
setDocumentViewType in interface DocumentViewController

setCurrentPageIndex

public boolean setCurrentPageIndex(int pageIndex)
Specified by:
setCurrentPageIndex in interface DocumentViewController

setCurrentPageNext

public int setCurrentPageNext()
Specified by:
setCurrentPageNext in interface DocumentViewController

setCurrentPagePrevious

public int setCurrentPagePrevious()
Specified by:
setCurrentPagePrevious in interface DocumentViewController

getCurrentPageIndex

public int getCurrentPageIndex()
Specified by:
getCurrentPageIndex in interface DocumentViewController

getCurrentPageDisplayValue

public int getCurrentPageDisplayValue()
Specified by:
getCurrentPageDisplayValue in interface DocumentViewController

getZoomLevels

public float[] getZoomLevels()
Specified by:
getZoomLevels in interface DocumentViewController

setZoomLevels

public void setZoomLevels(float[] zoomLevels)
Specified by:
setZoomLevels in interface 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 DocumentViewController
Parameters:
viewZoom - zoom factor
Returns:
if zoom actually changed

setZoomIn

public boolean setZoomIn()
Specified by:
setZoomIn in interface DocumentViewController

setZoomOut

public boolean setZoomOut()
Specified by:
setZoomOut in interface DocumentViewController

getZoom

public float getZoom()
Specified by:
getZoom in interface 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 DocumentViewController
Returns:
zoom factor

setRotateRight

public float setRotateRight()
Specified by:
setRotateRight in interface DocumentViewController

setRotateLeft

public float setRotateLeft()
Specified by:
setRotateLeft in interface DocumentViewController

setRotation

public boolean setRotation(float viewRotation)
Specified by:
setRotation in interface DocumentViewController

setToolMode

public boolean setToolMode(int viewToolMode)
Specified by:
setToolMode in interface DocumentViewController

isToolModeSelected

public boolean isToolModeSelected(int viewToolMode)
Specified by:
isToolModeSelected in interface DocumentViewController

getToolMode

public int getToolMode()
Specified by:
getToolMode in interface DocumentViewController

setViewCursor

public void setViewCursor(int currsorType)
Specified by:
setViewCursor in interface DocumentViewController

getViewCursor

public Cursor getViewCursor(int currsorType)
Specified by:
getViewCursor in interface DocumentViewController

requestViewFocusInWindow

public void requestViewFocusInWindow()
Specified by:
requestViewFocusInWindow in interface DocumentViewController

setZoomIn

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

Specified by:
setZoomIn in interface DocumentViewController
Parameters:
p - Recenter the scrollpane here

setZoomOut

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

Specified by:
setZoomOut in interface DocumentViewController
Parameters:
p - Recenter the scrollpane here

componentHidden

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

Specified by:
componentHidden in interface ComponentListener

componentMoved

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

Specified by:
componentMoved in interface ComponentListener

componentResized

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

Specified by:
componentResized in interface ComponentListener

componentShown

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

Specified by:
componentShown in interface ComponentListener

firePropertyChange

public void firePropertyChange(String event,
                               int oldValue,
                               int newValue)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)