Package org.eclipse.gef.handles
Class AbstractHandle
- java.lang.Object
-
- org.eclipse.draw2d.Figure
-
- org.eclipse.gef.handles.AbstractHandle
-
- All Implemented Interfaces:
org.eclipse.draw2d.AncestorListener,org.eclipse.draw2d.IFigure,Handle
- Direct Known Subclasses:
MoveHandle,SquareHandle
public abstract class AbstractHandle extends org.eclipse.draw2d.Figure implements Handle, org.eclipse.draw2d.AncestorListener
Base implementation for handles. This class keeps track of the typical data needed by a handle, such as a drag tracker, a locator to place the handle, a cursor, and the editpart to which the handle belongs. AbstractHandle will add anAncestorListenerto the owner's figure, and will automatically revalidate this handle whenever the owner's figure moves.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch
-
-
Constructor Summary
Constructors Constructor Description AbstractHandle()Null constructorAbstractHandle(GraphicalEditPart owner, org.eclipse.draw2d.Locator loc)Creates a handle for the givenGraphicalEditPartusing the givenLocator.AbstractHandle(GraphicalEditPart owner, org.eclipse.draw2d.Locator loc, Cursor c)Creates a handle for the givenGraphicalEditPartusing the givenLocatorandCursor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddNotify()Adds this as anAncestorListenerto the owner'sFigure.voidancestorAdded(org.eclipse.draw2d.IFigure ancestor)voidancestorMoved(org.eclipse.draw2d.IFigure ancestor)voidancestorRemoved(org.eclipse.draw2d.IFigure ancestor)protected abstract DragTrackercreateDragTracker()Creates a new drag tracker to be returned by getDragTracker().org.eclipse.draw2d.geometry.PointgetAccessibleLocation()By default, the center of the handle is returned.CursorgetDragCursor()Deprecated.use getCursor()DragTrackergetDragTracker()Returns the drag tracker to use when the user clicks on this handle.org.eclipse.draw2d.LocatorgetLocator()Returns theLocatorused to position this handle.protected GraphicalEditPartgetOwner()Returns theGraphicalEditPartassociated with this handle.protected org.eclipse.draw2d.IFiguregetOwnerFigure()Convenience method to return the owner's figure.voidremoveNotify()voidsetDragCursor(Cursor c)Deprecated.use setCursor()voidsetDragTracker(DragTracker t)Sets the drag tracker for this handle.protected voidsetLocator(org.eclipse.draw2d.Locator locator)Sets the locator which position this handle.protected voidsetOwner(GraphicalEditPart editpart)Sets the owner editpart associated with this handle.voidvalidate()Extends validate() to place the handle using its locator.-
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates
-
-
-
-
Constructor Detail
-
AbstractHandle
public AbstractHandle()
Null constructor
-
AbstractHandle
public AbstractHandle(GraphicalEditPart owner, org.eclipse.draw2d.Locator loc)
Creates a handle for the givenGraphicalEditPartusing the givenLocator.- Parameters:
owner- The editpart which provided this handleloc- The locator to position the handle
-
AbstractHandle
public AbstractHandle(GraphicalEditPart owner, org.eclipse.draw2d.Locator loc, Cursor c)
Creates a handle for the givenGraphicalEditPartusing the givenLocatorandCursor.- Parameters:
owner- The editpart which provided this handleloc- The locator to position the handlec- The cursor to display when the mouse is over the handle
-
-
Method Detail
-
addNotify
public void addNotify()
Adds this as anAncestorListenerto the owner'sFigure.- Specified by:
addNotifyin interfaceorg.eclipse.draw2d.IFigure- Overrides:
addNotifyin classorg.eclipse.draw2d.Figure
-
ancestorMoved
public void ancestorMoved(org.eclipse.draw2d.IFigure ancestor)
- Specified by:
ancestorMovedin interfaceorg.eclipse.draw2d.AncestorListener- See Also:
AncestorListener.ancestorMoved(org.eclipse.draw2d.IFigure)
-
ancestorAdded
public void ancestorAdded(org.eclipse.draw2d.IFigure ancestor)
- Specified by:
ancestorAddedin interfaceorg.eclipse.draw2d.AncestorListener- See Also:
AncestorListener.ancestorAdded(org.eclipse.draw2d.IFigure)
-
ancestorRemoved
public void ancestorRemoved(org.eclipse.draw2d.IFigure ancestor)
- Specified by:
ancestorRemovedin interfaceorg.eclipse.draw2d.AncestorListener- See Also:
AncestorListener.ancestorRemoved(org.eclipse.draw2d.IFigure)
-
createDragTracker
protected abstract DragTracker createDragTracker()
Creates a new drag tracker to be returned by getDragTracker().- Returns:
- a new drag tracker
-
getAccessibleLocation
public org.eclipse.draw2d.geometry.Point getAccessibleLocation()
By default, the center of the handle is returned.- Specified by:
getAccessibleLocationin interfaceHandle- Returns:
nullor the absolute location- See Also:
Handle.getAccessibleLocation()
-
getDragCursor
public Cursor getDragCursor()
Deprecated.use getCursor()Returns the cursor. The cursor is displayed whenever the mouse is over the handle.- Returns:
- the cursor
-
getDragTracker
public DragTracker getDragTracker()
Returns the drag tracker to use when the user clicks on this handle. If the drag tracker has not been set, it will be lazily created by callingcreateDragTracker().- Specified by:
getDragTrackerin interfaceHandle- Returns:
- the drag tracker
-
getLocator
public org.eclipse.draw2d.Locator getLocator()
Returns theLocatorused to position this handle.- Returns:
- the locator
-
getOwner
protected GraphicalEditPart getOwner()
Returns theGraphicalEditPartassociated with this handle.- Returns:
- the owner editpart
-
getOwnerFigure
protected org.eclipse.draw2d.IFigure getOwnerFigure()
Convenience method to return the owner's figure.- Returns:
- the owner editpart's figure
-
removeNotify
public void removeNotify()
- Specified by:
removeNotifyin interfaceorg.eclipse.draw2d.IFigure- Overrides:
removeNotifyin classorg.eclipse.draw2d.Figure- See Also:
IFigure.removeNotify()
-
setDragCursor
public void setDragCursor(Cursor c) throws java.lang.Exception
Deprecated.use setCursor()Sets the Cursor for the handle.- Parameters:
c- the cursor- Throws:
java.lang.Exception- a bogus excpetion declaration
-
setDragTracker
public void setDragTracker(DragTracker t)
Sets the drag tracker for this handle.- Parameters:
t- the drag tracker
-
setLocator
protected void setLocator(org.eclipse.draw2d.Locator locator)
Sets the locator which position this handle.- Parameters:
locator- the new locator
-
setOwner
protected void setOwner(GraphicalEditPart editpart)
Sets the owner editpart associated with this handle.- Parameters:
editpart- the owner
-
validate
public void validate()
Extends validate() to place the handle using its locator.- Specified by:
validatein interfaceorg.eclipse.draw2d.IFigure- Overrides:
validatein classorg.eclipse.draw2d.Figure- See Also:
IFigure.validate()
-
-