Class JGVTComponent
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.apache.batik.swing.gvt.JGVTComponent
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
- Direct Known Subclasses:
JSVGComponent
This class represents a component which can display a GVT tree.
- Version:
- $Id$
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classTo hide the listener methods.protected classNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether to unconditionally disable interactions.protected booleanWhether the double buffering is enabled.protected AWTEventDispatcherThe event dispatcher.protected booleanWhether the GVT tree should be reactive to mouse and key events.protected GraphicsNodeThe GVT tree root.protected GVTTreeRendererThe GVT tree renderer.protected ListThe GVT tree renderer listeners.protected BufferedImageThe image to paint.protected AffineTransformThe initial rendering transform.protected InteractorThe current interactor.protected ListThe interactor list.protected ListThe JGVTComponentListener list.protected JGVTComponent.ListenerThe listener.protected booleanWhether a render was requested.protected ListThe overlays.protected AffineTransformThe transform used for painting.protected booleanWhether to allow progressive paint.protected HaltingThreadThe progressive paint thread.protected ImageRendererThe current renderer.protected ImageRendererFactoryThe renderer factory.protected AffineTransformThe transform used for rendering.protected booleanWhether the text should be selectable if eventEnabled is false, this flag is ignored.protected booleanWhether to suspend interactions.protected TextSelectionManagerThe text selection manager.protected booleanWhether the JGVTComponent should adhere to 'Unix' text selection semantics where as soon as text is selected it is copied to the clipboard.Fields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new JGVTComponent.JGVTComponent(boolean eventsEnabled, boolean selectableText) Creates a new JGVTComponent. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds the AWT listeners.voidAdds a GVTTreeRendererListener to this component.voidprotected booleanComputes the initial value of the transform used for rendering.protected AWTEventDispatcherprotected ImageRendererCreates a new renderer.protected JGVTComponent.ListenerCreates an instance of Listener.protected TextSelectionManager/////////////////////////////////////////////////////////////////////voidDeselects all.voidflush()Flush any cached image data (preliminary interface, may be removed or modified in the future).voidFlush a rectangle of cached image data (preliminary interface, may be removed or modified in the future).booleanReturns true if all 'interactor' objects (pan, zoom, etc) are disabled.booleanTells whether this component use double buffering to render SVG documents.Returns the root of the GVT tree displayed by this component, if any.Returns the initial transform.Returns the interactor list.Returns the off-screen image, if any.Returns the overlay list.Returns the current painting transform.booleanTells whether the progressive paint is enabled.Returns the current rendering transform.Returns the color of the selection overlay.Returns the color of the outline of the selection overlay.Returns the current Text selection manager for the Component.voidgetUseUnixTextSelection(boolean b) Returns true if the canvas will copy selections to the clipboard when they are completed.private voidprotected voidHandles an exception.voidRepaints immediately the component.protected voidInitializes the event handling classes.booleanReturns true if the selection overlay is painted in XOR mode, false otherwise.voidPaints this component.protected voidReleases the references to the rendering resources,voidRemoves a GVTTreeRendererListener from this component.voidprotected voidRenders the GVT tree.voidResets the rendering transform to its initial value.protected voidSchedules a new GVT rendering.voidSets the selection to the specified start and end mark.voidsetDisableInteractions(boolean b) Turn off all 'interactor' objects (pan, zoom, etc) if 'b' is true, turn them on if 'b' is false.voidsetDoubleBufferedRendering(boolean b) Sets whether this component should use double buffering to render SVG documents.voidSets the GVT tree to display.protected voidsetGraphicsNode(GraphicsNode gn, boolean createDispatcher) Sets the GVT tree to display.voidSets the painting transform.voidsetProgressivePaint(boolean b) Whether to enable the progressive paint.voidSets the rendering transform.voidsetRenderingTransform(AffineTransform at, boolean performRedraw) voidsetSelectionOverlayColor(Color color) Sets the color of the selection overlay to the specified color.voidSets the color of the outline of the selection overlay to the specified color.voidsetSelectionOverlayXORMode(boolean state) Sets whether or not the selection overlay will be painted in XOR mode, depending on the specified parameter.voidsetUseUnixTextSelection(boolean b) If 'b' is true text selections will copied to the clipboard immediately.voidStops the processing of the current tree.protected booleanUpdates the value of the transform used for rendering.Methods inherited from class JComponent
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, getUI, 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, updateUIMethods inherited from class 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, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
listener
The listener. -
gvtTreeRenderer
The GVT tree renderer. -
gvtRoot
The GVT tree root. -
rendererFactory
The renderer factory. -
renderer
The current renderer. -
gvtTreeRendererListeners
The GVT tree renderer listeners. -
needRender
protected boolean needRenderWhether a render was requested. -
progressivePaint
protected boolean progressivePaintWhether to allow progressive paint. -
progressivePaintThread
The progressive paint thread. -
image
The image to paint. -
initialTransform
The initial rendering transform. -
renderingTransform
The transform used for rendering. -
paintingTransform
The transform used for painting. -
interactors
The interactor list. -
interactor
The current interactor. -
overlays
The overlays. -
jgvtListeners
The JGVTComponentListener list. -
eventDispatcher
The event dispatcher. -
textSelectionManager
The text selection manager. -
doubleBufferedRendering
protected boolean doubleBufferedRenderingWhether the double buffering is enabled. -
eventsEnabled
protected boolean eventsEnabledWhether the GVT tree should be reactive to mouse and key events. -
selectableText
protected boolean selectableTextWhether the text should be selectable if eventEnabled is false, this flag is ignored. -
useUnixTextSelection
protected boolean useUnixTextSelectionWhether the JGVTComponent should adhere to 'Unix' text selection semantics where as soon as text is selected it is copied to the clipboard. If users want Mac/Windows behaviour they need to handle selections them selves. -
suspendInteractions
protected boolean suspendInteractionsWhether to suspend interactions. -
disableInteractions
protected boolean disableInteractionsWhether to unconditionally disable interactions.
-
-
Constructor Details
-
JGVTComponent
public JGVTComponent()Creates a new JGVTComponent. -
JGVTComponent
public JGVTComponent(boolean eventsEnabled, boolean selectableText) Creates a new JGVTComponent.- Parameters:
eventsEnabled- Whether the GVT tree should be reactive to mouse and key events.selectableText- Whether the text should be selectable. if eventEnabled is false, this flag is ignored.
-
-
Method Details
-
createListener
Creates an instance of Listener. -
addAWTListeners
protected void addAWTListeners()Adds the AWT listeners. -
setDisableInteractions
public void setDisableInteractions(boolean b) Turn off all 'interactor' objects (pan, zoom, etc) if 'b' is true, turn them on if 'b' is false. -
getDisableInteractions
public boolean getDisableInteractions()Returns true if all 'interactor' objects (pan, zoom, etc) are disabled. -
setUseUnixTextSelection
public void setUseUnixTextSelection(boolean b) If 'b' is true text selections will copied to the clipboard immediately. If 'b' is false then nothing will be done when selections are made (the application is responsable for copying the selection in response to user actions). -
getUseUnixTextSelection
public void getUseUnixTextSelection(boolean b) Returns true if the canvas will copy selections to the clipboard when they are completed. -
getInteractors
Returns the interactor list. -
getOverlays
Returns the overlay list. -
getOffScreen
Returns the off-screen image, if any. -
addJGVTComponentListener
-
removeJGVTComponentListener
-
resetRenderingTransform
public void resetRenderingTransform()Resets the rendering transform to its initial value. -
stopProcessing
public void stopProcessing()Stops the processing of the current tree. -
getGraphicsNode
Returns the root of the GVT tree displayed by this component, if any. -
setGraphicsNode
Sets the GVT tree to display. -
setGraphicsNode
Sets the GVT tree to display. -
initializeEventHandling
protected void initializeEventHandling()Initializes the event handling classes. -
createEventDispatcher
-
createTextSelectionManager
///////////////////////////////////////////////////////////////////// -
getTextSelectionManager
Returns the current Text selection manager for the Component. Users can register with this to be notifed of changes in the text selection. -
setSelectionOverlayColor
Sets the color of the selection overlay to the specified color.- Parameters:
color- the new color of the selection overlay
-
getSelectionOverlayColor
Returns the color of the selection overlay. -
setSelectionOverlayStrokeColor
Sets the color of the outline of the selection overlay to the specified color.- Parameters:
color- the new color of the outline of the selection overlay
-
getSelectionOverlayStrokeColor
Returns the color of the outline of the selection overlay. -
setSelectionOverlayXORMode
public void setSelectionOverlayXORMode(boolean state) Sets whether or not the selection overlay will be painted in XOR mode, depending on the specified parameter.- Parameters:
state- true implies the selection overlay will be in XOR mode
-
isSelectionOverlayXORMode
public boolean isSelectionOverlayXORMode()Returns true if the selection overlay is painted in XOR mode, false otherwise. -
select
-
deselectAll
public void deselectAll()Deselects all. -
setProgressivePaint
public void setProgressivePaint(boolean b) Whether to enable the progressive paint. -
getProgressivePaint
public boolean getProgressivePaint()Tells whether the progressive paint is enabled. -
getRenderRect
-
immediateRepaint
public void immediateRepaint()Repaints immediately the component. -
paintComponent
Paints this component.- Overrides:
paintComponentin classJComponent
-
setPaintingTransform
Sets the painting transform. A null transform is the same as an identity transform. The next repaint will use the given transform. -
getPaintingTransform
Returns the current painting transform. -
setRenderingTransform
Sets the rendering transform. Calling this method causes a rendering to be performed. -
setRenderingTransform
-
getInitialTransform
Returns the initial transform. -
getRenderingTransform
Returns the current rendering transform. -
setDoubleBufferedRendering
public void setDoubleBufferedRendering(boolean b) Sets whether this component should use double buffering to render SVG documents. The change will be effective during the next rendering. -
getDoubleBufferedRendering
public boolean getDoubleBufferedRendering()Tells whether this component use double buffering to render SVG documents. -
addGVTTreeRendererListener
Adds a GVTTreeRendererListener to this component. -
removeGVTTreeRendererListener
Removes a GVTTreeRendererListener from this component. -
flush
public void flush()Flush any cached image data (preliminary interface, may be removed or modified in the future). -
flush
Flush a rectangle of cached image data (preliminary interface, may be removed or modified in the future). -
createImageRenderer
Creates a new renderer. -
renderGVTTree
protected void renderGVTTree()Renders the GVT tree. -
computeRenderingTransform
protected boolean computeRenderingTransform()Computes the initial value of the transform used for rendering. Return true if a repaint is required, otherwise false. -
updateRenderingTransform
protected boolean updateRenderingTransform()Updates the value of the transform used for rendering. Return true if a repaint is required, otherwise false. -
handleException
Handles an exception. -
releaseRenderingReferences
protected void releaseRenderingReferences()Releases the references to the rendering resources, -
scheduleGVTRendering
protected void scheduleGVTRendering()Schedules a new GVT rendering. -
haltProgressivePaintThread
private void haltProgressivePaintThread()
-