http://www.jpicedt.org

jpicedt.graphic.toolkit
Class EditElementMouseTransformFactory.MoveControlPointTransform

java.lang.Object
  extended by jpicedt.graphic.toolkit.EditElementMouseTransformFactory.MoveControlPointTransform
All Implemented Interfaces:
MouseTransform
Enclosing class:
EditElementMouseTransformFactory

protected class EditElementMouseTransformFactory.MoveControlPointTransform
extends 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).


Constructor Summary
EditElementMouseTransformFactory.MoveControlPointTransform(Element target, int pointIndex, EditPointConstraint constraint, String helpMessage, Grid grid)
           
 
Method Summary
 Cursor getCursor()
          Return the cursor for this MouseTransform
 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(Graphics2D g, 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EditElementMouseTransformFactory.MoveControlPointTransform

public EditElementMouseTransformFactory.MoveControlPointTransform(Element target,
                                                                  int pointIndex,
                                                                  EditPointConstraint constraint,
                                                                  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:
Element.setCtrlPt(int, jpicedt.graphic.PicPoint)
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(Graphics2D g,
                  Rectangle2D allocation,
                  double scale)
Does nothing. Nothing to painted specifically for this tool.

Specified by:
paint in interface MouseTransform

getHelpMessage

public 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 String toString()
Overrides:
toString in class Object
Returns:
a textual representation of this transform for debugging purpose

getCursor

public 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.

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org