http://www.jpicedt.org

jpicedt.graphic.model
Class PicText

java.lang.Object
  extended by jpicedt.graphic.model.AbstractElement
      extended by jpicedt.graphic.model.DefaultLeafElement
          extended by jpicedt.graphic.model.TextEditable
              extended by jpicedt.graphic.model.PicText
All Implemented Interfaces:
Element, PicObjectConstants, CustomizerFactory

public class PicText
extends TextEditable
implements CustomizerFactory

Textual elements, possibly surrounded by a box (currently, only rectangular, oval and circular shapes are supported). The box size is computed from the text size (ie aka LaTeX's \\framebox command with no width/height argument).

Since:
PicEdt 1.0
Version:
$Id: PicText.java,v 1.24.2.1 2007/09/02 11:56:27 reynal Exp $
Author:
Sylvain Reynal

Field Summary
protected  double depth
           
protected  java.awt.Shape frame
           
protected  double frameSep
           
protected  double height
           
protected  double nodeSep
           
protected  double width
          dimensions (in latex sense) of the latex box (this does not include frame)
 
Fields inherited from class jpicedt.graphic.model.TextEditable
FIRST_PT, LAST_PT, P_ANCHOR, textString
 
Fields inherited from class jpicedt.graphic.model.DefaultLeafElement
nodeConnections, nodeName, pts
 
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, parent, view
 
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
 
Constructor Summary
PicText()
          Creates a PicText object with a default attribute set, and the following default values : empty string, no frame, bottom-left alignment.
PicText(PicAttributeSet set)
          Creates a PicText object with the following default values : empty string, frame and alignment according to the attribute set and anchor point at (0,0)
PicText(PicPoint ptA, PicAttributeSet set)
          Creates a PicText object with the following default values :
empty string, frame and alignment according to the attribute set
PicText(PicPoint ptA, java.lang.String textString, PicAttributeSet set)
          Create a new PicText object with the whole bunch of parameters !
PicText(PicText text)
          cloning constructor
 
Method Summary
 java.lang.Object clone()
          Override Object.clone() method
 AbstractCustomizer createCustomizer()
          Return a Customizer for geometry editing
 double getBaseLineY()
          Return y-coordinate of baseline
 double getBottomY()
          Return y-coordinate of bottom boundary of text only
 double getCenterX()
          Return x-coordinate of center of text only
 double getCenterY()
          Return y-coordinate of center of text only
 double getDepth()
          Return the depth of text only
 double getFrameBaseLineY()
          Return y-coordinate of baseline
 double getFrameBottomY()
          Return y-coordinate of bottom boundary
 double getFrameCenterX()
          Return x-coordinate of center
 double getFrameCenterY()
          Return y-coordinate of center
 double getFrameDepth()
          Return the depth of the text including frame
 double getFrameHeight()
          Return the height of the text including frame
 double getFrameLeftX()
          Return x-coordinate of left boundary, including frame
 double getFrameRightX()
          Return x-coordinate of right boundary
 double getFrameTopY()
          Return y-coordinate of top boundary
 java.lang.String getFrameType()
          Set the frame type
 double getFrameWidth()
          Return the width of the text including frame
 double getHeight()
          Return the height of text only
 java.lang.String getHorAlign()
          Return horizontal alignment (see constant fields above)
 double getLeftX()
          Return x-coordinate of left boundary of text only
 java.lang.String getName()
          Return a string that represents this object's name
 double getRightX()
          Return x-coordinate of right boundary of text only
 java.awt.Shape getShapeOfFrame()
          Returns the frame that surrounds the text, ignoring rotation (the view will rotate it)
 double getTopY()
          Return y-coordinate of top boundary of text only
 java.lang.String getVertAlign()
          Return vertical alignement (see static constant above)
 double getWidth()
          Return the width of text only
 boolean isFramed()
          Return TRUE if the box has to be drawn
 boolean isNodeable()
          Can we be made into a node ? to be overriden by subclass
 PicPoint nodeConnectionOrigin(double dx, double dy)
           
 PicPoint nodeReferencePoint()
           
 double nodeReferencePointX()
           
 double nodeReferencePointY()
           
 void setDimensions(double w, double h, double d)
          set the width, height, and depth (of the text box, without frame).
 void setFrameType(java.lang.String frameType)
          Set the type of frame to be put around the text.
 void setHorAlign(java.lang.String horAlign)
          Set the horizontal alignment (see constant fields above)
 void setPoint(int index, PicPoint pt, EditPointConstraint constraint)
          Set the user-controlled point indexed by "index" to the given value, using the specified geometrical constraint.
 void setVertAlign(java.lang.String vertAlign)
          set the vertical alignement (see constant fields above)
 java.lang.String toString()
          Returns a String representation of this DefaultElement
 void updateFrame()
          First computes frame dimensions (frameWidth, etc).
 
Methods inherited from class jpicedt.graphic.model.TextEditable
getText, setAttribute, setText
 
Methods inherited from class jpicedt.graphic.model.DefaultLeafElement
addConnection, fireChangedUpdate, forwardChangedUpdate, getAllowsChildren, getBoundingBox, getFirstPointIndex, getLastPointIndex, getNodeName, getNumberOfSpecificationPoints, getPoint, getPoint, getPointX, getPointY, getSpecificationPoint, getSpecificationPoint, getSpecificationPointX, getSpecificationPointY, isNode, iterator, removeAllConnections, removeConnection, rotate, scale, setNodeName, setPoint, setSpecificationPoint, shear, translate
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
anchorPointsIterator, getAttribute, getAttributeSet, getDrawing, getParent, getView, removeView, scale, setAttributeSet, setParent, setViewFromFactory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

width

protected double width
dimensions (in latex sense) of the latex box (this does not include frame)


height

protected double height

depth

protected double depth

frame

protected java.awt.Shape frame

frameSep

protected double frameSep

nodeSep

protected double nodeSep
Constructor Detail

PicText

public PicText(PicPoint ptA,
               java.lang.String textString,
               PicAttributeSet set)
Create a new PicText object with the whole bunch of parameters !

Parameters:
ptA - Anchor point (see setHorAlign() and setVertAlign() for details)
textString - the text content

PicText

public PicText(PicPoint ptA,
               PicAttributeSet set)
Creates a PicText object with the following default values :


PicText

public PicText(PicAttributeSet set)
Creates a PicText object with the following default values : and anchor point at (0,0)


PicText

public PicText()
Creates a PicText object with a default attribute set, and the following default values : and anchor point at (0,0)


PicText

public PicText(PicText text)
cloning constructor

Method Detail

clone

public java.lang.Object clone()
Override Object.clone() method

Specified by:
clone in interface Element
Overrides:
clone in class DefaultLeafElement

getName

public java.lang.String getName()
Return a string that represents this object's name

Specified by:
getName in interface Element
Overrides:
getName in class DefaultLeafElement

setPoint

public void setPoint(int index,
                     PicPoint pt,
                     EditPointConstraint constraint)
Description copied from class: DefaultLeafElement
Set the user-controlled point indexed by "index" to the given value, using the specified geometrical constraint. Constraints depend on the particular concrete implementation, and may involve restricting movement along a particular direction, moving several points at once to preserve parallelism,... The default constraint in this implementation reduces to simply calling setSpecificationPoint, then firing a GEOMETRY_CHANGE change-update.

Specified by:
setPoint in interface Element
Overrides:
setPoint in class DefaultLeafElement
constraint - a geometry constraint, or null if no particular constraint is being imposed (aka default).

getHorAlign

public java.lang.String getHorAlign()
Return horizontal alignment (see constant fields above)


setHorAlign

public void setHorAlign(java.lang.String horAlign)
Set the horizontal alignment (see constant fields above)


getVertAlign

public java.lang.String getVertAlign()
Return vertical alignement (see static constant above)


setVertAlign

public void setVertAlign(java.lang.String vertAlign)
set the vertical alignement (see constant fields above)


isFramed

public boolean isFramed()
Return TRUE if the box has to be drawn


setFrameType

public void setFrameType(java.lang.String frameType)
Set the type of frame to be put around the text.


getFrameType

public java.lang.String getFrameType()
Set the frame type


getShapeOfFrame

public java.awt.Shape getShapeOfFrame()
Returns the frame that surrounds the text, ignoring rotation (the view will rotate it)


updateFrame

public void updateFrame()
First computes frame dimensions (frameWidth, etc). Then computes the frame that surrounds the text, ignoring rotation (the view will rotate it)


getWidth

public double getWidth()
Return the width of text only


getHeight

public double getHeight()
Return the height of text only


getDepth

public double getDepth()
Return the depth of text only


getLeftX

public double getLeftX()
Return x-coordinate of left boundary of text only


getRightX

public double getRightX()
Return x-coordinate of right boundary of text only


getCenterX

public double getCenterX()
Return x-coordinate of center of text only


getBottomY

public double getBottomY()
Return y-coordinate of bottom boundary of text only


getTopY

public double getTopY()
Return y-coordinate of top boundary of text only


getBaseLineY

public double getBaseLineY()
Return y-coordinate of baseline


getCenterY

public double getCenterY()
Return y-coordinate of center of text only


getFrameWidth

public double getFrameWidth()
Return the width of the text including frame


getFrameHeight

public double getFrameHeight()
Return the height of the text including frame


getFrameDepth

public double getFrameDepth()
Return the depth of the text including frame


getFrameLeftX

public double getFrameLeftX()
Return x-coordinate of left boundary, including frame


getFrameRightX

public double getFrameRightX()
Return x-coordinate of right boundary


getFrameCenterX

public double getFrameCenterX()
Return x-coordinate of center


getFrameTopY

public double getFrameTopY()
Return y-coordinate of top boundary


getFrameBottomY

public double getFrameBottomY()
Return y-coordinate of bottom boundary


getFrameBaseLineY

public double getFrameBaseLineY()
Return y-coordinate of baseline


getFrameCenterY

public double getFrameCenterY()
Return y-coordinate of center


setDimensions

public void setDimensions(double w,
                          double h,
                          double d)
set the width, height, and depth (of the text box, without frame). Normally, are set by the view.


isNodeable

public boolean isNodeable()
Description copied from class: DefaultLeafElement
Can we be made into a node ? to be overriden by subclass

Overrides:
isNodeable in class DefaultLeafElement

nodeReferencePoint

public PicPoint nodeReferencePoint()
Overrides:
nodeReferencePoint in class DefaultLeafElement

nodeReferencePointX

public double nodeReferencePointX()
Overrides:
nodeReferencePointX in class DefaultLeafElement

nodeReferencePointY

public double nodeReferencePointY()
Overrides:
nodeReferencePointY in class DefaultLeafElement

nodeConnectionOrigin

public PicPoint nodeConnectionOrigin(double dx,
                                     double dy)
Overrides:
nodeConnectionOrigin in class DefaultLeafElement

toString

public java.lang.String toString()
Description copied from class: DefaultLeafElement
Returns a String representation of this DefaultElement

Overrides:
toString in class DefaultLeafElement

createCustomizer

public AbstractCustomizer createCustomizer()
Return a Customizer for geometry editing

Specified by:
createCustomizer in interface CustomizerFactory

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org