com.lizardtech.djvubean
Class DjVuBean

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by com.lizardtech.djvubean.DjVuBean
All Implemented Interfaces:
DjVuInterface, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
DjVuViewport

public class DjVuBean
extends java.awt.Panel
implements java.beans.PropertyChangeListener, DjVuInterface, java.io.Serializable, java.lang.Runnable

This Panel is designed for rendering a DjVuImage. Since normally a DjVuImage requires too much memory to render at full resolution, this panel should be added to either a JScrollPane or a ScrollPane. The borders of that pane will be used to automatically segment the DjVuImage, to avoid excessive memory usage.

Version:
$Revision: 1.35 $
Author:
$author$
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String FIRST_PAGE
          Navigate to the first page.
static int FIT_PAGE
          Magic scale value used to zoom to fit page.
static int FIT_WIDTH
          Magic scale value used to zoom to fit width.
protected  java.lang.Thread getImageThread
          Thread used to get the current image for display
protected  DjVuImage image
          The DjVuImage to be displayed.
static int LAST_MODE
          Constant to switch to the previous mode.
static java.lang.String LAST_PAGE
          Navigate to the last page.
static int MATCH_CASE_MASK
          This mask is used for case sensative searches.
protected  java.awt.event.MouseListener mlistener
          The current mouse listener.
static java.lang.String[] NAVIGATE_LIST
          This is a list of special values used when navigating documents.
static java.lang.String NEXT_PAGE
          Navigate to the next page.
static int PAN_MODE
          Constant to switch to panning mode.
static java.lang.String PREV_PAGE
          Navigate to the previous page.
 java.util.Properties properties
          Properties which may be used to initialize addOn's, and to pass extra values between add-on's.
static int SEARCH_BACKWARD_MASK
          This mask is used for backwards searches.
static int TEXT_MODE
          Constant to switch to text mode.
static int WHOLE_DOCUMENT_MASK
          This mask is used for multiple document searches.
static int WHOLE_WORD_MASK
          This mask is used for whole word searches.
protected  int zoom
          Current zoom factor.
static java.lang.String[] ZOOM_BUTTON_LIST
          The list of strings for the setZoom() method.
static java.lang.String ZOOM_FIT_PAGE
          String used for selecting fit page zoom.
static java.lang.String ZOOM_FIT_WIDTH
          String used for selecting fit width zoom.
static java.lang.String ZOOM_IN
          String used for selecting in
static int ZOOM_MODE
          Constant to switch to zoom mode.
static java.lang.String ZOOM_ONE_TO_ONE
          String used for selecting fit one to one zoom.
static java.lang.String ZOOM_OUT
          String used for selecting in
static java.lang.String[] ZOOM_SPECIAL_LIST
          The list of strings for the setZoom() method.
static java.lang.String[] ZOOM_STANDARD_LIST
          The list of strings standard zoom settings.
static java.lang.String ZOOM_STRETCH
          String used for selecting stretch zoom
static java.lang.String ZOOM100
          String used for selecting 100% zoom.
static java.lang.String ZOOM150
          String used for selecting 150% zoom.
static java.lang.String ZOOM25
          String used for selecting 25% zoom.
static java.lang.String ZOOM300
          String used for selecting 300% zoom.
static java.lang.String ZOOM50
          String used for selecting 50% zoom.
static java.lang.String ZOOM75
          String used for selecting 75% zoom.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DjVuBean()
          Creates a new DjVuBean object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a listener for property change events.
 java.lang.Object createAddOn(java.lang.String name)
          This is used to create additional objects, like the TextFinder, toolbars and outline navigation.
 int getCaretPosition()
          Query the current caret position, used for text searches.
 DjVuOptions getDjVuOptions()
          Query the DjVuOptions used by this object.
 Document getDocument()
          Query the document being browsed.
 int getDPI()
          Query the resolution of the DjVuPage.
 DjVuImage getImage()
           
 DjVuImage getImageWait()
          Query the current DjVuImage being displayed.
 java.lang.Number getLastMode()
          Query the previous mode value.
protected  java.awt.Dimension getMaximumPanelSize()
          Query the Maximum Panel size.
 java.awt.Dimension getMaximumSize()
          Query the maximum size.
 java.awt.Dimension getMinimumPanelSize()
          Query the minimum size.
 java.awt.Dimension getMinimumSize()
          Query the minimum size.
 int getMode()
          Return the current mode.
 java.awt.Component getOutline()
          Query and/or create the outline add-on component.
 int getPage()
          Optain the current page number, starting from page 1.
 int getPageCount()
          Query the number of pages in the current document.
