com.qoppa.pdfViewer.actions
Class GotoPageAction

java.lang.Object
  extended bycom.qoppa.pdfViewer.actions.Action
      extended bycom.qoppa.pdfViewer.actions.GotoPageAction

public class GotoPageAction
extends Action

Action that tells the viewer to go to a page in the current document.


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(int pageNumber)
          Constructs a GotoPageAction with a page number.
GotoPageAction(int pageNumber, int zoomMode)
          Construct a GotoPageAction that sets the targets zoom mode.
GotoPageAction(int pageNumber, int left, int top, double scale)
          Constructs a GotoPageAction with a page number and with values to set the target views left and top coordinate as well as the zoom scale.
 
Method Summary
 String getActionType()
          Returns the action type.
 String getActionTypeDesc()
          Returns the action type description
 int getPageNumber()
          Returns the target page number.
 int getTargetLeft()
          Gets the destination's left coordinate.
 double getTargetScale()
          Returns the target scale, the value of the scale that the viewer will use after setting the page.
 int getTargetTop()
          Gets the destination's top coordinate.
 int getZoomMode()
          Returns the zoom mode.
 void setPageNumber(int pageNumber)
          Sets the target page number.
 void setTargetLeft(int targetLeft)
          Sets the destination's left coordinate.
 void setTargetScale(double targetScale)
          Sets the target scale, 0..1.
 void setTargetTop(int targetTop)
          Sets the destination's top coordinate.
 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(int pageNumber)
Constructs a GotoPageAction with a page number. The page number is 1 based, so the first page in the document is page 1. This constructor will create an action that will retain the current zoom level.

Parameters:
pageNumber - The target page number, 1 based.

GotoPageAction

public GotoPageAction(int pageNumber,
                      int left,
                      int top,
                      double scale)
Constructs a GotoPageAction with a page number and with values to set the target views left and top coordinate as well as the zoom scale. Using -1 for any of these three values means that the action will retain the current value.

Parameters:
pageNumber - The target page number, 1 based.
left - The target left coordinate. Set to -1 to retain the current value
top - The target top coordinate. Set to -1 to retain the current value
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(int pageNumber,
                      int zoomMode)
Construct a GotoPageAction that sets the targets zoom mode. The zoom mode can be any of the predefined constants in this class that start with ZOOM_.

Parameters:
pageNumber - The target page number, 1 based.
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

getPageNumber

public int getPageNumber()
Returns the target page number. Page numbers start with page 1.

Returns:
The target page number.

setPageNumber

public void setPageNumber(int pageNumber)
Sets the target page number. Page numbers start with page 1.

Parameters:
pageNumber - The target page number.

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.


getTargetLeft

public int getTargetLeft()
Gets the destination's left coordinate. When a viewer goes to the target page, it will position this position on the left of the view.

Returns:
The left coordinate to show when going to the target page.

setTargetLeft

public void setTargetLeft(int targetLeft)
Sets the destination's left coordinate. When a viewer goes to the target page, it will position this position on the left of the view.

Parameters:
targetLeft - The new target left position.

getTargetTop

public int getTargetTop()
Gets the destination's top coordinate. When a viewer goes to the target page, it will position this position on the top of the view.

Returns:
The top coordinate to show when going to the target page.

setTargetTop

public void setTargetTop(int targetTop)
Sets the destination's top coordinate. When a viewer goes to the target page, it will position this position on the top of the view.

Parameters:
targetTop - The new target top position.

getTargetScale

public double getTargetScale()
Returns the target 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:
The target scale

setTargetScale

public void setTargetScale(double targetScale)
Sets the target 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:
targetScale -

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 (ZOMM_*)

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.