org.xhtmlrenderer.swing
Class ScalableXHTMLPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.xhtmlrenderer.swing.RootPanel
org.xhtmlrenderer.swing.BasicPanel
org.xhtmlrenderer.simple.XHTMLPanel
org.xhtmlrenderer.swing.ScalableXHTMLPanel
- All Implemented Interfaces:
- ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, FSCanvas, UserInterface, FormSubmissionListener, RepaintListener
public class ScalableXHTMLPanel
- extends XHTMLPanel
ScalableXHTMLPanel extends XHTMLPanel to allow zoom on output.
- Author:
- chm
- See Also:
- Serialized Form
| 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, loadDocument, paintComponent, paintPage, printTree, reloadDocument, reloadDocument, removeDocumentListener, removeMouseTrackingListener, resetMouseTracker, scrollTo, setCenteredPagedView, setDocument, setDocument, setDocumentFromString, setDocumentRelative, setFormSubmissionListener, setInteractive, setLayout, setOpaque, setSize, submit |
| Methods inherited from class org.xhtmlrenderer.swing.RootPanel |
addNotify, componentHidden, componentMoved, componentResized, componentShown, doDocumentLayout, find, fireDocumentLoaded, fireDocumentStarted, fireOnLayoutException, fireOnRenderException, getCellRendererPane, getLayoutContext, getLayoutWidth, getRootBox, getRootLayer, getScreenExtents, init, isDefaultFontFromComponent, isExtentsHaveChanged, isNeedRelayout, isPrintView, newLayoutContext, newRenderingContext, removeNotify, repaintRequested, resetScrollPosition, setDefaultFontFromComponent, setDocument, setEnclosingScrollPane, setNeedRelayout, setRootBox, validate |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
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
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.
setDocument
public void setDocument(Document doc,
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 valueurl - The new document value
setDocument
public void setDocument(InputStream stream,
String url)
throws 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:
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 positiony - the displayed y position
setScale
public void setScale(double newScale)
throws IllegalArgumentException
- Force scale to use
- Parameters:
newScale - The scale to use
- Throws:
IllegalArgumentException - If newScale <= 0.0d.
getScale
public double getScale()
addScaleChangeListener
public void addScaleChangeListener(ScaleChangeListener scl)
removeScaleChangeListener
public void removeScaleChangeListener(ScaleChangeListener scl)
doRender
protected void doRender(RenderingContext c,
Layer root)
- Renders according to scale factor
- Overrides:
doRender in class BasicPanel
- Parameters:
c - the RenderingContext to useroot - The Layer to render
calculateScaleAccordingToPolicy
protected void calculateScaleAccordingToPolicy(Dimension layoutSize)
convertToScaled
protected Point convertToScaled(Point origin)
convertFromScaled
protected Point convertFromScaled(Point origin)
convertToScaled
protected Point convertToScaled(int x,
int y)
convertFromScaled
protected Point convertFromScaled(int x,
int y)
getScalePolicy
public int getScalePolicy()
setScalePolicy
public void setScalePolicy(int scalePolicy)
Copyright © 2013. All Rights Reserved.