protected  java.awt.Dimension getPreferredPanelSize()
          Query the Preferred Panel size.
 java.awt.Dimension getPreferredSize()
          Query the preferred size.
 java.util.Properties getProperties()
          Called to obtain Properties which may be used by the add-on classes.
 java.awt.Point getScrollPosition()
          Query the scroll position of the relevant ScrollPane or JScrollPane.
 int getSearchMask()
          Query the current search mask.
 java.lang.String getSearchText()
          Query the text used for the searching.
 java.awt.Rectangle getSelect()
          Query the selected region of the image.
 java.lang.String getStatus()
          Query the status string.
 int getTargetWidth()
          Query the target width for toolbar type components.
 java.lang.String getText()
          Query the hidden text for this document.
 java.awt.TextArea getTextArea()
          Obtain a TextArea appropriate for displaying the hidden text layer.
 Codec getTextCodec(long maxWait)
          Query the current DjVuText Codec.
 java.lang.Runnable getTextSearchObject()
          Query the runnable object used for searching.
 java.awt.Component getToolbar()
          Query and/or create the toolbar add-on component.
 java.net.URL getURL()
          Query the URL being browsed.
 java.awt.Dimension getViewportSize()
          Query the viewport size of the relevant ScrollPane or JScrollPane.
protected  int getXScale()
          Return the zoom factor of the X dimension.
protected  int getYScale()
          Return the zoom factor of the Y dimension.
 java.lang.String getZoom()
          Called to query the current Zoom setting.
 boolean imageUpdate(java.awt.Image image, int infoflags, int x, int y, int width, int height)
          This overloaded ImageObserver method ignores image updates until a full frame is available.
protected  java.lang.Object invokeMethod(java.lang.Object component, java.lang.String[] methodName, java.lang.Class[] parms, java.lang.Object[] args)
          Called to invoke a method of the container class.
protected  java.lang.Object invokeParentsMethod(java.lang.String[] methodName, java.lang.Class[] parms, java.lang.Object[] args, int maxDepth)
          Called to invoke a method of the parent classes.
 boolean isDecoding()
          Query if image decoding is still in progress.
 boolean isOpaque()
          Always returns true.
 void paint(java.awt.Graphics g)
          Called to draw the DjVuPage
 void paintComponent(java.awt.Graphics g)
          Called to draw the DjVuPage
 void propertyChange(java.beans.PropertyChangeEvent event)
          Called when a property has been changed.
 void recursiveRevalidate()
          Called to recursively validate each parent.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a listener for PropertyChangeEvent.
 void repaintImageCoordinates(java.awt.Rectangle bounds)
          Used to specify a rectangle in document coordinates to repaint.
 void run()
           
 void scaleScrollPosition(int owidth, int oheight, int nwidth, int nheight)
          Called to adjust to adjust the scroll position after scaling the image.
 void setBackground(java.awt.Color color)
          Sets the background color of this component.
 void setCaretPosition(int caretPosition)
          Set the current caret position, used for text searches.
 void setDjVuOptions(DjVuOptions options)
          Set the DjVuOptions used by this object.
protected  void setImage(DjVuImage image)
          Set the image to display.
 void setImageSize(java.awt.Dimension size)
          Set the scaled DjVuImage size.
 void setImageSize(int width, int height)
          Set the scaled size of the DjVuImage.
 void setMode(int mode)
          Used to set the mouselistener for PAN_MODE (panning), or ZOOM_MODE (zoom selection).
 void setMode(java.lang.Object mode)
          Set the display mode from the specified String or Number.
 void setPage(int page)
          Browse to the specified page number, starting with page 1.
 void setPageString(java.lang.String page)
          Browse to the specified page number, starting with page 1.
protected  void setPanelSize(java.awt.Dimension size)
          Adjust the panel size.
