Class DefaultViewFactory.TextView

    • Field Detail

      • textLayout

        protected java.awt.font.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 java.awt.geom.AffineTransform tl2ModelTr
    • Constructor Detail

      • TextView

        public TextView​(PicText te)
        construct a new View for the given PicRectangle
    • Method Detail

      • 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 DefaultViewFactory.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​(java.awt.Graphics2D g,
                          java.awt.geom.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 DefaultViewFactory.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 DefaultViewFactory.LeafElementView
        Returns:
        a HitInfo corresponding to the given mouse-event
      • getTextLayout

        public java.awt.font.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 which is responsible for painting the textual content of this element
      • getTextToModelTransform

        public java.awt.geom.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