eTextReader
Class ScrollingContentPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by eTextReader.ScrollingContentPane
All Implemented Interfaces:
ScrollEventListener, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.ScrollPaneConstants

public class ScrollingContentPane
extends javax.swing.JScrollPane
implements java.awt.event.ActionListener, ScrollEventListener

See Also:
Serialized Form

Nested Class Summary
(package private)  class ScrollingContentPane.gotoAddressThread
           
 
Nested classes/interfaces inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
private  ContentPane content
           
private  javax.swing.JViewport contentView
           
private  java.util.Vector docListeners
           
private  eTextReader.loggingInterface.Logger log
           
private  Browser.LogListener loglistener
           
private  Browser.LogListener.PageScrollListener pagescrolllistener
           
private  PasteListener pastelisten
           
private  boolean popupsEnabled
           
(package private)  PopupWindowNotationHandler popupWindowHandler
          Facilitates popping up QuickNoteWindows when the mouse is over an annotation
private  java.util.Vector scrollListeners
           
private  int viewableThreshold
           
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ScrollingContentPane(ContentPane content, int vertBar, int horizBar, Browser.LogListener loglistener)
           
ScrollingContentPane(ContentPane content, int vertBar, int horizBar, Browser.LogListener loglistener, Browser.LogListener.PageScrollListener pagescrolllistener)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addDocEventListener(java.lang.Object listener)
           
 void addScrollEventListener(java.lang.Object listener)
           
protected  boolean completelyVisible(int offset)
          determines whether the character located at offset is completely visible (vertically) in the current viewport
 void disableTypes(Notation.AnnotationType[] types, boolean enableOthers)
          Delegate method for the popupWindowHandler method of the same name
 void enableTypes(Notation.AnnotationType[] types, boolean disableOthers)
          Delegate method for the popupWindowHandler method of the same name
protected  int ensureVisibleBottom(int offset)
          scrolls the viewport so that offset is completely visible at the bottom of the content pane
 void fireDocEvent(DocEvent de)
           
 void fireScrollEvent(ScrollEvent se)
           
 ContentPane getContent()
           
 float getFontSize()
           
 void gotoAddress(java.lang.String address)
          scrolls the document so that the position requested is at the top of the ContentPane
 boolean isPopupsEnabled()
          Determines whether or not popup windows are shown when the mouse hovers over an annotation icon
 boolean isTypeEnabled(Notation.AnnotationType type)
          Delegate method for the popupWindowHandler method of the same name
protected  boolean largerThanViewport(int offset)
          determines whether the element represented by offset is larger than the currently viewable content area.
 void scrollEventOccurred(ScrollEvent se)
           
protected  void scrollPage(java.lang.String direction)
          moves to the next or previous page in the current document.
 void setPage(java.lang.String address)
           
 void setPage(java.lang.String address, boolean reload)
          loads a new page and notifies listeners when loading is complete.
 void setPopupsEnabled(boolean popupsEnabled)
          Specifies whether or not popup windows are shown when the mouse hovers over an annotation icon
 void setViewableThreshold(int newThreshold)
          sets the number of pixels by which a character can exceed the viewable windows bounds before it is determined to be not completely visible
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

contentView

private javax.swing.JViewport contentView

scrollListeners

private java.util.Vector scrollListeners

docListeners

private java.util.Vector docListeners

log

private eTextReader.loggingInterface.Logger log

popupWindowHandler

PopupWindowNotationHandler popupWindowHandler
Facilitates popping up QuickNoteWindows when the mouse is over an annotation


popupsEnabled

private boolean popupsEnabled

content

private ContentPane content

loglistener

private Browser.LogListener loglistener

pastelisten

private PasteListener pastelisten

pagescrolllistener

private Browser.LogListener.PageScrollListener pagescrolllistener

viewableThreshold

private int viewableThreshold
Constructor Detail

ScrollingContentPane

public ScrollingContentPane(ContentPane content,
                            int vertBar,
                            int horizBar,
                            Browser.LogListener loglistener,
                            Browser.LogListener.PageScrollListener pagescrolllistener)

ScrollingContentPane

public ScrollingContentPane(ContentPane content,
                            int vertBar,
                            int horizBar,
                            Browser.LogListener loglistener)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getFontSize