protected  void setPanelSize(int width, int height)
          Adjust the panel size.
 void setProperties(java.util.Properties properties)
          Called to set Properties which may be used by the add-ons.
 void setPropertyName(java.lang.String name)
          Automatically called to indicated the specified property value has been changed.
 void setScrollPosition(int x, int y)
          Set the scroll position of the relevant ScrollPane or JScrollPane.
 void setScrollPosition(java.awt.Point p)
          Set the scroll position of the relevant ScrollPane or JScrollPane.
 void setSearchMask(int mask)
          Set the current search mask.
 void setSearchText(java.lang.String searchText)
          Set the text used for searching.
 void setSelect(java.awt.Rectangle select)
          Set the selected rectangle of the region.
 void setSelectionList(java.util.Vector list)
          Called to set the list of selected text to highlight.
 void setSize(java.awt.Dimension size)
          Set the new scaled size.
 void setSize(int width, int height)
          Set the new scaled size.
 void setStatus(java.lang.String status)
          Set the status string and fire a property change event "status".
 void setSubmit(java.lang.Object link)
          Called to generate a PropertyChangeEvent to tell the monitor load a new URL.
 void setTargetWidth(int width)
          Sets the target width for toolbar type components.
 void setURL(java.net.URL url)
          Set the URL being browsed.
 void setViewportSize(java.awt.Dimension size)
          Set the viewport size of the relevant ScrollPane or JScrollPane.
 void setViewportSize(int width, int height)
          Set the viewport size of the relevant ScrollPane or JScrollPane.
 void setZoom(java.lang.String zoom)
          Scale the current zoom to either a value specified in the ZOOM_SPECIAL_LIST, or a number followed by percent sign.
static boolean stringToBoolean(java.lang.String value, boolean retval)
          Convert a string to a boolean using a case insensative comparison.
 void update(java.awt.Graphics g)
          Called to draw the DjVuPage
 void validate()
          Called to recursively validate.
 void zoomSelect()
          Called to zoom to the current selected rectangle set with setSelect().
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIT_WIDTH

public static final int FIT_WIDTH
Magic scale value used to zoom to fit width.

See Also:
Constant Field Values

FIT_PAGE

public static final int FIT_PAGE
Magic scale value used to zoom to fit page.

See Also:
Constant Field Values

LAST_MODE

public static final int LAST_MODE
Constant to switch to the previous mode.

See Also:
Constant Field Values

PAN_MODE

public static final int PAN_MODE
Constant to switch to panning mode.

See Also:
Constant Field Values

TEXT_MODE

public static final int TEXT_MODE
Constant to switch to text mode.

See Also:
Constant Field Values

ZOOM_MODE

public static final int ZOOM_MODE
Constant to switch to zoom mode.

See Also:
Constant Field Values

ZOOM300

public static final java.lang.String ZOOM300
String used for selecting 300% zoom.

See Also:
Constant Field Values

ZOOM150

public static final java.lang.String ZOOM150
String used for selecting 150% zoom.

See Also:
Constant Field Values

ZOOM100

public static final java.lang.String ZOOM100
String used for selecting 100% zoom.

See Also:
Constant Field Values

ZOOM75

public static final java.lang.String ZOOM75
String used for selecting 75% zoom.

See Also:
Constant Field Values

ZOOM50

public static final java.lang.String ZOOM50
String used for selecting 50% zoom.

See Also:
Constant Field Values

ZOOM25

public static final java.lang.String ZOOM25
String used for selecting 25% zoom.

See Also:
Constant Field Values

ZOOM_FIT_WIDTH

public static final java.lang.String ZOOM_FIT_WIDTH
String used for selecting fit width zoom.

See Also:
Constant Field Values

ZOOM_FIT_PAGE

public static final java.lang.String ZOOM_FIT_PAGE
String used for selecting fit page zoom.

See Also:
Constant Field Values

ZOOM_ONE_TO_ONE

public static final java.lang.String ZOOM_ONE_TO_ONE
String used for selecting fit one to one zoom.

See Also:
Constant Field Values

ZOOM_STRETCH

public static final java.lang.String ZOOM_STRETCH
String used for selecting stretch zoom

See Also:
Constant Field Values

ZOOM_IN

public static final java.lang.String ZOOM_IN
String used for selecting in

See Also:
Constant Field Values

ZOOM_OUT

public static final java.lang.String ZOOM_OUT
String used for selecting in

See Also:
Constant Field Values

ZOOM_STANDARD_LIST

public static final java.lang.String[] ZOOM_STANDARD_LIST
The list of strings standard zoom settings.


ZOOM_SPECIAL_LIST

