org.apache.batik.refimpl.gvt.renderer
Class BasicTextPainter
java.lang.Object
|
+--org.apache.batik.refimpl.gvt.renderer.BasicTextPainter
- All Implemented Interfaces:
- TextPainter
- Direct Known Subclasses:
- ConcreteTextPainter, StrokingTextPainter
- public 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
Method Summary |
java.awt.Shape |
getHighlightShape(Mark beginMark,
Mark endMark)
Return a Shape, in the coordinate system of the text layout,
which encloses the text selection delineated by two Mark instances. |
int[] |
getSelected(java.text.AttributedCharacterIterator aci,
Mark start,
Mark finish)
Returns an array of ints representing begin/end index pairs into
an AttributedCharacterIterator which represents the text
selection delineated by two Mark instances. |
void |
paint(java.text.AttributedCharacterIterator aci,
java.awt.geom.Point2D location,
TextNode.Anchor anchor,
java.awt.Graphics2D g2d,
GraphicsNodeRenderContext context)
Paints the specified attributed character iterator using the
specified Graphics2D and rendering context. |
Mark |
selectAll(double x,
double y,
java.text.AttributedCharacterIterator aci,
TextNode.Anchor anchor,
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.Anchor anchor,
GraphicsNodeRenderContext context)
Given an X, y coordinate, text anchor type,
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.Anchor anchor,
GraphicsNodeRenderContext context)
Given an X, y coordinate, text anchor type, 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 |
BasicTextPainter
public BasicTextPainter()
paint
public void paint(java.text.AttributedCharacterIterator aci,
java.awt.geom.Point2D location,
TextNode.Anchor anchor,
java.awt.Graphics2D g2d,
GraphicsNodeRenderContext context)
- Paints the specified attributed character iterator using the
specified Graphics2D and rendering context.
Note that the GraphicsNodeRenderContext contains a TextPainter
reference.
- Specified by:
paint
in interface TextPainter
- Parameters:
shape
- the shape to paintanchor
- the TextNode.Anchor convention usedg2d
- the Graphics2D to usecontext
- rendering context.- See Also:
TextPainter
,
GraphicsNodeRenderContext
selectAt
public Mark selectAt(double x,
double y,
java.text.AttributedCharacterIterator aci,
TextNode.Anchor anchor,
GraphicsNodeRenderContext context)
- Given an X, y coordinate, text anchor type,
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 textanchor
- the text anchor (alignment) type of this textcontext
- 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.Anchor anchor,
GraphicsNodeRenderContext context)
- Given an X, y coordinate, text anchor type, 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 textanchor
- the text anchor (alignment) type of this textcontext
- 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.Anchor anchor,
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 textanchor
- the text anchor (alignment) type of this textcontext
- 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.
getSelected
public int[] getSelected(java.text.AttributedCharacterIterator aci,
Mark start,
Mark finish)
- Returns an array of ints representing begin/end index pairs into
an AttributedCharacterIterator which represents the text
selection delineated by two Mark instances.
Note: The Mark instances passed must have been instantiated by
an instance of this enclosing TextPainter implementation.
- Specified by:
getSelected
in interface TextPainter
getHighlightShape
public java.awt.Shape getHighlightShape(Mark beginMark,
Mark endMark)
- Return a Shape, in the coordinate system of the text layout,
which encloses the text selection delineated by two Mark instances.
Note: The Mark instances passed must have been instantiated by
an instance of this enclosing TextPainter implementation.
- Specified by:
getHighlightShape
in interface TextPainter
Copyright © 2000 Apache Software Foundation. All Rights Reserved.