Flying Saucer Project Release ${app.version}

org.xhtmlrenderer.swing
Class ScalableXHTMLPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.xhtmlrenderer.swing.RootPanel
                      extended by org.xhtmlrenderer.swing.BasicPanel
                          extended by org.xhtmlrenderer.simple.XHTMLPanel
                              extended by org.xhtmlrenderer.swing.ScalableXHTMLPanel
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, UserInterface, FormSubmissionListener

public class ScalableXHTMLPanel
extends XHTMLPanel

ScalableXHTMLPanel extends XHTMLPanel to allow zoom on output.

Author:
chm
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static int SCALE_POLICY_FIT_HEIGHT
           
static int SCALE_POLICY_FIT_WHOLE
           
static int SCALE_POLICY_FIT_WIDTH
           
static int SCALE_POLICY_NONE
           
 
Fields inherited from class org.xhtmlrenderer.swing.RootPanel
active_element, focus_element, hovered_element
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ScalableXHTMLPanel()
          Instantiates an XHTMLPanel with no Document loaded by default.
ScalableXHTMLPanel(UserAgentCallback uac)
          Instantiates a panel with a custom UserAgentCallback implementation.
 
Method Summary
 void addScaleChangeListener(ScaleChangeListener scl)
           
 Box find(int x, int y)
          Search Box according to scale factor
 double getScale()
           
 int getScalePolicy()
           
 void removeScaleChangeListener(ScaleChangeListener scl)
           
 void setDocument(org.w3c.dom.Document doc, java.lang.String url)
          Renders a Document using a URL as a base URL for relative paths.
 void setDocument(java.io.InputStream stream, java.lang.String url)
          Renders a Document read from an InputStream using a URL as a base URL for relative paths.
 void setScale(double newScale)
          Force scale to use
 void setScalePolicy(int scalePolicy)
           
 
Methods inherited from class org.xhtmlrenderer.simple.XHTMLPanel
decrementFontSize, getMaxFontScale, getMinFontScale, incrementFontSize, relayout, resetFontSize, setDocument, setDocument, setDocument, setFontScalingFactor, setMaxFontScale, setMinFontScale, setSharedContext
 
Methods inherited from class org.xhtmlrenderer.swing.BasicPanel
addDocumentListener, addMouseTrackingListener, assignPagePrintPositions, getDocument, getDocumentTitle, getFixedRectangle, getMouseTrackingListeners, getSharedContext, getURL, isActive, isCenteredPagedView, isFocus, isHover, isInteractive, isOpaque, paintComponent, paintPage, printTree, reloadDocument, reloadDocument, removeDocumentListener, removeMouseTrackingListener, scrollTo, setCenteredPagedView, setDocument, setDocument, setDocumentFromString, setFormSubmissionListener, setInteractive, setLayout, setOpaque, setSize, submit
 
Methods inherited from class org.xhtmlrenderer.swing.RootPanel
addNotify, componentHidden, componentMoved, componentResized, componentShown, doDocumentLayout, find, getLayoutContext, getLayoutWidth, getRootBox, getRootLayer, getScreenExtents, isPrintView, newRenderingContext, removeNotify, resetScrollPosition, setDocument, setRootBox
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCALE_POLICY_NONE

public static final int SCALE_POLICY_NONE
See Also:
Constant Field Values

SCALE_POLICY_FIT_WIDTH

public static final int SCALE_POLICY_FIT_WIDTH
See Also:
Constant Field Values

SCALE_POLICY_FIT_HEIGHT

public static final int SCALE_POLICY_FIT_HEIGHT
See Also:
Constant Field Values

SCALE_POLICY_FIT_WHOLE

public static final int SCALE_POLICY_FIT_WHOLE
See Also:
Constant Field Values
Constructor Detail

ScalableXHTMLPanel

public ScalableXHTMLPanel()
Instantiates an XHTMLPanel with no Document loaded by default.


ScalableXHTMLPanel

public ScalableXHTMLPanel(UserAgentCallback uac)
Instantiates a panel with a custom UserAgentCallback implementation.

Parameters:
uac - The custom UserAgentCallback implementation.
Method Detail

setDocument

public void setDocument(org.w3c.dom.Document doc,
                        java.lang.String url)
Renders a Document using a URL as a base URL for relative paths.

Overrides:
setDocument in class XHTMLPanel
Parameters:
doc - The new document value
url - The new document value

setDocument

public void setDocument(java.io.InputStream stream,
                        java.lang.String url)
                 throws java.lang.Exception
Renders a Document read from an InputStream using a URL as a base URL for relative paths.

Overrides:
setDocument in class XHTMLPanel
Parameters:
stream - The stream to read the Document from.
url - The URL used to resolve relative path references.
Throws:
java.lang.Exception

find

public Box find(int x,
                int y)
Search Box according to scale factor

Overrides:
find in class RootPanel
Parameters:
x - The displayed x position
y - the displayed y position

setScale

public void setScale(double newScale)
              throws java.lang.IllegalArgumentException
Force scale to use

Parameters:
newScale - The scale to use
Throws:
java.lang.IllegalArgumentException - If newScale <= 0.0d.

getScale

public double getScale()

addScaleChangeListener

public void addScaleChangeListener(ScaleChangeListener scl)

removeScaleChangeListener

public void removeScaleChangeListener(ScaleChangeListener scl)

getScalePolicy

public int getScalePolicy()

setScalePolicy

public void setScalePolicy(int scalePolicy)

Flying Saucer Project Release ${app.version}

Flying Saucer Project Home