public static final java.lang.String[] ZOOM_SPECIAL_LIST
The list of strings for the setZoom() method.


ZOOM_BUTTON_LIST

public static final java.lang.String[] ZOOM_BUTTON_LIST
The list of strings for the setZoom() method.


FIRST_PAGE

public static final java.lang.String FIRST_PAGE
Navigate to the first page.

See Also:
Constant Field Values

PREV_PAGE

public static final java.lang.String PREV_PAGE
Navigate to the previous page.

See Also:
Constant Field Values

NEXT_PAGE

public static final java.lang.String NEXT_PAGE
Navigate to the next page.

See Also:
Constant Field Values

LAST_PAGE

public static final java.lang.String LAST_PAGE
Navigate to the last page.

See Also:
Constant Field Values

NAVIGATE_LIST

public static final java.lang.String[] NAVIGATE_LIST
This is a list of special values used when navigating documents.


SEARCH_BACKWARD_MASK

public static final int SEARCH_BACKWARD_MASK
This mask is used for backwards searches.

See Also:
Constant Field Values

MATCH_CASE_MASK

public static final int MATCH_CASE_MASK
This mask is used for case sensative searches.

See Also:
Constant Field Values

WHOLE_WORD_MASK

public static final int WHOLE_WORD_MASK
This mask is used for whole word searches.

See Also:
Constant Field Values

WHOLE_DOCUMENT_MASK

public static final int WHOLE_DOCUMENT_MASK
This mask is used for multiple document searches.

See Also:
Constant Field Values

properties

public final java.util.Properties properties
Properties which may be used to initialize addOn's, and to pass extra values between add-on's.


mlistener

protected java.awt.event.MouseListener mlistener
The current mouse listener.


zoom

protected int zoom
Current zoom factor.


image

protected DjVuImage image
The DjVuImage to be displayed.


getImageThread

protected java.lang.Thread getImageThread
Thread used to get the current image for display

Constructor Detail

DjVuBean

public DjVuBean()
Creates a new DjVuBean object.

Method Detail

setStatus

public void setStatus(java.lang.String status)
Set the status string and fire a property change event "status".

Parameters:
status - new status string

getStatus

public java.lang.String getStatus()
Query the status string.

Returns:
the status string

setBackground

public void setBackground(java.awt.Color color)
Sets the background color of this component.

Overrides:
setBackground in class java.awt.Component
Parameters:
color - The color to become the components background color. If null the component will inherit the background color of its parent.

getCaretPosition

public int getCaretPosition()
Query the current caret position, used for text searches. -1 may be used to reset to the beginning of the document for forward searches and the end of the document for backward searches.

Returns:
the current search position.

getDPI

public int getDPI()
Query the resolution of the DjVuPage.

Returns:
The scanned resolution of the DjVuPage.

setDjVuOptions

public void setDjVuOptions(DjVuOptions options)
Set the DjVuOptions used by this object.

Specified by:
setDjVuOptions in interface DjVuInterface
Parameters:
options - The DjVuOptions used by this object.

getDjVuOptions

public DjVuOptions getDjVuOptions()
Query the DjVuOptions used by this object.

Specified by:
getDjVuOptions in interface DjVuInterface
Returns:
the DjVuOptions used by this object.

getDocument

public final Document getDocument()
Query the document being browsed.

Returns:
the document being browsed.

getImageWait

public DjVuImage getImageWait()
Query the current DjVuImage being displayed.

Returns:
the DjVuImage being displayed.

setImageSize

public void setImageSize(int width,
                         int height)
Set the scaled size of the DjVuImage.

Parameters:
width - scaled Width.
height - scaled Height.

setImageSize

public final void setImageSize(java.awt.Dimension size)
Set the scaled DjVuImage size.

Parameters:
size - Scaled size.

getLastMode

public java.lang.Number getLastMode()
Query the previous mode value. Usefull for "undo" type operations.

Returns:
the previous mode setting.

getMaximumSize

public java.awt.Dimension getMaximumSize()
Query the maximum size.

Overrides:
getMaximumSize in class java.awt.Container
Returns:
The scaled Image size.

getMinimumPanelSize

public java.awt.Dimension getMinimumPanelSize()
Query the minimum size.

Returns:
minimum size of the panel.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Query the minimum size.

Overrides:
getMinimumSize in class java.awt.Container
Returns:
The scaled Image size.

