JHotDraw 7.0.6

org.jhotdraw.samples.svg.figures
Class SVGText

java.lang.Object
  extended by org.jhotdraw.draw.AbstractFigure
      extended by org.jhotdraw.draw.AttributedFigure
          extended by org.jhotdraw.draw.TextFigure
              extended by org.jhotdraw.samples.svg.figures.SVGText
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Figure, TextHolder, SVGFigure, DOMStorable

public class SVGText
extends TextFigure
implements SVGFigure

SVGText.

FIXME - Add support for transforms. XXX At least on Mac OS X - Always draw text using TextLayout.getOutline(), because outline layout does not match with TextLayout.draw() output. Cache outline to improve performance.

See Also:
Serialized Form

Nested Class Summary
static class SVGText.TextAnchor
           
 
Field Summary
static AttributeKey<SVGText.TextAnchor> TEXT_ANCHOR
           
 
Fields inherited from class org.jhotdraw.draw.TextFigure
origin
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, decorator, listenerList
 
Constructor Summary
SVGText()
          Creates a new instance.
 
Method Summary
protected  void drawFill(java.awt.Graphics2D g)
          This method is called by method draw() to draw the fill area of the figure.
protected  void drawStroke(java.awt.Graphics2D g)
          This method is called by method draw() to draw the text of the figure .
protected  void drawText(java.awt.Graphics2D g)
           
 java.awt.Color getFillColor()
           
 java.awt.Color getTextColor()
           
 boolean isEmpty()
          Returns true, if this figure is empty for one of the following reasons: A group has no children A path has less than two points An ellipse or a rectangle has a width or a height of 0 A text has no characters
 void read(DOMInput in)
           
protected  void readAttributes(DOMInput in)
           
 void write(DOMOutput out)
           
protected  void writeAttributes(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.TextFigure
basicSetBounds, basicTransform, clone, contains, createHandles, getBounds, getFigureDrawBounds, getFont, getFontSize, getInsets, getLabelFor, getPreferredSize, getRestoreData, getTabSize, getText, getTextColumns, getTextLayout, getTool, invalidate, isEditable, restoreTo, setEditable, setFontSize, setText, validate
 
Methods inherited from class org.jhotdraw.draw.AttributedFigure
applyAttributesTo, basicSetAttribute, drawConnectors, drawFigure, getAttribute, getAttributeKey, getAttributes, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, removeAttribute, setAttribute, setAttributeEnabled, setAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, addUndoableEditListener, basicClone, canConnect, changed, draw, drawDecorator, findCompatibleConnector, findConnector, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getCourtingConnection, getCursor, getDecomposition, getDecorator, getDrawBounds, getDrawing, getEndPoint, getFontRenderContext, getLayer, getLock, getStartPoint, getTooltip, handleDrop, handleMouseClick, includes, isChanging, isConnectorsVisible, isDrawDecoratorFirst, isInteractive, isVisible, remap, remap, removeFigureListener, removeNotify, removeUndoableEditListener, requestRemove, setBounds, setBounds, setConnectorsVisible, setDecorator, setDrawDecoratorFirst, setInteractive, setVisible, toString, transform, updateDecoratorBounds, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, addUndoableEditListener, basicSetAttribute, basicSetBounds, basicTransform, canConnect, changed, clone, contains, createHandles, draw, findCompatibleConnector, findConnector, findFigureInside, getActions, getAttribute, getAttributes, getBounds, getCursor, getDecomposition, getDecorator, getDrawBounds, getEndPoint, getLayer, getPreferredSize, getRestoreData, getStartPoint, getTool, getTooltip, handleDrop, handleMouseClick, includes, invalidate, isConnectorsVisible, isInteractive, isVisible, remap, removeFigureListener, removeNotify, removeUndoableEditListener, requestRemove, restoreTo, setAttribute, setConnectorsVisible, setDecorator, setVisible, willChange
 

Field Detail

TEXT_ANCHOR

public static final AttributeKey<SVGText.TextAnchor> TEXT_ANCHOR
Constructor Detail

SVGText

public SVGText()
Creates a new instance.

Method Detail

drawStroke

protected void drawStroke(java.awt.Graphics2D g)
Description copied from class: AttributedFigure
This method is called by method draw() to draw the text of the figure . AttributedFigure configures the Graphics2D object with the TEXT_COLOR attribute before calling this method. If the TEXT_COLOR attribute is null, this method is not called.

Overrides:
drawStroke in class TextFigure

drawFill

protected void drawFill(java.awt.Graphics2D g)
Description copied from class: AttributedFigure
This method is called by method draw() to draw the fill area of the figure. AttributedFigure configures the Graphics2D object with the FILL_COLOR attribute before calling this method. If the FILL_COLOR attribute is null, this method is not called.

Overrides:
drawFill in class TextFigure

drawText

protected void drawText(java.awt.Graphics2D g)
Overrides:
drawText in class TextFigure

write

public void write(DOMOutput out)
Specified by:
write in interface DOMStorable
Overrides:
write in class TextFigure

writeAttributes

protected void writeAttributes(DOMOutput out)
                        throws java.io.IOException
Overrides:
writeAttributes in class AttributedFigure
Throws:
java.io.IOException

read

public void read(DOMInput in)
          throws java.io.IOException
Specified by:
read in interface DOMStorable
Overrides:
read in class TextFigure
Throws:
java.io.IOException

readAttributes

protected void readAttributes(DOMInput in)
                       throws java.io.IOException
Overrides:
readAttributes in class AttributedFigure
Throws:
java.io.IOException

getTextColor

public java.awt.Color getTextColor()
Specified by:
getTextColor in interface TextHolder
Overrides:
getTextColor in class TextFigure

getFillColor

public java.awt.Color getFillColor()
Specified by:
getFillColor in interface TextHolder
Overrides:
getFillColor in class TextFigure

isEmpty

public boolean isEmpty()
Description copied from interface: SVGFigure
Returns true, if this figure is empty for one of the following reasons:

Specified by:
isEmpty in interface SVGFigure

Copyright 1996-2006 © JHotDraw.org