Package jpicedt.graphic.model
Class PicText
- java.lang.Object
-
- jpicedt.graphic.model.AbstractElement
-
- jpicedt.graphic.model.DefaultLeafElement
-
- jpicedt.graphic.model.TextEditable
-
- 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
Fields Modifier and Type Field Description protected doubledepthprotected java.awt.Shapeframeprotected doubleframeSepprotected doubleheightprotected doublenodeSepprotected doublewidthdimensions (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
Constructors Constructor Description 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(PicText text)cloning constructorPicText(PicPoint ptA, java.lang.String textString, PicAttributeSet set)Create a new PicText object with the whole bunch of parameters !PicText(PicPoint ptA, PicAttributeSet set)Creates a PicText object with the following default values :
empty string, frame and alignment according to the attribute set
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Override Object.clone() methodAbstractCustomizercreateCustomizer()Return a Customizer for geometry editingdoublegetBaseLineY()Return y-coordinate of baselinedoublegetBottomY()Return y-coordinate of bottom boundary of text onlydoublegetCenterX()Return x-coordinate of center of text onlydoublegetCenterY()Return y-coordinate of center of text onlydoublegetDepth()Return the depth of text onlydoublegetFrameBaseLineY()Return y-coordinate of baselinedoublegetFrameBottomY()Return y-coordinate of bottom boundarydoublegetFrameCenterX()Return x-coordinate of centerdoublegetFrameCenterY()Return y-coordinate of centerdoublegetFrameDepth()Return the depth of the text including framedoublegetFrameHeight()Return the height of the text including framedoublegetFrameLeftX()Return x-coordinate of left boundary, including framedoublegetFrameRightX()Return x-coordinate of right boundarydoublegetFrameTopY()Return y-coordinate of top boundaryjava.lang.StringgetFrameType()Set the frame typedoublegetFrameWidth()Return the width of the text including framedoublegetHeight()Return the height of text onlyjava.lang.StringgetHorAlign()Return horizontal alignment (see constant fields above)doublegetLeftX()Return x-coordinate of left boundary of text onlyjava.lang.StringgetName()Return a string that represents this object's namedoublegetRightX()Return x-coordinate of right boundary of text onlyjava.awt.ShapegetShapeOfFrame()Returns the frame that surrounds the text, ignoring rotation (the view will rotate it)doublegetTopY()Return y-coordinate of top boundary of text onlyjava.lang.StringgetVertAlign()Return vertical alignement (see static constant above)doublegetWidth()Return the width of text onlybooleanisFramed()Return TRUE if the box has to be drawnbooleanisNodeable()Can we be made into a node ? to be overriden by subclassPicPointnodeConnectionOrigin(double dx, double dy)PicPointnodeReferencePoint()doublenodeReferencePointX()doublenodeReferencePointY()voidsetDimensions(double w, double h, double d)set the width, height, and depth (of the text box, without frame).voidsetFrameType(java.lang.String frameType)Set the type of frame to be put around the text.voidsetHorAlign(java.lang.String horAlign)Set the horizontal alignment (see constant fields above)voidsetPoint(int index, PicPoint pt, EditPointConstraint constraint)Set the user-controlled point indexed by "index" to the given value, using the specified geometrical constraint.voidsetVertAlign(java.lang.String vertAlign)set the vertical alignement (see constant fields above)java.lang.StringtoString()Returns a String representation of this DefaultElementvoidupdateFrame()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
-
-
-
-
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 :
- empty string,
- frame and alignment according to the attribute set
-
PicText
public PicText(PicAttributeSet set)
Creates a PicText object with the following default values :- empty string,
- frame and alignment according to the attribute set
-
PicText
public PicText()
Creates a PicText object with a default attribute set, and the following default values :- empty string,
- no frame,
- bottom-left alignment.
-
PicText
public PicText(PicText text)
cloning constructor
-
-
Method Detail
-
clone
public java.lang.Object clone()
Override Object.clone() method- Specified by:
clonein interfaceElement- Overrides:
clonein classDefaultLeafElement
-
getName
public java.lang.String getName()
Return a string that represents this object's name- Specified by:
getNamein interfaceElement- Overrides:
getNamein classDefaultLeafElement
-
setPoint
public void setPoint(int index, PicPoint pt, EditPointConstraint constraint)Description copied from class:DefaultLeafElementSet 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:
setPointin interfaceElement- Overrides:
setPointin classDefaultLeafElementconstraint- 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:DefaultLeafElementCan we be made into a node ? to be overriden by subclass- Overrides:
isNodeablein classDefaultLeafElement
-
nodeReferencePoint
public PicPoint nodeReferencePoint()
- Overrides:
nodeReferencePointin classDefaultLeafElement
-
nodeReferencePointX
public double nodeReferencePointX()
- Overrides:
nodeReferencePointXin classDefaultLeafElement
-
nodeReferencePointY
public double nodeReferencePointY()
- Overrides:
nodeReferencePointYin classDefaultLeafElement
-
nodeConnectionOrigin
public PicPoint nodeConnectionOrigin(double dx, double dy)
- Overrides:
nodeConnectionOriginin classDefaultLeafElement
-
toString
public java.lang.String toString()
Description copied from class:DefaultLeafElementReturns a String representation of this DefaultElement- Overrides:
toStringin classDefaultLeafElement
-
createCustomizer
public AbstractCustomizer createCustomizer()
Return a Customizer for geometry editing- Specified by:
createCustomizerin interfaceCustomizerFactory
-
-