com.qoppa.pdfViewer.actions
Class GotoPageAction

java.lang.Object
  extended by com.qoppa.pdfViewer.actions.Action
      extended by com.qoppa.pdfViewer.actions.GotoPageAction

public class GotoPageAction
extends Action

A GotoPageAction can be used to position the display a page in a PDF document.

Author:
Qoppa Software
See Also:
PDFViewerBean.handleAction(Action)

Field Summary
static String ACTION_TYPE_DESCRIPTION
           
static int ZOOM_EXPLICIT
          Set the zoom scale explicitly.
static int ZOOM_FIT
          Zoom the view to fit the target page both horizontally and vertically.
static int ZOOM_FIT_HORIZONTAL
          Zoom the target page so that it will fit horizontally.
static int ZOOM_FIT_VERTICAL
          Zoom the target page so that it will fit vertically.
static int ZOOM_RETAIN
          Do not adjust the zoom scale, retain the current value.
 
Constructor Summary
GotoPageAction(IPDFPage pdfPage)
          Constructs a GotoPageAction with an IPDFPage.
GotoPageAction(IPDFPage pdfPage, int zoomMode)
          Constructs a GotoPageAction with an IPDFPage and a zoom mode.
GotoPageAction(IPDFPage pdfPage, int x, int y, double scale)
          Constructs a GotoPageAction with an IPDFPage and with values to set the x and y coordinates as well as the zoom scale.
 
Method Summary
 String getActionType()
          Returns the action type.
 String getActionTypeDesc()
          Returns the action type description
 IPDFPage getPage()
          Returns the page for this GotoPageAction.
 double getScale()
          Returns the scale, the value of the scale that the viewer will use after setting the page.
 int getX()
          Returns the x coordinate of the GotoPageAction.
 int getY()
          Returns the y coordinate of the GotoPageAction.
 int getZoomMode()
          Returns the zoom mode.
 void setScale(double scale)
          Sets the scale, 0..1.
 void setX(int x)
          Sets the x coordinate of the GotoPageAction.
 void setY(int y)
          Sets the y coordinate of the GotoPageAction.
 void setZoomMode(int zoomMode)
          Sets the zoom mode.
 String toString()
          Returns the description of the action.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_TYPE_DESCRIPTION

public static String ACTION_TYPE_DESCRIPTION

ZOOM_RETAIN

public static final int ZOOM_RETAIN
Do not adjust the zoom scale, retain the current value.

See Also:
Constant Field Values

ZOOM_FIT

public static final int ZOOM_FIT
Zoom the view to fit the target page both horizontally and vertically.

See Also:
Constant Field Values

ZOOM_FIT_HORIZONTAL

public static final int ZOOM_FIT_HORIZONTAL
Zoom the target page so that it will fit horizontally.

See Also:
Constant Field Values

ZOOM_FIT_VERTICAL

public static final int ZOOM_FIT_VERTICAL
Zoom the target page so that it will fit vertically.

See Also:
Constant Field Values

ZOOM_EXPLICIT

public static final int ZOOM_EXPLICIT
Set the zoom scale explicitly. When using this mode, the viewer will use the value in TargetZoom for the scale.

See Also:
Constant Field Values
Constructor Detail

GotoPageAction

public GotoPageAction(IPDFPage pdfPage)
Constructs a GotoPageAction with an IPDFPage. This constructor will create an action that will retain the current zoom level.

Parameters:
pdfPage - The IPDFPage to display

GotoPageAction

public GotoPageAction(IPDFPage pdfPage,
                      int x,
                      int y,
                      double scale)
Constructs a GotoPageAction with an IPDFPage and with values to set the x and y coordinates as well as the zoom scale.

Parameters:
pdfPage - The IPDFPage to display
x - The x coordinate
y - The y coordinate
scale - The zoom scale as a decimal. .5 will be 50% zoom, 5 will be 500%. If set to -1 or 0 to retain the current value

GotoPageAction

public GotoPageAction(IPDFPage pdfPage,
                      int zoomMode)
Constructs a GotoPageAction with an IPDFPage and a zoom mode. The zoom mode can be any of the predefined constants in this class that start with ZOOM_.

Parameters:
pdfPage - The IPDFPage to display
zoomMode - The new mode. If the mode is fit horizontal, or fit vertical, the viewer will also look at the TagetTop and TargetLeft values respectively.
Method Detail

getPage

public IPDFPage getPage()
Returns the page for this GotoPageAction.

Returns:
the page for this GotoPageAction

getActionType

public String getActionType()
Returns the action type.

Specified by:
getActionType in class Action
Returns:
The action type.

getActionTypeDesc

public String getActionTypeDesc()
Returns the action type description

Specified by:
getActionTypeDesc in class Action

toString

public String toString()
Returns the description of the action.

Overrides:
toString in class Object

getX

public int getX()
Returns the x coordinate of the GotoPageAction. When a viewer goes to the target page, it will use this value for the view's x position.

Returns:
the x coordinate of the GotoPageAction

setX

public void setX(int x)
Sets the x coordinate of the GotoPageAction. When a viewer goes to the target page, it will use this value for the view's x position.

Parameters:
x - coordinate of the GotoPageAction

getY

public int getY()
Returns the y coordinate of the GotoPageAction. When a viewer goes to the target page, it will use this value for the view's y position.

Returns:
y coordinate of the GotoPageAction

setY

public void setY(int y)
Sets the y coordinate of the GotoPageAction. When a viewer goes to the target page, it will use this value for the view's y position.

Parameters:
y - coordinate of the GotoPageAction

getScale

public double getScale()
Returns the scale, the value of the scale that the viewer will use after setting the page. If this value is 0, the viewer will not change the current scale.

Returns:
scale

setScale

public void setScale(double scale)
Sets the scale, 0..1. The viewer will set the scale of the view to this value after going to the page. Set to 0 to tell the viewer to retain the current zoom scale.

Parameters:
scale -

getZoomMode

public int getZoomMode()
Returns the zoom mode. The mode tells the viewer how to set the scale after setting the target page. There are values to tell the viewer to fit to width, fit to height, etc.

Returns:
The value of the zoom mode, one of the predefined constants in this class (ZOOM_*)

setZoomMode

public void setZoomMode(int zoomMode)
Sets the zoom mode. The mode tells the viewer how to set the scale after setting the target page. The calling application should use one of the predefined constants in this class: ZOOM_FIT, ZOOM_RETAIN, etc.

Parameters:
zoomMode - The new value of the zoom mode.