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

Inner Class Summary
protected  class JGVTComponent.Listener
          To hide the listener methods.
 
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  boolean disableInteractions
          Whether to inconditionally 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  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.
protected  void 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 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.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.
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 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 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  void 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, 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

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.

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 inconditionally disable interactions.
Constructor Detail

JGVTComponent

public JGVTComponent()
Creates a new JGVTComponent.

JGVTComponent

public JGVTComponent(boolean eventsEnabled,
                     boolean selectableText)
Creates a new JGVTComponent.
Parameters:
eventEnabled - 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 Detail

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.

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.

immediateRepaint

public void immediateRepaint()
Repaints immediately the component.

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints this component.
Overrides:
paintComponent in class javax.swing.JComponent

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.

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 void computeRenderingTransform()
Computes the initial value of the transform used for rendering.

updateRenderingTransform

protected void updateRenderingTransform()
Updates the value of the transform used for rendering.

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 © 2002 Apache Software Foundation. All Rights Reserved.