|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--org.apache.batik.refimpl.util.JSVGCanvas
This class implements a JComponent which is able to display a SVG document.
Inner Class Summary | |
protected class |
JSVGCanvas.CanvasListener
To correctly resize the view. |
protected class |
JSVGCanvas.MouseListener
To handle the mouse events. |
protected class |
JSVGCanvas.MutationListener
To listener to the DOM mutation events. |
protected class |
JSVGCanvas.RepaintTimer
Timer class which fires periodic repaint request while buffer is being painted. |
protected class |
JSVGCanvas.ThumbnailCanvas
This class represents the thumbnail canvas. |
class |
JSVGCanvas.UnzoomAction
To reset the zoom. |
static interface |
JSVGCanvas.ZoomHandler
Interface implemented by zoom handlers. |
class |
JSVGCanvas.ZoomInAction
To zoom in the document. |
class |
JSVGCanvas.ZoomOutAction
To zoom out the document. |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected java.awt.image.BufferedImage |
buffer
The current offscreen buffer. |
protected boolean |
bufferNeedsRendering
Must the buffer be updated? |
protected GVTBuilder |
builder
The GVT builder. |
protected java.awt.Shape |
docBBox
The pan bounding box. |
protected SVGDocument |
document
The SVG document to render. |
protected boolean |
documentTransformed
Whether or not the current document was transformed. |
protected java.awt.image.BufferedImage |
globalBuffer
The global offscreen buffer. |
protected GraphicsNode |
gvtRoot
Root of the GVT tree displayed by this viewer |
protected double |
initialScale
The initial scale factor. |
protected boolean |
isLoadPending
Is there a document load pending? |
protected java.util.Map |
listeners
The map that contains the listeners |
protected java.lang.Object |
loadPendingLock
An object used to synchronize access to loadPending flag. |
protected java.awt.geom.Line2D |
markerBottom
The zoom marker bottom line. |
protected java.awt.geom.Line2D |
markerLeft
The zoom marker left line. |
protected java.awt.geom.Line2D |
markerRight
The zoom marker right line. |
protected java.awt.BasicStroke |
markerStroke
Used to draw marker |
protected java.awt.geom.Line2D |
markerTop
The zoom marker top line. |
static java.awt.Cursor |
NORMAL_CURSOR
The default cursor. |
static java.awt.Cursor |
PAN_CURSOR
The cursor for panning. |
protected java.awt.geom.AffineTransform |
panTransform
The transform representing the pan tranlate. |
protected ParserFactory |
parserFactory
The parser factory. |
protected java.awt.geom.AffineTransform |
previousRotateTransform
The transform representing the previous rotation. |
protected boolean |
progressiveRenderingEnabled
Fires periodic repaints while buffer is rendered |
protected RendererFactory |
rendererFactory
The renderer factory. |
java.awt.Cursor |
requestedCursor
The cursor which has been most recently requested by a background thread. |
static java.awt.Cursor |
ROTATE_CURSOR
The cursor for rotating. |
protected double |
rotateAngle
The rotation angle |
protected double |
rotateCos
The rotation cosinus |
protected java.awt.Shape |
rotateMarker
The rotate marker. |
protected java.awt.geom.AffineTransform |
rotateTransform
The transform representing the rotation. |
protected java.awt.Shape |
selectionHighlightShape
The selection highlight shape. |
protected static java.awt.Color |
selectionXORColor
The color used for the XOR painting of the selection highlight. |
static java.awt.Cursor |
TEXT_CURSOR
The cursor indicating that a text selection operation is under way. |
protected Selector |
textSelector
The text selector. |
protected JSVGCanvas.ThumbnailCanvas |
thumbnailCanvas
The thumbnail canvas. |
protected java.awt.geom.AffineTransform |
transform
The transform to apply to the graphics object. |
static java.lang.String |
UNZOOM_ACTION
|
protected UserAgent |
userAgent
The user agent. |
static java.awt.Cursor |
WAIT_CURSOR
The cursor indicating that an operation is pending. |
static java.awt.Cursor |
ZOOM_CURSOR
The cursor for zooming. |
static java.lang.String |
ZOOM_IN_ACTION
|
static java.lang.String |
ZOOM_OUT_ACTION
|
protected JSVGCanvas.ZoomHandler |
zoomHandler
The zoom handler. |
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JSVGCanvas()
Creates a new SVG canvas. |
|
JSVGCanvas(UserAgent ua)
Creates a new SVG canvas, associating it with a UserAgent. |
Method Summary | |
protected void |
clearBuffer(java.awt.image.BufferedImage buffer,
int w,
int h)
Clears a specific buffer. |
protected void |
clearBuffer(int w,
int h)
Clears the offscreen buffer. |
protected void |
clearBuffer(java.awt.Shape aoi)
Clears the offscreen buffer. |
protected void |
computeTransform()
Computes the value of the transform attribute. |
protected BridgeContext |
createBridgeContext(SVGDocument doc)
Creates a new bridge context. |
javax.swing.Action |
getAction(java.lang.String key)
Returns the action associated with the given string or null on error |
protected java.awt.Shape |
getAreaOfInterest(java.awt.Shape devAOI)
|
java.awt.image.BufferedImage |
getBuffer()
Returns the current buffer. |
RendererFactory |
getRendererFactory()
Returns the current renderer factory. |
protected java.awt.Cursor |
getRequestedCursor()
Gets the value of the requested cursor, but in a thread-safe way. |
javax.swing.JComponent |
getThumbnail()
Returns the thumbnail. |
java.awt.geom.AffineTransform |
getTransform()
Returns the current document-to-device space transform. |
void |
initSelectors(GraphicsNode treeRoot)
Associate selectable elements in the current tree with Selector instances. |
boolean |
isLoadPending()
Returns boolean indicating whether there is a document load pending. |
boolean |
isProgressiveRenderingEnabled()
Returns boolean indicating whether progressive rendering is enabled. |
void |
notifyRepaintedRegion(java.awt.Shape oldAoi,
java.awt.Shape newAoi,
Renderer renderer)
Notifies that the specified area of interest need to be repainted. |
protected void |
paintComponent(java.awt.Graphics g)
Paints this component into a graphics context. |
protected void |
paintOverlays(java.awt.Graphics g)
Paints the canvas "overlay" primitives (rotation box, zoom AOI box, highlight [not yet implemented], etc. |
protected void |
paintPanRegions(java.awt.Graphics2D g2d,
int tx,
int ty,
int w,
int h)
Repaints the pan blank regions. |
protected void |
repaintAOI(Renderer renderer,
java.awt.Dimension size,
java.awt.image.BufferedImage buffer)
Initiates the repainting of the offscreen buffer in a background thread. |
protected void |
requestCursor(java.awt.Cursor newCursor)
Sets the value of the requested cursor, but in a thread-safe way. |
void |
selectionChanged(SelectionEvent e)
Invoked when a selection has changed |
void |
setIsLoadPending(boolean value)
Sets the value of a flag indicating whether there is a load pending: |
void |
setProgressiveRenderingEnabled(boolean value)
Sets the value of the progressive rendering flag: true enables progressive rendering, false disables it. |
void |
setRendererFactory(RendererFactory rf)
Sets the renderer factory to use to create the renderer. |
void |
setRootNode(GraphicsNode root,
BridgeContext bridgeContext,
SVGDocument document)
Sets the root node adn current document, notifies the document that it has been installed, and issues necessary notifications and repaints to this JSVGCanvas. |
void |
setSVGDocument(SVGDocument doc)
Sets the SVG document to display. |
void |
setZoomHandler(JSVGCanvas.ZoomHandler h)
Sets the zoom handler. |
protected void |
updateBaseTransform()
Updates the document bounding box, selection highlight and event dispatcher coordinate system based on the new value of the transform attribute. |
protected void |
updateBuffer(int w,
int h)
Updates the offscreen buffer. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String UNZOOM_ACTION
public static final java.lang.String ZOOM_IN_ACTION
public static final java.lang.String ZOOM_OUT_ACTION
public static final java.awt.Cursor PAN_CURSOR
public static final java.awt.Cursor ZOOM_CURSOR
public static final java.awt.Cursor ROTATE_CURSOR
public static final java.awt.Cursor NORMAL_CURSOR
public static final java.awt.Cursor WAIT_CURSOR
public static final java.awt.Cursor TEXT_CURSOR
public java.awt.Cursor requestedCursor
protected java.awt.image.BufferedImage globalBuffer
protected java.awt.image.BufferedImage buffer
protected GraphicsNode gvtRoot
protected RendererFactory rendererFactory
protected GVTBuilder builder
protected SVGDocument document
protected boolean bufferNeedsRendering
protected boolean isLoadPending
protected UserAgent userAgent
protected java.awt.geom.AffineTransform transform
protected java.awt.geom.AffineTransform panTransform
protected java.awt.geom.AffineTransform rotateTransform
protected java.awt.geom.AffineTransform previousRotateTransform
protected java.awt.Shape docBBox
protected java.awt.geom.Line2D markerTop
protected java.awt.geom.Line2D markerLeft
protected java.awt.geom.Line2D markerBottom
protected java.awt.geom.Line2D markerRight
protected java.awt.Shape rotateMarker
protected java.awt.Shape selectionHighlightShape
protected JSVGCanvas.ThumbnailCanvas thumbnailCanvas
protected ParserFactory parserFactory
protected Selector textSelector
protected JSVGCanvas.ZoomHandler zoomHandler
protected double rotateAngle
protected double rotateCos
protected double initialScale
protected boolean progressiveRenderingEnabled
protected boolean documentTransformed
protected java.awt.BasicStroke markerStroke
protected java.lang.Object loadPendingLock
protected java.util.Map listeners
protected static java.awt.Color selectionXORColor
Constructor Detail |
public JSVGCanvas()
public JSVGCanvas(UserAgent ua)
Method Detail |
public void setRendererFactory(RendererFactory rf)
public void setProgressiveRenderingEnabled(boolean value)
public boolean isProgressiveRenderingEnabled()
public void setIsLoadPending(boolean value)
public boolean isLoadPending()
public void setZoomHandler(JSVGCanvas.ZoomHandler h)
public RendererFactory getRendererFactory()
public void setSVGDocument(SVGDocument doc)
doc
- if null, clears the canvas.public void setRootNode(GraphicsNode root, BridgeContext bridgeContext, SVGDocument document)
public void notifyRepaintedRegion(java.awt.Shape oldAoi, java.awt.Shape newAoi, Renderer renderer)
notifyRepaintedRegion
in interface DynamicRenderer.RepaintHandler
oldAoi
- the previous area of interestnewAoi
- the new area of interest to repaintrenderer
- the Renderer instance which does the repainting
Note: this function has not yet been modified to allow background
rendering into the offscreen buffer, so it will block the AWT
event thread.protected void requestCursor(java.awt.Cursor newCursor)
protected java.awt.Cursor getRequestedCursor()
protected BridgeContext createBridgeContext(SVGDocument doc)
public javax.swing.JComponent getThumbnail()
public void initSelectors(GraphicsNode treeRoot)
public void selectionChanged(SelectionEvent e)
SelectionListener
selectionChanged
in interface SelectionListener
org.apache.batik.gvt.event.SelectionListener
evt
- the selection change eventSelector
,
SelectionEvent
,
Selectable
public javax.swing.Action getAction(java.lang.String key) throws MissingListenerException
getAction
in interface ActionMap
key
- the key mapped with the action to getMissingListenerException
- if the action is not foundprotected void clearBuffer(int w, int h)
protected void clearBuffer(java.awt.Shape aoi)
protected void clearBuffer(java.awt.image.BufferedImage buffer, int w, int h)
protected java.awt.Shape getAreaOfInterest(java.awt.Shape devAOI)
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
protected void paintOverlays(java.awt.Graphics g)
protected void paintPanRegions(java.awt.Graphics2D g2d, int tx, int ty, int w, int h)
protected void updateBuffer(int w, int h)
w h
- The size of the component.public java.awt.image.BufferedImage getBuffer()
protected void computeTransform()
protected void updateBaseTransform()
public java.awt.geom.AffineTransform getTransform()
protected void repaintAOI(Renderer renderer, java.awt.Dimension size, java.awt.image.BufferedImage buffer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |