Class TextNode
java.lang.Object
org.apache.batik.gvt.AbstractGraphicsNode
org.apache.batik.bridge.TextNode
- All Implemented Interfaces:
GraphicsNode, Selectable
- Direct Known Subclasses:
FlowExtTextNode, FlowTextNode
A graphics node that represents text.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDefines where the text of aTextNodecan be anchored relative to its location. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AttributedCharacterIteratorAttributed Character Iterator describing the textprotected MarkThe begin mark.protected MarkThe end mark.protected Point2DLocation of this text node (inherited, independent of explicit X and Y attributes applied to children).static final AttributedCharacterIterator.Attributeprotected StringThe text of thisTextNode.protected TextPainterThe text painter used to display the text of this text node.protected ListThe list of text runs.Fields inherited from class AbstractGraphicsNode
changeCompletedEvent, changeStartedEvent, clip, composite, enableBackgroundGraphicsNodeRable, filter, graphicsNodeRable, hints, inverseTransform, isVisible, listeners, mask, parent, pointerEventType, root, transform, weakRefFields inherited from interface GraphicsNode
ALL, FILL, IDENTITY, NONE, PAINTED, STROKE, VISIBLE, VISIBLE_FILL, VISIBLE_PAINTED, VISIBLE_STROKE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the specified Point2D is inside the boundary of this node, false otherwise.protected booleancontains(Point2D p, Rectangle2D b) Returns the attributed character iterator of this text node.Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account.Returns the shape used to outline this text node.Returns the location of this text node.getMarkerForChar(int index, boolean beforeChar) Return the marker for the character at index in this nodes AttributedCharacterIterator.Returns the outline of this node.Returns the bounds of the area covered by this node's primitive paint.Gets the current text selection.Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering.getText()Returns the text of thisTextNodeas a string.Returns the text painter of this text node.Returns a list of text runs.protected voidInvalidates thisTextNode.voidprimitivePaint(Graphics2D g2d) Paints this node without applying Filter, Mask, Composite, and clip.booleanselectAll(double x, double y) Selects all the text in this TextNode.booleanselectAt(double x, double y) Initializes the current selection to begin with the character at (x, y).booleanselectTo(double x, double y) Extends the current selection to the character at (x, y).voidSets the attributed character iterator of this text node.voidsetLocation(Point2D newLocation) Sets the location of this text node.voidsetSelection(Mark begin, Mark end) voidsetTextPainter(TextPainter textPainter) Sets the text painter of this text node.voidsetTextRuns(List textRuns) Sets the list of text runs of this text node.voidswapTextPaintInfo(TextPaintInfo newInfo, TextPaintInfo oldInfo) Methods inherited from class AbstractGraphicsNode
fireGraphicsNodeChangeCompleted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, getBounds, getClip, getComposite, getEnableBackgroundGraphicsNodeRable, getFilter, getGlobalTransform, getGraphicsNodeRable, getInverseTransform, getMask, getParent, getPointerEventType, getRenderingHints, getRoot, getTransform, getTransformedBounds, getTransformedGeometryBounds, getTransformedPrimitiveBounds, getTransformedSensitiveBounds, getWeakReference, intersects, isAntialiasedClip, isOffscreenBufferNeeded, isVisible, nodeHitAt, normalizeRectangle, paint, setClip, setComposite, setFilter, setMask, setParent, setPointerEventType, setRenderingHint, setRenderingHints, setRenderingHints, setRoot, setTransform, setVisible
-
Field Details
-
PAINT_INFO
-
location
Location of this text node (inherited, independent of explicit X and Y attributes applied to children). -
aci
Attributed Character Iterator describing the text -
text
The text of thisTextNode. -
beginMark
The begin mark. -
endMark
The end mark. -
textRuns
The list of text runs. -
textPainter
The text painter used to display the text of this text node.
-
-
Constructor Details
-
TextNode
public TextNode()Constructs a new emptyTextNode.
-
-
Method Details
-
setTextPainter
Sets the text painter of this text node. If the specified text painter is null, this text node will use its default text painter (StrokingTextPainter.getInstance()).- Parameters:
textPainter- the text painter to use
-
getTextPainter
Returns the text painter of this text node. -
getTextRuns
Returns a list of text runs. -
setTextRuns
Sets the list of text runs of this text node.- Parameters:
textRuns- the new list of text runs
-
getText
Returns the text of thisTextNodeas a string. -
setLocation
Sets the location of this text node.- Parameters:
newLocation- the new location of this text node
-
getLocation
Returns the location of this text node.- Returns:
- the location of this text node
-
swapTextPaintInfo
-
setAttributedCharacterIterator
Sets the attributed character iterator of this text node.- Parameters:
newAci- the new attributed character iterator
-
getAttributedCharacterIterator
Returns the attributed character iterator of this text node.- Returns:
- the attributed character iterator
-
invalidateGeometryCache
protected void invalidateGeometryCache()Invalidates thisTextNode. This node and all its ancestors have been informed that all its cached values related to its bounds must be recomputed.- Overrides:
invalidateGeometryCachein classAbstractGraphicsNode
-
getPrimitiveBounds
Returns the bounds of the area covered by this node's primitive paint.- Specified by:
getPrimitiveBoundsin interfaceGraphicsNode
-
getGeometryBounds
Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account. That is, exclusive of any clipping, masking, filtering or stroking, for example.- Specified by:
getGeometryBoundsin interfaceGraphicsNode
-
getSensitiveBounds
Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering.- Specified by:
getSensitiveBoundsin interfaceGraphicsNode
-
getOutline
Returns the outline of this node.- Specified by:
getOutlinein interfaceGraphicsNode
-
getMarkerForChar
Return the marker for the character at index in this nodes AttributedCharacterIterator. Before Char indicates if the Marker should be considered before or after char. -
setSelection
-
selectAt
public boolean selectAt(double x, double y) Initializes the current selection to begin with the character at (x, y).- Specified by:
selectAtin interfaceSelectable- Parameters:
x- the x coordinate of the start of the selectiony- the y coordinate of the start of the selection- Returns:
- true if action resulted in change of selection.
-
selectTo
public boolean selectTo(double x, double y) Extends the current selection to the character at (x, y).- Specified by:
selectToin interfaceSelectable- Parameters:
x- the x coordinate of the end of the selectiony- the y coordinate of the end of the selection- Returns:
- true if action resulted in change of selection.
-
selectAll
public boolean selectAll(double x, double y) Selects all the text in this TextNode. The coordinates are ignored.- Specified by:
selectAllin interfaceSelectable- Parameters:
x- the x coordinate of the point the selection was madey- the y coordinate of the point the selection was made- Returns:
- true if action resulted in change of selection.
-
getSelection
Gets the current text selection.- Specified by:
getSelectionin interfaceSelectable- Returns:
- an object containing the selected content.
-
getHighlightShape
Returns the shape used to outline this text node.- Specified by:
getHighlightShapein interfaceSelectable- Returns:
- a Shape which encloses the current text selection.
-
primitivePaint
Paints this node without applying Filter, Mask, Composite, and clip.- Specified by:
primitivePaintin interfaceGraphicsNode- Parameters:
g2d- the Graphics2D to use
-
contains
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.- Specified by:
containsin interfaceGraphicsNode- Overrides:
containsin classAbstractGraphicsNode- Parameters:
p- the specified Point2D in the user space
-
contains
-