setMode

public void setMode(java.lang.Object mode)
Set the display mode from the specified String or Number. This method fires a "mode" PropertyChangeEvent.

Parameters:
mode - object containing eithe a mode number or mode string.

setMode

public void setMode(int mode)
Used to set the mouselistener for PAN_MODE (panning), or ZOOM_MODE (zoom selection). Other values such as TEXT_MODE may be used to indicate no internal mouse listener (except for the mouse over hyperlink listener) should be used. This method fires a "mode" PropertyChangeEvent.

Parameters:
mode - the new mouse listening mode.

getMode

public int getMode()
Return the current mode. May be ZOOM_MODE or PAN_MODE.

Returns:
the current mode.

isOpaque

public boolean isOpaque()
Always returns true.

Overrides:
isOpaque in class java.awt.Component
Returns:
true.

setPage

public void setPage(int page)
Browse to the specified page number, starting with page 1. This method fires a "page" PropertyChangeEvent.

Parameters:
page - new page number to browse to.

getPage

public final int getPage()
Optain the current page number, starting from page 1.

Returns:
current page number.

setPageString

public void setPageString(java.lang.String page)
Browse to the specified page number, starting with page 1. Special values of FIRST_PAGE, PREV_PAGE, NEXT_PAGE, and LAST_PAGE will be checked prior to converting the string to an integer. This method fires a "page" PropertyChangeEvent.

Parameters:
page - new page number to browse to.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Query the preferred size.

Overrides:
getPreferredSize in class java.awt.Container
Returns:
The scaled Image size.

setScrollPosition

public final void setScrollPosition(java.awt.Point p)
Set the scroll position of the relevant ScrollPane or JScrollPane.

Parameters:
p - Position to scroll to.

setSearchMask

public void setSearchMask(int mask)
Set the current search mask. A special value of -1 may be used to fire a property change event with the currrent value. This method fires a "searchMask" PropertyChangeEvent.

Parameters:
mask - consisting of search options.

getSearchMask

public int getSearchMask()
Query the current search mask.

Returns:
search option mask.

setSize

public final void setSize(java.awt.Dimension size)
Set the new scaled size.

Overrides:
setSize in class java.awt.Component
Parameters:
size - to scale to.

setScrollPosition

public void setScrollPosition(int x,
                              int y)
Set the scroll position of the relevant ScrollPane or JScrollPane.

Parameters:
x - coordinate of position to scroll to.
y - coordinate of position to scroll to.

getScrollPosition

public java.awt.Point getScrollPosition()
Query the scroll position of the relevant ScrollPane or JScrollPane.

Returns:
the current scroll position.

setSearchText

public void setSearchText(java.lang.String searchText)
Set the text used for searching. Setting the text to a non-null value will reset the caretPosition and selectionList. This method fires a "searchText" PropertyChangeEvent.

Parameters:
searchText - text to use in the next search.

getSearchText

public java.lang.String getSearchText()
Query the text used for the searching.

Returns:
the text used for searching.

setSelect

public void setSelect(java.awt.Rectangle select)
Set the selected rectangle of the region. This may be used with the zoomSelect() method.

Parameters:
select - the currently selected rectangle.

getSelect

public java.awt.Rectangle getSelect()
Query the selected region of the image.

Returns:
the selected region.

setSize

public void setSize(int width,
                    int height)
Set the new scaled size.

Overrides:
setSize in class java.awt.Component
Parameters:
width - to scale to.
height - to scale to.

setSubmit

public void setSubmit(java.lang.Object link)
Called to generate a PropertyChangeEvent to tell the monitor load a new URL. This method fires a "submit" PropertyChangeEvent.

Parameters:
link - a anno.Rect, URL, or String to indicate the link to load.

getTextArea

public final java.awt.TextArea getTextArea()
Obtain a TextArea appropriate for displaying the hidden text layer. This is mainly intended for cut and paste support. Any edits will be lost when navigating to a new page.

Returns:
represents the hidden text layer.

getTextSearchObject

public java.lang.Runnable getTextSearchObject()
Query the runnable object used for searching. This will be null if the the search add-on is not available.

Returns:
the runnable object.

setURL

public void setURL(java.net.URL url)
            throws java.io.IOException
Set the URL being browsed. This method fires a "URL" PropertyChangeEvent.

