org.robokind.api.animation.editor
Class ControlPointEditor

java.lang.Object
  extended by org.robokind.api.common.property.PropertyChangeNotifier
      extended by org.robokind.api.animation.editor.AbstractEditor<Point2D,Point2D>
          extended by org.robokind.api.animation.editor.ControlPointEditor
All Implemented Interfaces:
org.robokind.api.common.property.PropertyChangeSource

public class ControlPointEditor
extends AbstractEditor<Point2D,Point2D>

Author:
Matthew Stevenson

Field Summary
 
Fields inherited from class org.robokind.api.animation.editor.AbstractEditor
myChildren, myConsumers, myParent, myRecursiveConsumers, mySelectedIndex, mySharedHistory, myStates, PROP_NAME
 
Constructor Summary
ControlPointEditor(Point2D p, HistoryStack hist)
           
 
Method Summary
protected  int addChildBase(Object invoker, org.robokind.api.common.utils.RKSource<Point2D> childBase, int i)
          Called when a child is requested to be added.
protected  Point2D createChildController(Point2D childBase)
          Called when a new Controller needs to be created
 Point2D getChild(int i)
           
 String getName()
           
 SynchronizedPointGroup getPointGroup()
           
 Point2D getSelected()
           
 ActionListener getUnlinkAction()
           
protected  int insertChildControllerBase(Point2D controller, int i)
          Called when inserting an existing ChildController.
 boolean isChildUIController()
          This should return true if ChildController extends AbstractEditor.
 boolean isGrouped()
           
protected  Point2D removeChild(Object invoker, int i)
          Called when the child with the given index is requested to be removed.
 void setName(String name)
           
 void setPoint(Point2D p)
          Does not fire an event.
 void setPointGroup(SynchronizedPointGroup group)
           
 void setUnlinkAction(ActionListener action)
           
 void startDragging()
           
 void stopDragging()
           
 
Methods inherited from class org.robokind.api.animation.editor.AbstractEditor
addChild, addConsumer, addRecursiveToChild, afterAddChild, clearConsumers, deselect, fireItemAddedEvent, fireItemAddedEvent, fireItemMovedEvent, fireItemMovedEvent, fireItemRemovedEvent, fireItemRemovedEvent, fireSelectionChangeEvent, fireSelectionChangeEvent, fireStateChangedEvent, fireStateChangedEvent, fireStructureChangedEvent, fireStructureChangedEvent, getChildren, getInheritedFlags, getParent, getRestrictiveFlags, getSelectedIndex, getSharedHistory, getStateFlags, getStates, hasFlag, insertChild, insertChildController, isLocked, recursiveAdd, recursiveRemove, removeChild, removeChildByIndex, removeConsumer, removeFromConsumerList, removeFromRecursiveList, select, setChildren, setParent, setSelected, setState
 
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControlPointEditor

public ControlPointEditor(Point2D p,
                          HistoryStack hist)
Parameters:
p -
properties -
hist -
Method Detail

setName

public void setName(String name)
Specified by:
setName in class AbstractEditor<Point2D,Point2D>
Parameters:
name -

getName

public String getName()
Specified by:
getName in class AbstractEditor<Point2D,Point2D>
Returns:

setPoint

public void setPoint(Point2D p)
Does not fire an event.

Parameters:
p -

removeChild

protected Point2D removeChild(Object invoker,
                              int i)
Description copied from class: AbstractEditor
Called when the child with the given index is requested to be removed.

Specified by:
removeChild in class AbstractEditor<Point2D,Point2D>
Parameters:
x -
y -
s -
distance -
Returns:
public boolean contains(int x1, int y1, CoordinateScalar s, double distance){ Point2D p = getSelected(); return Point2D.Double.distance(s.scaleX(p), s.scaleY(p), x, y) <= distance; }

createChildController

protected Point2D createChildController(Point2D childBase)
Description copied from class: AbstractEditor
Called when a new Controller needs to be created

Specified by:
createChildController in class AbstractEditor<Point2D,Point2D>
Parameters:
childBase - the ChildBase for the requested ChildController
Returns:
return a new ChildController created from the ChildBase

isChildUIController

public boolean isChildUIController()
Description copied from class: AbstractEditor
This should return true if ChildController extends AbstractEditor. Additional functionality can be provided for Children UIControllers. This abstract method was introduced to avoid use of instanceof.

Specified by:
isChildUIController in class AbstractEditor<Point2D,Point2D>
Returns:
true if ChildController extends AbstractEditor

addChildBase

protected int addChildBase(Object invoker,
                           org.robokind.api.common.utils.RKSource<Point2D> childBase,
                           int i)
Description copied from class: AbstractEditor
Called when a child is requested to be added. This method should do everything necessary to add a ChildBase. Shortly after this is called, a call will be made to createChildController(...), the resulting controller will be added to myChildren at the index returned from this method. To cancel adding the ChildBase, return -1

Specified by:
addChildBase in class AbstractEditor<Point2D,Point2D>
childBase - the ChildBase to be added
Returns:
the index where the ChildBase, return -1 to cancel adding the ChildBase.

insertChildControllerBase

protected int insertChildControllerBase(Point2D controller,
                                        int i)
Description copied from class: AbstractEditor
Called when inserting an existing ChildController. This method is expected to add the ChildBase from the ChildController to this Controller's underlying type.

Specified by:
insertChildControllerBase in class AbstractEditor<Point2D,Point2D>
Parameters:
controller - ChildController that is being added
i - the index the child should be added at
Returns:
the index the child is added at

getChild

public Point2D getChild(int i)
Overrides:
getChild in class AbstractEditor<Point2D,Point2D>
Parameters:
i -
Returns:

getSelected

public Point2D getSelected()
Overrides:
getSelected in class AbstractEditor<Point2D,Point2D>
Returns:

setPointGroup

public void setPointGroup(SynchronizedPointGroup group)

isGrouped

public boolean isGrouped()

getPointGroup

public SynchronizedPointGroup getPointGroup()

setUnlinkAction

public void setUnlinkAction(ActionListener action)

getUnlinkAction

public ActionListener getUnlinkAction()

startDragging

public void startDragging()

stopDragging

public void stopDragging()


Copyright © 2011-2013. All Rights Reserved.