Class EditElementMouseTransformFactory.MoveControlPointTransform

  • All Implemented Interfaces:
    MouseTransform
    Enclosing class:
    EditElementMouseTransformFactory

    protected class EditElementMouseTransformFactory.MoveControlPointTransform
    extends java.lang.Object
    implements MouseTransform
    a mouse-transform that moves element's end-points, ie aka scales elements. Code is heavily dependent on the run-time class of the target element. [pending] one shortcoming of the present approach is that EditPointConstraint's are set at init time (i.e. in the constructor), which forbids any further modification (e.g. if the user press the control key AFTER starting to drag a point).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Cursor getCursor()
      Return the cursor for this MouseTransform
      java.lang.String getHelpMessage()
      Return a help-message for the UI, that makes sense with this transform.
      boolean next​(PEMouseEvent e)
      Called when the mouse is released.
      void paint​(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)
      Does nothing.
      void process​(PEMouseEvent e)
      Called when the mouse is dragged.
      void start​(PEMouseEvent e)
      Called when the mouse is pressed.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MoveControlPointTransform

        public MoveControlPointTransform​(Element target,
                                         int pointIndex,
                                         EditPointConstraint constraint,
                                         java.lang.String helpMessage,
                                         Grid grid)
        Parameters:
        target - the element upon which this transform will act
        pointIndex - index of the Element's point that will be moved
        grid - the Grid instance used for alignment (if it's snap-on)
        constraint - the geometrical constraint to be used when moving control-points ; may be null
        helpMessage - if non-null, this will be displayed on mouse-move events instead of the default help-message for this mouse-transform.
        See Also:
        jpicedt.graphic.model.Element.setPoint
    • Method Detail

      • start

        public void start​(PEMouseEvent e)
        Called when the mouse is pressed. This just fires a begin-undoable-event.
        Specified by:
        start in interface MouseTransform
      • process

        public void process​(PEMouseEvent e)
        Called when the mouse is dragged. Sets the Element's point (with the index and the constraint given as a parameter in the constructor) to the current mouse position, or its nearest-neighbour on the grid if grid-snap is on.
        Specified by:
        process in interface MouseTransform
      • next

        public boolean next​(PEMouseEvent e)
        Called when the mouse is released. This fires an end-undoable-event.
        Specified by:
        next in interface MouseTransform
        Returns:
        true if there's another task in the sequence, false if mouse-transform has completed with this mouse-event.
      • paint

        public void paint​(java.awt.Graphics2D g,
                          java.awt.geom.Rectangle2D allocation,
                          double scale)
        Does nothing. Nothing to painted specifically for this tool.
        Specified by:
        paint in interface MouseTransform
      • getHelpMessage

        public java.lang.String getHelpMessage()
        Description copied from interface: MouseTransform
        Return a help-message for the UI, that makes sense with this transform.
        Specified by:
        getHelpMessage in interface MouseTransform
        Returns:
        a help-message for the UI, that makes sense with this transform.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        a textual representation of this transform for debugging purpose
      • getCursor

        public java.awt.Cursor getCursor()
        Description copied from interface: MouseTransform
        Return the cursor for this MouseTransform
        Specified by:
        getCursor in interface MouseTransform
        Returns:
        a cursor adequate with this mouse-transform, delegating to CursorFactory. If the target-element of PicGroup, returns a cursor according to pointIndex.