Parameters:
url - to browse
Throws:
java.io.IOException - if an error occurs decoding the document

getURL

public final java.net.URL getURL()
Query the URL being browsed.

Returns:
the url being browsed.

setViewportSize

public final void setViewportSize(java.awt.Dimension size)
Set the viewport size of the relevant ScrollPane or JScrollPane.

Parameters:
size - viewport size.

setCaretPosition

public void setCaretPosition(int caretPosition)
Set the current caret position, used for text searches. -1 may be used to reset to the beginning of the document for forward searches and the end of the document for backward searches.

Parameters:
caretPosition - the new caret position.

isDecoding

public boolean isDecoding()
Query if image decoding is still in progress.

Returns:
true if currently decoding.

getOutline

public java.awt.Component getOutline()
Query and/or create the outline add-on component.

Returns:
the outline component, or null if the add-on is not available.

getPageCount

public int getPageCount()
Query the number of pages in the current document.

Returns:
the number of pages in the current document.

setProperties

public void setProperties(java.util.Properties properties)
Called to set Properties which may be used by the add-ons.

Parameters:
properties - values to set.

getProperties

public final java.util.Properties getProperties()
Called to obtain Properties which may be used by the add-on classes.

Returns:
current properties.

setPropertyName

public void setPropertyName(java.lang.String name)
Automatically called to indicated the specified property value has been changed. This method fires a "propertyName" PropertyChangeEvent.

Parameters:
name - the name of the property which has changed.

setSelectionList

public void setSelectionList(java.util.Vector list)
Called to set the list of selected text to highlight.

Parameters:
list - the list of selected GRect rectangles to highlight.

setTargetWidth

public void setTargetWidth(int width)
Sets the target width for toolbar type components. Typically this is set by the containing Applet, or when the toolbar is resized. This method fires a "TargetWidth" PropertyChangeEvent.

Parameters:
width - to use for the toolbar layout.

getTargetWidth

public int getTargetWidth()
Query the target width for toolbar type components.

Returns:
target width.

getText

public java.lang.String getText()
Query the hidden text for this document.

Returns:
the hidden text for this document.

getTextCodec

public Codec getTextCodec(long maxWait)
Query the current DjVuText Codec. Use a maxWait of 0L if you wish to wait until either text is available or decoding is complete.

Parameters:
maxWait - the maximum time to wait in milliseconds.
Returns:
the current DjVuText Codec, or null.

getToolbar

public java.awt.Component getToolbar()
Query and/or create the toolbar add-on component.

Returns:
the toolbar component, or null if the add-on is not available.

setViewportSize

public void setViewportSize(int width,
                            int height)
Set the viewport size of the relevant ScrollPane or JScrollPane.

Parameters:
width - of viewport.
height - of viewport.

getViewportSize

public java.awt.Dimension getViewportSize()
Query the viewport size of the relevant ScrollPane or JScrollPane.

Returns:
the viewport size.

setZoom

public void setZoom(java.lang.String zoom)
Scale the current zoom to either a value specified in the ZOOM_SPECIAL_LIST, or a number followed by percent sign. i.e. setZoom("125%"). This method calls setZoom which fires a "zoom" PropertyChangeEvent.

Parameters:
zoom - The zoom factor to scale to.

getZoom

public java.lang.String getZoom()
Called to query the current Zoom setting. This will either be a value from the ZOOM_SPECIAL_LIST, or the current scale factor appended with a percent sign.

Returns:
current zoom setting.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a listener for property change events.

Overrides:
addPropertyChangeListener in class java.awt.Container
Parameters:
listener - to add

imageUpdate

