org.apache.batik.gvt.renderer
Class BasicTextPainter

java.lang.Object
  |
  +--org.apache.batik.gvt.renderer.BasicTextPainter
All Implemented Interfaces:
TextPainter
Direct Known Subclasses:
ConcreteTextPainter, StrokingTextPainter

public abstract class BasicTextPainter
extends java.lang.Object
implements TextPainter

Basic implementation of TextPainter which renders the attributed character iterator of a TextNode. Suitable for use with "standard" java.awt.font.TextAttributes only.

See Also:
TextAttribute

Field Summary
protected  java.text.AttributedCharacterIterator cachedACI
           
protected  TextHit cachedHit
           
protected  org.apache.batik.gvt.renderer.BasicTextPainter.Mark cachedMark
           
 
Constructor Summary
BasicTextPainter()
           
 
Method Summary
 java.awt.geom.Rectangle2D getBounds(TextNode node, java.awt.font.FontRenderContext frc)
           
protected abstract  java.awt.geom.Rectangle2D getBounds(TextNode node, java.awt.font.FontRenderContext context, boolean includeDecoration, boolean includeStrokeWidth)
           
 java.awt.geom.Rectangle2D getDecoratedBounds(TextNode node, java.awt.font.FontRenderContext frc)
           
 java.awt.Shape getDecoratedShape(TextNode node, java.awt.font.FontRenderContext frc)
           
protected abstract  java.awt.Shape getOutline(TextNode node, java.awt.font.FontRenderContext frc, boolean includeDecoration)
           
 java.awt.geom.Rectangle2D getPaintedBounds(TextNode node, java.awt.font.FontRenderContext frc)
           
 java.awt.Shape getShape(TextNode node, java.awt.font.FontRenderContext frc)
           
protected abstract  java.awt.Shape getStrokeOutline(TextNode node, java.awt.font.FontRenderContext frc, boolean includeDecoration)
           
protected  TextLayoutFactory getTextLayoutFactory()
           
protected abstract  Mark hitTest(double x, double y, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
           
 Mark selectAll(double x, double y, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
          Select the entire contents of an AttributedCharacterIterator, and return a Mark which encapsulates that selection action.
 Mark selectAt(double x, double y, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
          Given an X, y coordinate, AttributedCharacterIterator, and GraphicsNodeRenderContext, return a Mark which encapsulates a "selection start" action.
 Mark selectTo(double x, double y, Mark beginMark, java.text.AttributedCharacterIterator aci, TextNode node, GraphicsNodeRenderContext context)
          Given an X, y coordinate, starting Mark, AttributedCharacterIterator, and GraphicsNodeRenderContext, return a Mark which encapsulates a "selection continued" action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.batik.gvt.TextPainter
getHighlightShape, getSelected, paint, selectFirst, selectLast
 

Field Detail

cachedMark

protected org.apache.batik.gvt.renderer.BasicTextPainter.Mark cachedMark

cachedACI

protected java.text.AttributedCharacterIterator cachedACI

cachedHit

protected TextHit cachedHit
Constructor Detail

BasicTextPainter

public BasicTextPainter()
Method Detail

getTextLayoutFactory

protected TextLayoutFactory getTextLayoutFactory()

selectAt

public Mark selectAt(double x,
                     double y,
                     java.text.AttributedCharacterIterator aci,
                     TextNode node,
                     GraphicsNodeRenderContext context)
Given an X, y coordinate, AttributedCharacterIterator, and GraphicsNodeRenderContext, return a Mark which encapsulates a "selection start" action. The standard order of method calls for selection is: selectAt(); [selectTo(),...], selectTo(); getSelection().
Specified by:
selectAt in interface TextPainter
Following copied from interface: org.apache.batik.gvt.TextPainter
Parameters:
x - the x coordinate, in the text layout's coordinate system, of the selection event.
y - the y coordinate, in the text layout's coordinate system, of the selection event.
aci - the AttributedCharacterIterator describing the text
context - the GraphicsNodeRenderContext to use when doing text layout.
Returns:
an instance of Mark which encapsulates the state necessary to implement hit testing and text selection.

selectTo

public Mark selectTo(double x,
                     double y,
                     Mark beginMark,
                     java.text.AttributedCharacterIterator aci,
                     TextNode node,
                     GraphicsNodeRenderContext context)
Given an X, y coordinate, starting Mark, AttributedCharacterIterator, and GraphicsNodeRenderContext, return a Mark which encapsulates a "selection continued" action. The standard order of method calls for selection is: selectAt(); [selectTo(),...], selectTo(); getSelection().
Specified by:
selectTo in interface TextPainter
Following copied from interface: org.apache.batik.gvt.TextPainter
Parameters:
x - the x coordinate, in the text layout's coordinate system, of the selection event.
y - the y coordinate, in the text layout's coordinate system, of the selection event.
aci - the AttributedCharacterIterator describing the text
context - the GraphicsNodeRenderContext to use when doing text layout.
Returns:
an instance of Mark which encapsulates the state necessary to implement hit testing and text selection.

selectAll

public Mark selectAll(double x,
                      double y,
                      java.text.AttributedCharacterIterator aci,
                      TextNode node,
                      GraphicsNodeRenderContext context)
Select the entire contents of an AttributedCharacterIterator, and return a Mark which encapsulates that selection action.
Specified by:
selectAll in interface TextPainter
Following copied from interface: org.apache.batik.gvt.TextPainter
Parameters:
x - the x coordinate, in the text layout's coordinate system, of the selection event.
y - the y coordinate, in the text layout's coordinate system, of the selection event.
aci - the AttributedCharacterIterator describing the text
context - the GraphicsNodeRenderContext to use when doing text layout.
Returns:
an instance of Mark which encapsulates the state necessary to implement hit testing and text selection.

getBounds

public java.awt.geom.Rectangle2D getBounds(TextNode node,
                                           java.awt.font.FontRenderContext frc)
Specified by:
getBounds in interface TextPainter

getDecoratedBounds

public java.awt.geom.Rectangle2D getDecoratedBounds(TextNode node,
                                                    java.awt.font.FontRenderContext frc)
Specified by:
getDecoratedBounds in interface TextPainter

getPaintedBounds

public java.awt.geom.Rectangle2D getPaintedBounds(TextNode node,
                                                  java.awt.font.FontRenderContext frc)
Specified by:
getPaintedBounds in interface TextPainter

getBounds

protected abstract java.awt.geom.Rectangle2D getBounds(TextNode node,
                                                       java.awt.font.FontRenderContext context,
                                                       boolean includeDecoration,
                                                       boolean includeStrokeWidth)

getOutline

protected abstract java.awt.Shape getOutline(TextNode node,
                                             java.awt.font.FontRenderContext frc,
                                             boolean includeDecoration)

getShape

public java.awt.Shape getShape(TextNode node,
                               java.awt.font.FontRenderContext frc)
Specified by:
getShape in interface TextPainter

getDecoratedShape

public java.awt.Shape getDecoratedShape(TextNode node,
                                        java.awt.font.FontRenderContext frc)
Specified by:
getDecoratedShape in interface TextPainter

getStrokeOutline

protected abstract java.awt.Shape getStrokeOutline(TextNode node,
                                                   java.awt.font.FontRenderContext frc,
                                                   boolean includeDecoration)

hitTest

protected abstract Mark hitTest(double x,
                                double y,
                                java.text.AttributedCharacterIterator aci,
                                TextNode node,
                                GraphicsNodeRenderContext context)


Copyright © 2001 Apache Software Foundation. All Rights Reserved.