public class ScalableXHTMLPanel extends XHTMLPanel
XHTMLPanel
to allow zoom on output.JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
SCALE_POLICY_FIT_HEIGHT |
static int |
SCALE_POLICY_FIT_WHOLE |
static int |
SCALE_POLICY_FIT_WIDTH |
static int |
SCALE_POLICY_NONE |
formSubmissionListener
active_element, doc, documentListeners, enclosingScrollPane, focus_element, hovered_element, sharedContext
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ScalableXHTMLPanel()
Instantiates an XHTMLPanel with no
Document loaded by default. |
ScalableXHTMLPanel(UserAgentCallback uac)
Instantiates a panel with a custom
UserAgentCallback
implementation. |
Modifier and Type | Method and Description |
---|---|
void |
addScaleChangeListener(ScaleChangeListener scl) |
protected void |
calculateScaleAccordingToPolicy(Dimension layoutSize) |
protected Point |
convertFromScaled(int x,
int y) |
protected Point |
convertFromScaled(Point origin) |
protected Point |
convertToScaled(int x,
int y) |
protected Point |
convertToScaled(Point origin) |
protected void |
doRender(RenderingContext c,
Layer root)
Renders according to scale factor
|
Box |
find(int x,
int y)
Search Box according to scale factor
|
double |
getScale() |
int |
getScalePolicy() |
void |
removeScaleChangeListener(ScaleChangeListener scl) |
void |
setDocument(Document doc,
String url)
Renders a Document using a URL as a base URL for relative
paths.
|
void |
setDocument(InputStream stream,
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) |
decrementFontSize, getMaxFontScale, getMinFontScale, incrementFontSize, relayout, resetFontSize, setDocument, setDocument, setDocument, setFontScalingFactor, setMaxFontScale, setMinFontScale, setSharedContext
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
addNotify, doDocumentLayout, doLayout, find, fireDocumentLoaded, fireDocumentStarted, fireOnLayoutException, fireOnRenderException, getCellRendererPane, getLayoutContext, getLayoutWidth, getPreferredScrollableViewportSize, getRootBox, getRootLayer, getScreenExtents, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, init, isDefaultFontFromComponent, isExtentsHaveChanged, isNeedRelayout, isPrintView, newLayoutContext, newRenderingContext, removeNotify, repaintRequested, resetScrollPosition, setDefaultFontFromComponent, setDocument, setEnclosingScrollPane, setNeedRelayout, setRootBox, validate
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusDownCycle, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final int SCALE_POLICY_NONE
public static final int SCALE_POLICY_FIT_WIDTH
public static final int SCALE_POLICY_FIT_HEIGHT
public static final int SCALE_POLICY_FIT_WHOLE
public ScalableXHTMLPanel()
Document
loaded by default.public ScalableXHTMLPanel(UserAgentCallback uac)
UserAgentCallback
implementation.uac
- The custom UserAgentCallback implementation.public void setDocument(Document doc, String url)
setDocument
in class XHTMLPanel
doc
- The new document valueurl
- The new document valuepublic void setDocument(InputStream stream, String url) throws Exception
setDocument
in class XHTMLPanel
stream
- The stream to read the Document from.url
- The URL used to resolve relative path references.Exception
public Box find(int x, int y)
public void setScale(double newScale) throws IllegalArgumentException
newScale
- The scale to useIllegalArgumentException
- If newScale <= 0.0d.public double getScale()
public void addScaleChangeListener(ScaleChangeListener scl)
public void removeScaleChangeListener(ScaleChangeListener scl)
protected void doRender(RenderingContext c, Layer root)
doRender
in class BasicPanel
c
- the RenderingContext to useroot
- The Layer to renderprotected void calculateScaleAccordingToPolicy(Dimension layoutSize)
protected Point convertToScaled(int x, int y)
protected Point convertFromScaled(int x, int y)
public int getScalePolicy()
public void setScalePolicy(int scalePolicy)
Copyright © 2017. All rights reserved.