public boolean imageUpdate(java.awt.Image image,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
This overloaded ImageObserver method ignores image updates until a full frame is available. Then refresh is called to display the new pixels.

Specified by:
imageUpdate in interface java.awt.image.ImageObserver
Overrides:
imageUpdate in class java.awt.Component
Parameters:
image - Updated image
infoflags - Flags indicating the new data available.
x - Coordinate of left edge. (-1 if unknown)
y - Coordinate of top edge. (-1 if unknown)
width - Image width. (-1 if unknown)
height - Image height. (-1 if unknown)
Returns:
true if we should continue to listen for updates.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Called when a property has been changed. This is used to monitor progressive decodes for text.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - indicates the changed property.

stringToBoolean

public static boolean stringToBoolean(java.lang.String value,
                                      boolean retval)
Convert a string to a boolean using a case insensative comparison. "yes" and "true" will be recognized as true. "no" and "false" will be recognized as false. Anything else will be return the default value.

Parameters:
value - string to convert.
retval - default value to return.
Returns:
the converted boolean.

createAddOn

public java.lang.Object createAddOn(java.lang.String name)
This is used to create additional objects, like the TextFinder, toolbars and outline navigation. In general an add-on may be any class with a constructor which accepts the single argument of this DjVuBean.

Parameters:
name - class name of the add-on.
Returns:
the newly created add-on, or null if no add-on was created.

paint

public void paint(java.awt.Graphics g)
Called to draw the DjVuPage

Overrides:
paint in class java.awt.Container
Parameters:
g - Graphics device to draw to.

getImage

public DjVuImage getImage()

paintComponent

public void paintComponent(java.awt.Graphics g)
Called to draw the DjVuPage

Parameters:
g - Graphics device to draw to.

run

public void run()
Specified by:
run in interface java.lang.Runnable

recursiveRevalidate

public void recursiveRevalidate()
Called to recursively validate each parent.


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a listener for PropertyChangeEvent.

Overrides:
removePropertyChangeListener in class java.awt.Component
Parameters:
listener - to remove

repaintImageCoordinates

public void repaintImageCoordinates(java.awt.Rectangle bounds)
Used to specify a rectangle in document coordinates to repaint. This is usually used for highlighting search results.

Parameters:
bounds - Rectangle to highlight.

scaleScrollPosition

public void scaleScrollPosition(int owidth,
                                int oheight,
                                int nwidth,
                                int nheight)
Called to adjust to adjust the scroll position after scaling the image.

Parameters:
owidth - old width.
oheight - old height.
nwidth - new width.
nheight - new height.

update

public void update(java.awt.Graphics g)
Called to draw the DjVuPage

Overrides:
update in class java.awt.Container
Parameters:
g - Graphics device to draw to.

validate

public void validate()
Called to recursively validate.

Overrides:
validate in class java.awt.Container

zoomSelect

public void zoomSelect()
Called to zoom to the current selected rectangle set with setSelect().


setImage

protected void setImage(DjVuImage image)
Set the image to display. This method fires a "image" PropertyChangeEvent.

Parameters:
image - to display.

getMaximumPanelSize

protected java.awt.Dimension getMaximumPanelSize()
Query the Maximum Panel size.

Returns:
the maximum panel size.

setPanelSize

protected final void setPanelSize(java.awt.Dimension size)
Adjust the panel size.

Parameters:
size - The new panel size.

setPanelSize

protected void setPanelSize(int width,
                            int height)
Adjust the panel size.

Parameters:
width - The new panel width.
height - The new panel height.

getPreferredPanelSize

protected java.awt.Dimension getPreferredPanelSize()
Query the Preferred Panel size.

Returns:
the preferred panel size.

getXScale

protected int getXScale()
Return the zoom factor of the X dimension.

Returns:
x-zoom factor.

getYScale

protected int getYScale()
Return the zoom factor of the Y dimension.

Returns:
y-zoom factor.

invokeMethod

protected java.lang.Object invokeMethod(java.lang.Object component,
                                        java.lang.String[] methodName,
                                        java.lang.Class[] parms,
                                        java.lang.Object[] args)
                                 throws java.lang.NoSuchMethodException,
                                        java.lang.IllegalAccessException,
                                        java.lang.reflect.InvocationTargetException
Called to invoke a method of the container class.

Parameters:
component - to invoke method in.
methodName - name of method to invoke.
parms - parameter types of the method.
args - arguments to the method.
Returns:
retval of the method.
Throws:
java.lang.NoSuchMethodException - if the mothod does not exist.
java.lang.IllegalAccessException - if access to the method is denied.
java.lang.reflect.InvocationTargetException - if invocation fails.

invokeParentsMethod

protected java.lang.Object invokeParentsMethod(java.lang.String[] methodName,
                                               java.lang.Class[] parms,
                                               java.lang.Object[] args,
                                               int maxDepth)
Called to invoke a method of the parent classes.

Parameters:
methodName - name of method to invoke.
parms - parameter types of the method.
args - arguments to the method.
maxDepth - maximum number of parents to try.
Returns:
retval of the method or null.