public class JSVGCanvas extends JSVGComponent
JSVGCanvas
does not provided additional functionalities compared to
the JSVGComponent
but simply provides an API conformed to the
JavaBean specification. The only major change between the
JSVGComponent
and this component is that interactors and text
selection are activated by default.Modifier and Type | Class and Description |
---|---|
class |
JSVGCanvas.AffineAction
A swing action to append an affine transform to the current
rendering transform.
|
protected class |
JSVGCanvas.CanvasSVGListener
To hide the listener methods.
|
protected class |
JSVGCanvas.CanvasUserAgent
The
CanvasUserAgent only adds tooltips to the behavior of the
default BridgeUserAgent . |
protected static class |
JSVGCanvas.LocationListener
Helper class.
|
class |
JSVGCanvas.ResetTransformAction
A swing action to reset the rendering transform of the canvas.
|
class |
JSVGCanvas.RotateAction
A swing action to Rotate the canvas.
|
class |
JSVGCanvas.ScrollAction
A swing action to Pan/scroll the canvas.
|
class |
JSVGCanvas.ScrollDownAction
A swing action to scroll the canvas down,
by a fixed amount
|
class |
JSVGCanvas.ScrollLeftAction
A swing action to scroll the canvas to the left,
by a fixed amount
|
class |
JSVGCanvas.ScrollRightAction
A swing action to scroll the canvas to the right,
by a fixed amount
|
class |
JSVGCanvas.ScrollUpAction
A swing action to scroll the canvas up,
by a fixed amount
|
protected class |
JSVGCanvas.ToolTipModifier
Sets a specific tooltip on the JSVGCanvas when a given event occurs.
|
protected class |
JSVGCanvas.ToolTipRunnable |
class |
JSVGCanvas.ZoomAction
A swing action to apply a zoom factor to the canvas.
|
class |
JSVGCanvas.ZoomInAction
A swing action to zoom in the canvas.
|
class |
JSVGCanvas.ZoomOutAction
A swing action to zoom out the canvas.
|
JSVGComponent.BridgeUserAgent, JSVGComponent.BridgeUserAgentWrapper, JSVGComponent.JSVGComponentListener, JSVGComponent.SVGListener
JGVTComponent.Listener, JGVTComponent.UnixTextSelectionListener
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FAST_SCROLL_DOWN_ACTION
The key for the Action to quickly scroll down.
|
static java.lang.String |
FAST_SCROLL_LEFT_ACTION
The key for the Action to quickly scroll left.
|
static java.lang.String |
FAST_SCROLL_RIGHT_ACTION
The key for the Action to quickly scroll right.
|
static java.lang.String |
FAST_SCROLL_UP_ACTION
The key for the Action to quickly scroll up.
|
protected Interactor |
imageZoomInteractor
An interactor to perform a realtime zoom.
|
protected EventTarget |
lastTarget |
protected EventTarget |
lastToolTipEventTarget
The target for which the last tool tip event was fired.
|
protected long |
lastToolTipEventTimeStamp
The time of the last tool tip event.
|
protected JSVGCanvas.LocationListener |
locationListener
Keeps track of the last known mouse position over the canvas.
|
protected static java.lang.Object |
MAP_TOKEN
This is used as the value in the toolTipDocs WeakHashMap.
|
protected Interactor |
panInteractor
An interactor to perform a translation.
|
protected java.beans.PropertyChangeSupport |
pcs
The
PropertyChangeSupport used to fire
PropertyChangeEvent . |
static java.lang.String |
RESET_TRANSFORM_ACTION
The key for the Action to reset the transform.
|
protected Interactor |
resetTransformInteractor
An interactor to reset the rendering transform.
|
protected Interactor |
rotateInteractor
An interactor to perform a rotation.
|
static java.lang.String |
SCROLL_DOWN_ACTION
The key for the Action to scroll down.
|
static java.lang.String |
SCROLL_LEFT_ACTION
The key for the Action to scroll left.
|
static java.lang.String |
SCROLL_RIGHT_ACTION
The key for the Action to scroll right.
|
static java.lang.String |
SCROLL_UP_ACTION
The key for the Action to scroll up.
|
protected java.util.Map |
toolTipDocs |
protected EventListener |
toolTipListener |
protected java.util.Map |
toolTipMap
Mapping of elements to listeners so they can be removed,
if the tooltip is removed.
|
protected java.lang.String |
uri
The URI of the current document being displayed.
|
static java.lang.String |
ZOOM_IN_ACTION
The key for the Action to zoom in.
|
static java.lang.String |
ZOOM_OUT_ACTION
The key for the Action to zoom out.
|
protected Interactor |
zoomInteractor
An interactor to perform a zoom.
|
afterStopRunnable, ALWAYS_DYNAMIC, ALWAYS_INTERACTIVE, ALWAYS_STATIC, animationLimitingAmount, animationLimitingMode, AUTODETECT, bridgeContext, BROKEN_LINK_TITLE, documentLoader, documentState, FEATURES, fragmentIdentifier, gvtTreeBuilder, gvtTreeBuilderListeners, isDynamicDocument, isInteractiveDocument, jsvgComponentListener, linkActivationListeners, loader, nextDocumentLoader, nextGVTTreeBuilder, nextUpdateManager, prevComponentSize, recenterOnResize, SCRIPT_ALERT, SCRIPT_CONFIRM, SCRIPT_PROMPT, selfCallingDisableInteractions, svgDocument, svgDocumentLoaderListeners, svgLoadEventDispatcher, svgLoadEventDispatcherListeners, svgUserAgent, updateManager, updateManagerListeners, updateOverlay, userAgent, userSetDisableInteractions, viewingTransform
disableInteractions, doubleBufferedRendering, eventDispatcher, eventsEnabled, gvtRoot, gvtTreeRenderer, gvtTreeRendererListeners, image, initialTransform, interactor, interactors, jgvtListeners, listener, needRender, overlays, paintingTransform, progressivePaint, progressivePaintThread, renderer, rendererFactory, renderingTransform, selectableText, suspendInteractions, textSelectionManager, useUnixTextSelection
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
JSVGCanvas()
Creates a new JSVGCanvas.
|
JSVGCanvas(SVGUserAgent ua,
boolean eventsEnabled,
boolean selectableText)
Creates a new JSVGCanvas.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds the specified
PropertyChangeListener . |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener pcl)
Adds the specified
PropertyChangeListener for the specified
property. |
protected JGVTComponent.Listener |
createListener()
Creates an instance of Listener.
|
protected UserAgent |
createUserAgent()
Creates a UserAgent.
|
boolean |
getEnableImageZoomInteractor()
Returns true if the image zoom interactor is enabled, false otherwise.
|
boolean |
getEnablePanInteractor()
Returns true if the pan interactor is enabled, false otherwise.
|
boolean |
getEnableResetTransformInteractor()
Returns true if the reset transform interactor is enabled, false
otherwise.
|
boolean |
getEnableRotateInteractor()
Returns true if the rotate interactor is enabled, false otherwise.
|
boolean |
getEnableZoomInteractor()
Returns true if the zoom interactor is enabled, false otherwise.
|
java.lang.String |
getURI()
Returns the URI of the current document.
|
protected void |
installActions()
Builds the ActionMap of this canvas with a set of predefined
Action s. |
protected void |
installKeyboardActions()
Builds the InputMap of this canvas with a set of predefined
Action s. |
protected void |
installSVGDocument(org.w3c.dom.svg.SVGDocument doc)
This does the real work of installing the SVG Document after
the update manager from the previous document (if any) has been
properly 'shut down'.
|
boolean |
matchLastToolTipEvent(long t,
EventTarget et)
Checks if the specified event time and element are the same
as the last tool tip event.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes the specified
PropertyChangeListener . |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener pcl)
Removes the specified
PropertyChangeListener for the specified
property. |
void |
setDisableInteractions(boolean b)
Turn off all 'interactor' objects (pan, zoom, etc) if
'b' is true, turn them on if 'b' is false.
|
void |
setEnableImageZoomInteractor(boolean b)
Determines whether the image zoom interactor is enabled or not.
|
void |
setEnablePanInteractor(boolean b)
Determines whether the pan interactor is enabled or not.
|
void |
setEnableResetTransformInteractor(boolean b)
Determines whether the reset transform interactor is enabled or not.
|
void |
setEnableRotateInteractor(boolean b)
Determines whether the rotate interactor is enabled or not.
|
void |
setEnableZoomInteractor(boolean b)
Determines whether the zoom interactor is enabled or not.
|
void |
setLastToolTipEvent(long t,
EventTarget et)
Sets the time and element of the last tool tip event handled.
|
void |
setURI(java.lang.String newURI)
Sets the URI to the specified uri.
|
addGVTTreeBuilderListener, addLinkActivationListener, addSVGDocumentLoaderListener, addSVGLoadEventDispatcherListener, addUpdateManagerListener, calculateViewingTransform, clearUserSetDisableInteractions, computeRenderingTransform, createBridgeContext, createImageRenderer, dispose, flushImageCache, getCanvasGraphicsNode, getCanvasGraphicsNode, getFragmentIdentifier, getInterpreter, getRecenterOnResize, getSVGDocument, getSVGDocumentSize, getUpdateManager, getViewBoxTransform, getViewingTransform, handleException, isDynamic, isInteractive, loadSVGDocument, removeGVTTreeBuilderListener, removeLinkActivationListener, removeSVGDocumentLoaderListener, removeSVGLoadEventDispatcherListener, removeUpdateManagerListener, renderGVTTree, resumeProcessing, setAnimationLimitingCPU, setAnimationLimitingFPS, setAnimationLimitingNone, setBridgeContextAnimationLimitingMode, setDocument, setDocumentState, setFragmentIdentifier, setGraphicsNode, setMySize, setRecenterOnResize, setSVGDocument, showAlert, showConfirm, showPrompt, showPrompt, startGVTTreeBuilder, startSVGLoadEventDispatcher, stopProcessing, stopThenRun, suspendProcessing, updateRenderingTransform, updateZoomAndPanEnable
addAWTListeners, addGVTTreeRendererListener, addJGVTComponentListener, createEventDispatcher, createTextSelectionManager, deselectAll, flush, flush, getDisableInteractions, getDoubleBufferedRendering, getGraphicsNode, getInitialTransform, getInteractors, getOffScreen, getOverlays, getPaintingTransform, getProgressivePaint, getRenderingTransform, getRenderRect, getSelectionOverlayColor, getSelectionOverlayStrokeColor, getTextSelectionManager, getUseUnixTextSelection, immediateRepaint, initializeEventHandling, isSelectionOverlayXORMode, paintComponent, releaseRenderingReferences, removeGVTTreeRendererListener, removeJGVTComponentListener, resetRenderingTransform, scheduleGVTRendering, select, setDoubleBufferedRendering, setGraphicsNode, setPaintingTransform, setProgressivePaint, setRenderingTransform, setRenderingTransform, setSelectionOverlayColor, setSelectionOverlayStrokeColor, setSelectionOverlayXORMode, setUseUnixTextSelection
addAncestorListener, addNotify, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
add, add, add, add, add, addContainerListener, addImpl, 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, setLayout, transferFocusDownCycle, validate, 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, getAccessibleContext, 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, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String SCROLL_RIGHT_ACTION
public static final java.lang.String SCROLL_LEFT_ACTION
public static final java.lang.String SCROLL_UP_ACTION
public static final java.lang.String SCROLL_DOWN_ACTION
public static final java.lang.String FAST_SCROLL_RIGHT_ACTION
public static final java.lang.String FAST_SCROLL_LEFT_ACTION
public static final java.lang.String FAST_SCROLL_UP_ACTION
public static final java.lang.String FAST_SCROLL_DOWN_ACTION
public static final java.lang.String ZOOM_IN_ACTION
public static final java.lang.String ZOOM_OUT_ACTION
public static final java.lang.String RESET_TRANSFORM_ACTION
protected java.beans.PropertyChangeSupport pcs
PropertyChangeSupport
used to fire
PropertyChangeEvent
.protected java.lang.String uri
protected JSVGCanvas.LocationListener locationListener
protected java.util.Map toolTipMap
protected EventListener toolTipListener
protected EventTarget lastTarget
protected java.util.Map toolTipDocs
protected static final java.lang.Object MAP_TOKEN
protected long lastToolTipEventTimeStamp
protected EventTarget lastToolTipEventTarget
protected Interactor zoomInteractor
Binding: BUTTON1 + CTRL Key
protected Interactor imageZoomInteractor
Binding: BUTTON3 + SHIFT Key
protected Interactor panInteractor
Binding: BUTTON1 + SHIFT Key
protected Interactor rotateInteractor
Binding: BUTTON3 + CTRL Key
protected Interactor resetTransformInteractor
Binding: CTRL+SHIFT+BUTTON3
public JSVGCanvas()
public JSVGCanvas(SVGUserAgent ua, boolean eventsEnabled, boolean selectableText)
ua
- a SVGUserAgent instance or null.eventsEnabled
- Whether the GVT tree should be reactive to mouse
and key events.selectableText
- Whether the text should be selectable.protected void installActions()
Action
s.public void setDisableInteractions(boolean b)
JGVTComponent
setDisableInteractions
in class JSVGComponent
protected void installKeyboardActions()
Action
s.public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
PropertyChangeListener
.addPropertyChangeListener
in class java.awt.Container
pcl
- the property change listener to addpublic void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
PropertyChangeListener
.removePropertyChangeListener
in class java.awt.Component
pcl
- the property change listener to removepublic void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)
PropertyChangeListener
for the specified
property.addPropertyChangeListener
in class java.awt.Container
propertyName
- the name of the property to listen onpcl
- the property change listener to addpublic void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener pcl)
PropertyChangeListener
for the specified
property.removePropertyChangeListener
in class java.awt.Component
propertyName
- the name of the property that was listened onpcl
- the property change listener to removepublic void setEnableZoomInteractor(boolean b)
public boolean getEnableZoomInteractor()
public void setEnableImageZoomInteractor(boolean b)
public boolean getEnableImageZoomInteractor()
public void setEnablePanInteractor(boolean b)
public boolean getEnablePanInteractor()
public void setEnableRotateInteractor(boolean b)
public boolean getEnableRotateInteractor()
public void setEnableResetTransformInteractor(boolean b)
public boolean getEnableResetTransformInteractor()
public java.lang.String getURI()
public void setURI(java.lang.String newURI)
newURI
- the new uri of the document to displayprotected UserAgent createUserAgent()
createUserAgent
in class JSVGComponent
protected JGVTComponent.Listener createListener()
createListener
in class JSVGComponent
protected void installSVGDocument(org.w3c.dom.svg.SVGDocument doc)
JSVGComponent
installSVGDocument
in class JSVGComponent
public void setLastToolTipEvent(long t, EventTarget et)
public boolean matchLastToolTipEvent(long t, EventTarget et)
Copyright © 2022 Apache Software Foundation. All Rights Reserved.