Package org.eclipse.gef.editparts
Class ViewportAutoexposeHelper
- java.lang.Object
-
- org.eclipse.gef.editparts.ViewportAutoexposeHelper
-
- All Implemented Interfaces:
AutoexposeHelper
public class ViewportAutoexposeHelper extends java.lang.Object implements AutoexposeHelper
An implementation ofAutoexposeHelper
that performs autoscrolling of aViewport
figure. This helper is for use with graphical editparts that contain a viewport figure. This helper will search the editpart and find the viewport. Autoscroll will occur when the detect location is inside the viewport's bounds, but near its edge. It will continue for as long as the location continues to meet these criteria. The autoscroll direction is approximated to the nearest orthogonal or diagonal direction (north, northeast, east, etc.).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.gef.AutoexposeHelper
AutoexposeHelper.Search
-
-
Field Summary
Fields Modifier and Type Field Description protected GraphicalEditPart
owner
-
Constructor Summary
Constructors Constructor Description ViewportAutoexposeHelper(GraphicalEditPart owner)
Constructs a new helper on the given GraphicalEditPart.ViewportAutoexposeHelper(GraphicalEditPart owner, org.eclipse.draw2d.geometry.Insets threshold)
Constructs a new helper on the given GraphicalEditPart.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
detect(org.eclipse.draw2d.geometry.Point where)
Returnstrue
if the given point is inside the viewport, but near its edge.protected org.eclipse.draw2d.Viewport
findViewport(GraphicalEditPart part)
boolean
step(org.eclipse.draw2d.geometry.Point where)
Returnstrue
if the given point is outside the viewport or near its edge.java.lang.String
toString()
-
-
-
Field Detail
-
owner
protected GraphicalEditPart owner
-
-
Constructor Detail
-
ViewportAutoexposeHelper
public ViewportAutoexposeHelper(GraphicalEditPart owner)
Constructs a new helper on the given GraphicalEditPart. The editpart must have aViewport
somewhere between its contentsPane and its figure inclusively.- Parameters:
owner
- the GraphicalEditPart that owns the Viewport
-
ViewportAutoexposeHelper
public ViewportAutoexposeHelper(GraphicalEditPart owner, org.eclipse.draw2d.geometry.Insets threshold)
Constructs a new helper on the given GraphicalEditPart. The editpart must have aViewport
somewhere between its contentsPane and its figure inclusively.- Parameters:
owner
- the GraphicalEditPart that owns the Viewportthreshold
- the Expose Threshold to use when determing whether or not a scroll should occur.
-
-
Method Detail
-
detect
public boolean detect(org.eclipse.draw2d.geometry.Point where)
Returnstrue
if the given point is inside the viewport, but near its edge.- Specified by:
detect
in interfaceAutoexposeHelper
- Parameters:
where
- the mouse's current location in the viewer- Returns:
true
if the location is interesting- See Also:
AutoexposeHelper.detect(org.eclipse.draw2d.geometry.Point)
-
step
public boolean step(org.eclipse.draw2d.geometry.Point where)
Returnstrue
if the given point is outside the viewport or near its edge. Scrolls the viewport by a calculated (time based) amount in the current direction. todo: investigate if we should allow auto expose when the pointer is outside the viewport- Specified by:
step
in interfaceAutoexposeHelper
- Parameters:
where
- the current location of the mouse in the viewer- Returns:
- a hint indicating whether this helper should continue to be invoked
- See Also:
AutoexposeHelper.step(org.eclipse.draw2d.geometry.Point)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
findViewport
protected org.eclipse.draw2d.Viewport findViewport(GraphicalEditPart part)
-
-