http://www.jpicedt.org

jpicedt.graphic.view
Class TextView

java.lang.Object
  extended by jpicedt.graphic.view.AbstractView
      extended by jpicedt.graphic.view.LeafElementView
          extended by jpicedt.graphic.view.TextView
All Implemented Interfaces:
View
Direct Known Subclasses:
TextView

public class TextView
extends LeafElementView

a View for rendering Text's from TextLayout's


Field Summary
protected  double strx
          TextLayout location with respect to PicText's anchor point
protected  double stry
          TextLayout location with respect to PicText's anchor point
protected  TextLayout textLayout
          the TextLayout that renders the text string of this TextEditable
protected  AffineTransform tl2ModelTr
           
 
Fields inherited from class jpicedt.graphic.view.LeafElementView
attrFactory, interiorPaint, leftArrow, outlinePaint, outlineStroke, overstrikeStroke, rightArrow, shadow, shadowPaint, shape
 
Fields inherited from class jpicedt.graphic.view.AbstractView
bounds, element, highlighter
 
Constructor Summary
TextView(PicText te, AttributesViewFactory f)
          construct a new View for the given PicText
 
Method Summary
 void changedUpdate(DrawingEvent.EventType eventType)
          Give notification from the model that a change occured to the text this view is responsible for rendering.
 PicText getElement()
          Returns the element the View is responsible for rendering
protected  double getRotation()
          Returns the text rotation in radians : subclassers that don't support rotating text may return 0 here.
 TextLayout getTextLayout()
          [SR:pending] make this view implement aka TextEditableView interface (or something like it), where TextEditableView is a subinterface of View with text-editing specific capabilities.
 AffineTransform getTextToModelTransform()
          Return an affine transform which translat b/w the TextLayout coordinate system and the jpicedt.graphic.model coordinate system.
 HitInfo hitTest(PEMouseEvent e)
          This implementation calls super.hitTest and returns the result if non-null (this should be a HitInfo.Point), then returns a HitInfo.Interior if the mouse-click occured inside the text bound (as defined by text layout)
protected  boolean intersect(Rectangle2D r, ArrayList<Element> list)
          Si l'intersection de cette vue avec le rectangle r est non vide, alors l'Element associé est ajouté à la liste liste, si celle-ci est non null.
 void paint(Graphics2D g, Rectangle2D a)
          Render the View to the given graphic context.
protected  void syncBounds()
          Synchronizes bounding box with the model ;
protected  void syncFrame()
          synchronize frame shape and location
protected  void syncShape()
          Synchronize the textLayout and the shape (=frame box, by calling syncFrame) with the model This delegates to getRotation() where computing rotation angle is concerned, and updates the AffineTransform returned by getTextToModelTransform().
protected  void syncStringLocationX()
          update strx = x-location of TextLayout's bottom-Left corner with respect to PicText's anchor-point
protected  void syncStringLocationY()
          update strx = y-location of TextLayout's bottom-Left corner with respect to PicText's anchor-point
 
Methods inherited from class jpicedt.graphic.view.LeafElementView
syncArrowsAttributes, syncArrowsGeometry, syncAttributes, syncShadow
 
Methods inherited from class jpicedt.graphic.view.AbstractView
getBounds, getContainer, getDrawing, getGraphics, getHighlighter, getParentView, getViewFactory, hitTest, intersect, paintHighlighter, repaint, setElement, setHighlighter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textLayout

protected TextLayout textLayout
the TextLayout that renders the text string of this TextEditable


strx

protected double strx
TextLayout location with respect to PicText's anchor point


stry

protected double stry
TextLayout location with respect to PicText's anchor point


tl2ModelTr

protected AffineTransform tl2ModelTr
Constructor Detail

TextView

public TextView(PicText te,
                AttributesViewFactory f)
construct a new View for the given PicText

Method Detail

getElement

public PicText getElement()
Description copied from interface: View
Returns the element the View is responsible for rendering

Specified by:
getElement in interface View
Overrides:
getElement in class AbstractView
Returns:
the element the View is responsible for rendering.

changedUpdate

public void changedUpdate(DrawingEvent.EventType eventType)
Give notification from the model that a change occured to the text this view is responsible for rendering.

Specified by:
changedUpdate in interface View
Overrides:
changedUpdate in class LeafElementView

getRotation

protected double getRotation()
Returns the text rotation in radians : subclassers that don't support rotating text may return 0 here.


syncShape

protected void syncShape()
Synchronize the textLayout and the shape (=frame box, by calling syncFrame) with the model This delegates to getRotation() where computing rotation angle is concerned, and updates the AffineTransform returned by getTextToModelTransform().

Overrides:
syncShape in class LeafElementView

syncBounds

protected void syncBounds()
Synchronizes bounding box with the model ;

Overrides:
syncBounds in class LeafElementView

syncFrame

protected void syncFrame()
synchronize frame shape and location


syncStringLocationX

protected void syncStringLocationX()
update strx = x-location of TextLayout's bottom-Left corner with respect to PicText's anchor-point


syncStringLocationY

protected void syncStringLocationY()
update strx = y-location of TextLayout's bottom-Left corner with respect to PicText's anchor-point


paint

public void paint(Graphics2D g,
                  Rectangle2D a)
Render the View to the given graphic context. This implementation render the interior first, then the outline.

Specified by:
paint in interface View
Overrides:
paint in class LeafElementView
a - the current graphic clip

hitTest

public HitInfo hitTest(PEMouseEvent e)
This implementation calls super.hitTest and returns the result if non-null (this should be a HitInfo.Point), then returns a HitInfo.Interior if the mouse-click occured inside the text bound (as defined by text layout)

Overrides:
hitTest in class LeafElementView
Returns:
a HitInfo corresponding to the given mouse-event

getTextLayout

public TextLayout getTextLayout()
[SR:pending] make this view implement aka TextEditableView interface (or something like it), where TextEditableView is a subinterface of View with text-editing specific capabilities. Returns the TextLayout that is responsible for painting the textual content of this element


getTextToModelTransform

public AffineTransform getTextToModelTransform()
Return an affine transform which translat b/w the TextLayout coordinate system and the jpicedt.graphic.model coordinate system. [SR:pending] refactor method name to something more explanatory


intersect

protected boolean intersect(Rectangle2D r,
                            ArrayList<Element> list)
Si l'intersection de cette vue avec le rectangle r est non vide, alors l'Element associé est ajouté à la liste liste, si celle-ci est non null.

Overrides:
intersect in class LeafElementView
Parameters:
r - Le rectangle définissant la zone dont on test l'intersection.
list - La liste à laquelle ajouter l'élément lorsque l'intersection est non vide. Ignoré si null.
Since:
jPicEdt 1.6

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org