public float getFontSize()

addScrollEventListener

public void addScrollEventListener(java.lang.Object listener)

fireScrollEvent

public void fireScrollEvent(ScrollEvent se)

scrollEventOccurred

public void scrollEventOccurred(ScrollEvent se)
Specified by:
scrollEventOccurred in interface ScrollEventListener

addDocEventListener

public void addDocEventListener(java.lang.Object listener)

fireDocEvent

public void fireDocEvent(DocEvent de)

getContent

public ContentPane getContent()

setViewableThreshold

public void setViewableThreshold(int newThreshold)
sets the number of pixels by which a character can exceed the viewable windows bounds before it is determined to be not completely visible

Parameters:
newThreshold - new value for threshold value
See Also:
completelyVisible(int)

scrollPage

protected void scrollPage(java.lang.String direction)
moves to the next or previous page in the current document. Pages are defined by the current height returned by the getTextExtentSize method of the JViewport class. If the top (bottom) of the document is currently being displayed when the user attempts to scroll up (down), the previous (next) document in the current publication is displayed

Parameters:
direction - the direction in which to scroll; valid values are PageScrollButton.PAGE_UP and PageScrollButton.PAGE_DOWN

largerThanViewport

protected boolean largerThanViewport(int offset)
                              throws javax.swing.text.BadLocationException
determines whether the element represented by offset is larger than the currently viewable content area.

Parameters:
offset - the offset in question
Returns:
true if the element cannot be displayed in the currently viewable content area; false if it can
Throws:
javax.swing.text.BadLocationException - if the offset does not represent a valid location in the current document

completelyVisible

protected boolean completelyVisible(int offset)
                             throws javax.swing.text.BadLocationException
determines whether the character located at offset is completely visible (vertically) in the current viewport

Parameters:
offset - a character offset into the content
Returns:
true if the rectangle bounding the character at offset lies completely within viewableThreshold of the the viewport's viewable rectangle, false otherwise
Throws:
javax.swing.text.BadLocationException - if offset is an invalid location in the current document
See Also:
JViewport.getViewRect(), setViewableThreshold(int)

ensureVisibleBottom

protected int ensureVisibleBottom(int offset)
                           throws javax.swing.text.BadLocationException
scrolls the viewport so that offset is completely visible at the bottom of the content pane

Parameters:
offset - the offset into the content to make visible
Returns:
the offset of the character located at the top of the window
Throws:
javax.swing.text.BadLocationException - if offset is an invalid location in the current document

gotoAddress

public void gotoAddress(java.lang.String address)
scrolls the document so that the position requested is at the top of the ContentPane

Parameters:
address - the address identifying the offset in question

setPage

public void setPage(java.lang.String address)

setPage

public void setPage(java.lang.String address,
                    boolean reload)
loads a new page and notifies listeners when loading is complete.

Parameters:
address - the page to load
reload - if the currently displayed page and the specified address are the same, true causes the page to reload

isPopupsEnabled

public boolean isPopupsEnabled()
Determines whether or not popup windows are shown when the mouse hovers over an annotation icon

Returns:

setPopupsEnabled

public void setPopupsEnabled(boolean popupsEnabled)
Specifies whether or not popup windows are shown when the mouse hovers over an annotation icon

Parameters:
popupsEnabled -

disableTypes

public void disableTypes(Notation.AnnotationType[] types,
                         boolean enableOthers)
Delegate method for the popupWindowHandler method of the same name

See Also:
PopupWindowNotationHandler.disableTypes(eTextReader.clientInterface.Notation.AnnotationType[], boolean)

enableTypes

public void enableTypes(Notation.AnnotationType[] types,
                        boolean disableOthers)
Delegate method for the popupWindowHandler method of the same name

Parameters:
types -
disableOthers -
See Also:
PopupWindowNotationHandler#enableTypes(AnnotationType[], boolean)

isTypeEnabled

public boolean isTypeEnabled(Notation.AnnotationType type)
Delegate method for the popupWindowHandler method of the same name

Parameters:
type -
Returns:
See Also:
PopupWindowNotationHandler#isTypeEnabled(AnnotationType)