## org.apache.batik.swing.gvt
Class JGVTComponent

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  org.apache.batik.swing.gvt.JGVTComponent

All Implemented Interfaces:
  java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

Direct Known Subclasses:
  JSVGComponent

public class JGVTComponent
extends javax.swing.JComponent

This class represents a component which can display a GVT tree.

See Also:
  Serialized Form

Nested Class Summary
`protected class` `JGVTComponent.Listener` To hide the listener methods.

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected boolean` `disableInteractions` Whether to unconditionally disable interactions.
`protected boolean` `doubleBufferedRendering` Whether the double buffering is enabled.
`protected AWTEventDispatcher` `eventDispatcher` The event dispatcher.
`protected boolean` `eventsEnabled` Whether the GVT tree should be reactive to mouse and key events.
`protected GraphicsNode` `gvtRoot` The GVT tree root.
`protected GVTTreeRenderer` `gvtTreeRenderer` The GVT tree renderer.
`protected java.util.List` `gvtTreeRendererListeners` The GVT tree renderer listeners.
`protected java.awt.image.BufferedImage` `image` The image to paint.
`protected java.awt.geom.AffineTransform` `initialTransform` The initial rendering transform.
`protected Interactor` `interactor` The current interactor.
`protected java.util.List` `interactors` The interactor list.
`protected java.util.List` `jgvtListeners` The JGVTComponentListener list.
`protected JGVTComponent.Listener` `listener` The listener.
`protected boolean` `needRender` Whether a render was requested.
`protected java.util.List` `overlays` The overlays.
`protected java.awt.geom.AffineTransform` `paintingTransform` The transform used for painting.
`protected boolean` `progressivePaint` Whether to allow progressive paint.
`protected java.lang.Thread` `progressivePaintThread` The progressive paint thread.
`protected ImageRenderer` `renderer` The current renderer.
`protected ImageRendererFactory` `rendererFactory` The renderer factory.
`protected java.awt.geom.AffineTransform` `renderingTransform` The transform used for rendering.
`protected boolean` `selectableText` Whether the text should be selectable if eventEnabled is false, this flag is ignored.
`protected boolean` `suspendInteractions` Whether to suspend interactions.
`protected TextSelectionManager` `textSelectionManager` The text selection manager.

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
`JGVTComponent()` Creates a new JGVTComponent.
`JGVTComponent(boolean eventsEnabled, boolean selectableText)` Creates a new JGVTComponent.

Method Summary
`void` `addGVTTreeRendererListener(GVTTreeRendererListener l)` Adds a GVTTreeRendererListener to this component.
`void` `addJGVTComponentListener(JGVTComponentListener listener)`
`protected boolean` `computeRenderingTransform()` Computes the initial value of the transform used for rendering.
`protected ImageRenderer` `createImageRenderer()` Creates a new renderer.
`protected JGVTComponent.Listener` `createListener()` Creates an instance of Listener.
`void` `deselectAll()` Deselects all.
`void` `flush()` Flush any cached image data (preliminary interface, may be removed or modified in the future).
`void` `flush(java.awt.Rectangle r)` Flush a rectangle of cached image data (preliminary interface, may be removed or modified in the future).
`boolean` `getDisableInteractions()`
`boolean` `getDoubleBufferedRendering()` Tells whether this component use double buffering to render SVG documents.
`GraphicsNode` `getGraphicsNode()` Returns the root of the GVT tree displayed by this component, if any.
`java.awt.geom.AffineTransform` `getInitialTransform()` Returns the initial transform.
`java.util.List` `getInteractors()` Returns the interactor list.
`java.awt.image.BufferedImage` `getOffScreen()` Returns the off-screen image, if any.
`java.util.List` `getOverlays()` Returns the overlay list.
`java.awt.geom.AffineTransform` `getPaintingTransform()` Returns the current painting transform.
`boolean` `getProgressivePaint()` Tells whether the progressive paint is enabled.
`java.awt.geom.AffineTransform` `getRenderingTransform()` Returns the current rendering transform.
`java.awt.Rectangle` `getRenderRect()`
`java.awt.Color` `getSelectionOverlayColor()` Returns the color of the selection overlay.
`java.awt.Color` `getSelectionOverlayStrokeColor()` Returns the color of the outline of the selection overlay.
`protected void` `handleException(java.lang.Exception e)` Handles an exception.
`void` `immediateRepaint()` Repaints immediately the component.
`protected void` `initializeEventHandling()` Initializes the event handling classes.
`boolean` `isSelectionOverlayXORMode()` Returns true if the selection overlay is painted in XOR mode, false otherwise.
`void` `paintComponent(java.awt.Graphics g)` Paints this component.
`protected void` `releaseRenderingReferences()` Releases the references to the rendering resources,
`void` `removeGVTTreeRendererListener(GVTTreeRendererListener l)` Removes a GVTTreeRendererListener from this component.
`void` `removeJGVTComponentListener(JGVTComponentListener listener)`
`protected void` `renderGVTTree()` Renders the GVT tree.
`void` `resetRenderingTransform()` Resets the rendering transform to its initial value.
`protected void` `scheduleGVTRendering()` Schedules a new GVT rendering.
`void` `select(Mark start, Mark end)` Sets the selection to the specified start and end mark.
`void` `setDisableInteractions(boolean b)`
`void` `setDoubleBufferedRendering(boolean b)` Sets whether this component should use double buffering to render SVG documents.
`void` `setGraphicsNode(GraphicsNode gn)` Sets the GVT tree to display.
`protected void` `setGraphicsNode(GraphicsNode gn, boolean createDispatcher)` Sets the GVT tree to display.
`void` `setPaintingTransform(java.awt.geom.AffineTransform at)` Sets the painting transform.
`void` `setProgressivePaint(boolean b)` Whether to enable the progressive paint.
`void` `setRenderingTransform(java.awt.geom.AffineTransform at)` Sets the rendering transform.
`void` `setRenderingTransform(java.awt.geom.AffineTransform at, boolean performRedraw)`
`void` `setSelectionOverlayColor(java.awt.Color color)` Sets the color of the selection overlay to the specified color.
`void` `setSelectionOverlayStrokeColor(java.awt.Color color)` Sets the color of the outline of the selection overlay to the specified color.
`void` `setSelectionOverlayXORMode(boolean state)` Sets whether or not the selection overlay will be painted in XOR mode, depending on the specified parameter.
`void` `stopProcessing()` Stops the processing of the current tree.
`protected boolean` `updateRenderingTransform()` Updates the value of the transform used for rendering.

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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, 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, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### listener

    protected JGVTComponent.Listener listener

  The listener.

### gvtTreeRenderer

    protected GVTTreeRenderer gvtTreeRenderer

  The GVT tree renderer.

### gvtRoot

    protected GraphicsNode gvtRoot

  The GVT tree root.

### rendererFactory

    protected ImageRendererFactory rendererFactory

  The renderer factory.

### renderer

    protected ImageRenderer renderer

  The current renderer.

### gvtTreeRendererListeners

    protected java.util.List gvtTreeRendererListeners

  The GVT tree renderer listeners.

### needRender

    protected boolean needRender

  Whether a render was requested.

### progressivePaint

    protected boolean progressivePaint

  Whether to allow progressive paint.

### progressivePaintThread

    protected java.lang.Thread progressivePaintThread

  The progressive paint thread.

### image

    protected java.awt.image.BufferedImage image

  The image to paint.

### initialTransform

    protected java.awt.geom.AffineTransform initialTransform

  The initial rendering transform.

### renderingTransform

    protected java.awt.geom.AffineTransform renderingTransform

  The transform used for rendering.

### paintingTransform

    protected java.awt.geom.AffineTransform paintingTransform

  The transform used for painting.

### interactors

    protected java.util.List interactors

  The interactor list.

### interactor

    protected Interactor interactor

  The current interactor.

### overlays

    protected java.util.List overlays

  The overlays.

### jgvtListeners

    protected java.util.List jgvtListeners

  The JGVTComponentListener list.

### eventDispatcher

    protected AWTEventDispatcher eventDispatcher

  The event dispatcher.

### textSelectionManager

    protected TextSelectionManager textSelectionManager

  The text selection manager.

### doubleBufferedRendering

    protected boolean doubleBufferedRendering

  Whether the double buffering is enabled.

### eventsEnabled

    protected boolean eventsEnabled

  Whether the GVT tree should be reactive to mouse and key events.

### selectableText

    protected boolean selectableText

  Whether the text should be selectable if eventEnabled is false, this flag is ignored.

### suspendInteractions

    protected boolean suspendInteractions

  Whether to suspend interactions.

### disableInteractions

    protected boolean disableInteractions

  Whether to unconditionally disable interactions.

Constructor Detail

### JGVTComponent

    public JGVTComponent()

  Creates a new JGVTComponent.

### JGVTComponent

    public JGVTComponent(boolean eventsEnabled,
                         boolean selectableText)

  Creates a new JGVTComponent.

Parameters:
  `selectableText` - Whether the text should be selectable. if eventEnabled is false, this flag is ignored.

Method Detail

### setDisableInteractions

    public void setDisableInteractions(boolean b)

### getDisableInteractions

    public boolean getDisableInteractions()

### getInteractors

    public java.util.List getInteractors()

  Returns the interactor list.

### getOverlays

    public java.util.List getOverlays()

  Returns the overlay list.

### getOffScreen

    public java.awt.image.BufferedImage getOffScreen()

  Returns the off-screen image, if any.

### addJGVTComponentListener

    public void addJGVTComponentListener(JGVTComponentListener listener)

### removeJGVTComponentListener

    public void removeJGVTComponentListener(JGVTComponentListener listener)

### resetRenderingTransform

    public void resetRenderingTransform()

  Resets the rendering transform to its initial value.

### stopProcessing

    public void stopProcessing()

  Stops the processing of the current tree.

### getGraphicsNode

    public GraphicsNode getGraphicsNode()

  Returns the root of the GVT tree displayed by this component, if any.

### setGraphicsNode

    public void setGraphicsNode(GraphicsNode gn)

  Sets the GVT tree to display.

### setGraphicsNode

    protected void setGraphicsNode(GraphicsNode gn,
                                   boolean createDispatcher)

  Sets the GVT tree to display.

### initializeEventHandling

    protected void initializeEventHandling()

  Initializes the event handling classes.

### setSelectionOverlayColor

    public void setSelectionOverlayColor(java.awt.Color color)

  Sets the color of the selection overlay to the specified color.

  Parameters:
    `color` - the new color of the selection overlay

### getSelectionOverlayColor

    public java.awt.Color getSelectionOverlayColor()

  Returns the color of the selection overlay.

### setSelectionOverlayStrokeColor

    public void setSelectionOverlayStrokeColor(java.awt.Color color)

  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

    public java.awt.Color 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

    public void select(Mark start,
                       Mark end)

  Sets the selection to the specified start and end mark.

  Parameters:
    `start` - the mark used to define where the selection starts
    `end` - the mark used to define where the selection ends

### 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

    public java.awt.Rectangle getRenderRect()

### immediateRepaint

    public void immediateRepaint()

  Repaints immediately the component.

### paintComponent

    public void paintComponent(java.awt.Graphics g)

  Paints this component.

### setPaintingTransform

    public void setPaintingTransform(java.awt.geom.AffineTransform at)

  Sets the painting transform. A null transform is the same as an identity transform. The next repaint will use the given transform.

### getPaintingTransform

    public java.awt.geom.AffineTransform getPaintingTransform()

  Returns the current painting transform.

### setRenderingTransform

    public void setRenderingTransform(java.awt.geom.AffineTransform at)

  Sets the rendering transform. Calling this method causes a rendering to be performed.

### setRenderingTransform

    public void setRenderingTransform(java.awt.geom.AffineTransform at,
                                      boolean performRedraw)

### getInitialTransform

    public java.awt.geom.AffineTransform getInitialTransform()

  Returns the initial transform.

### getRenderingTransform

    public java.awt.geom.AffineTransform 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

    public void addGVTTreeRendererListener(GVTTreeRendererListener l)

  Adds a GVTTreeRendererListener to this component.

### removeGVTTreeRendererListener

    public void removeGVTTreeRendererListener(GVTTreeRendererListener l)

  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

    public void flush(java.awt.Rectangle r)

  Flush a rectangle of cached image data (preliminary interface, may be removed or modified in the future).

### createImageRenderer

    protected ImageRenderer 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

    protected void handleException(java.lang.Exception e)

  Handles an exception.

### releaseRenderingReferences

    protected void releaseRenderingReferences()

  Releases the references to the rendering resources,

### scheduleGVTRendering

    protected void scheduleGVTRendering()

  Schedules a new GVT rendering.

### createListener

    protected JGVTComponent.Listener createListener()

  Creates an instance of Listener.

Copyright © 2004 Apache Software Foundation. All Rights Reserved.