Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt.graphic.toolkit
Class AbstractMouseTransform

    java.lang.Object
      jpicedt.graphic.toolkit.AbstractMouseTransform

All Implemented Interfaces:
  MouseTransform

Direct Known Subclasses:
  EditElementMouseTransformFactory._MoveControlPointTransform, EditElementMouseTransformFactory._MoveElementTransform

public abstract class AbstractMouseTransform
extends Object
implements MouseTransform

This implementation allows subclassers to modify a clone of the target Element, then to update the original Element when the operation is completed. The aim is to reduce the burden of repainting a (possibly) complex Element while transforming it, by painting the Element using very lightweight View. This is done as follow :

- first clone the given Element, and add it to a transient RootElement defined as an inner class ;
- then create a "lightweight" View for this Element using a dedicated ViewFactory defined as an inner class ;
- apply the transformation to the clone while the mouse is being dragged/moved/pressed ... Note that the implementation of MouseTransform.paint() arranges for properly painting the clone by asking its lightweight View.
- when the transformation has completed, update the original Element and delete the clone.

Constructor Summary
`protected` | `AbstractMouseTransform(Element target)`

Method Summary
`protected Element` | `getClone()` Return the clone of the target element, which was init'd by `startTransform`
`protected Element` | `getTarget()` Return the element this transform acts upon
`boolean` | `next(PEMouseEvent e)` Called by mouseReleased. This implementation set the clone's parent and view to null so as to make it elligible for gc.
`void` | `paint(Graphics2D g, Rectangle2D allocation, double scale)` Paints the clone.
`void` | `start(PEMouseEvent e)` Called by mousePressed. Creates a clone of the target (e.g.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface jpicedt.graphic.toolkit.MouseTransform
`getCursor, getHelpMessage, process`

Constructor Detail

### AbstractMouseTransform

    protected AbstractMouseTransform(Element target)

Parameters:
  `target` - The target-element upon which this transform will act.

Method Detail

### start

    public void start(PEMouseEvent e)

  Called by mousePressed.
  Creates a clone of the target (e.g. a clicked Element) given as a parameter to the constructor, and sets its View using a dedicated ViewFactory (defined as an inner class) so that only the stroke of the element will be painted (using a default basic stroke to reduce the burden of repainting).

  Specified by:
    `start` in interface `MouseTransform`

### next

    public boolean next(PEMouseEvent e)

  Called by mouseReleased.
  This implementation set the clone's parent and view to null so as to make it elligible for gc. This should be called by subclassers at the end of the implementation of their "next" method.

  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(Graphics2D g,
                      Rectangle2D allocation,
                      double scale)

  Paints the clone. This is normally called by EditorKit upon request by the installed PECanvas.

  Specified by:
    `paint` in interface `MouseTransform`

### getTarget

    protected Element getTarget()

  Return the element this transform acts upon

### getClone

    protected Element getClone()

  Return the clone of the target element, which was init'd by `startTransform`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org