jsynoptic.base
Interface ContextualActionProvider

All Known Subinterfaces:
SelectionContextualActionProvider
All Known Implementing Classes:
Abstract1DShape, Abstract2DShape, AreaPlotShape, AutomatonShape, BarChartShape, ConnectionShape, CyclicPlotShape, DataSourceAnimator, DataSourceCollectionAnimator, EllipseShape, HistoryShape, HistoryShape.HookedTextShape, HistoryTextShape, ImageShape, Java3dShape, LinesShape, MeterShape, ParametricPlotShape, PieChartShape, Plot, PolygonShape, RandomDataSourceCollection, RectangleShape, ScatterPlotShape, SocketDataSourceCollection, StandardPlotShape, SvgShape, TextArrayShape, TextShape, TimePlot, TimePlot, View3DShape, Xith3DView3DShape

public interface ContextualActionProvider

Implementing objects can provide actions possibly dependant on context information (position and target object)

Version:
1.0 2001
Author:
Nicolas Brodu

Field Summary
static int EDITOR_CONTEXT
           
static int MOUSE_OUT_CONTEXT
           
static int MOUSE_OVER_CONTEXT
           
static int MOUSE_PRESSED_CONTEXT
           
static int SHAPELIST_CONTEXT
           
static int SOURCELIST_CONTEXT
           
 
Method Summary
 boolean canDoAction(double x, double y, java.lang.Object o, java.lang.String action, int context)
          Returns true if, and only if, it is possible to do the action right now
 boolean doAction(double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
          Do one of the actions previously declared by getAction.
 java.lang.String[] getActions(double x, double y, java.lang.Object o, int context)
          Return list of possible actions the contect information may be used, or not.
 

Field Detail

EDITOR_CONTEXT

static final int EDITOR_CONTEXT
See Also:
Constant Field Values

SOURCELIST_CONTEXT

static final int SOURCELIST_CONTEXT
See Also:
Constant Field Values

MOUSE_OVER_CONTEXT

static final int MOUSE_OVER_CONTEXT
See Also:
Constant Field Values

MOUSE_OUT_CONTEXT

static final int MOUSE_OUT_CONTEXT
See Also:
Constant Field Values

MOUSE_PRESSED_CONTEXT

static final int MOUSE_PRESSED_CONTEXT
See Also:
Constant Field Values

SHAPELIST_CONTEXT

static final int SHAPELIST_CONTEXT
See Also:
Constant Field Values
Method Detail

getActions

java.lang.String[] getActions(double x,
                              double y,
                              java.lang.Object o,
                              int context)
Return list of possible actions the contect information may be used, or not.

Parameters:
x - Coordinate, mouse position in the same unit as contains(x,y)
y - Coordinate, mouse position in the same unit as contains(x,y)
o - Object the actions should work on. Possibly null => default or all actions
context - one of the context defined in the ContextualActionProvider class
Returns:
The list of possible actions, possibly null or an empty array

doAction

boolean doAction(double x,
                 double y,
                 java.lang.Object o,
                 java.lang.String action,
                 javax.swing.undo.CompoundEdit undoableEdit)
Do one of the actions previously declared by getAction.

Parameters:
x - Coordinate, for example mouse position
y - Coordinate, for example mouse position
o - Object the action should work on.
action - An action returned by a previous getActions call with the same x, y, o parameters It may be null, in which case the default action is requested for this x,y,o.
undoableEdit - current edit for undo/redo operation If not null, this action is undoable.
Returns:
true if the action could be performed

canDoAction

boolean canDoAction(double x,
                    double y,
                    java.lang.Object o,
                    java.lang.String action,
                    int context)
Returns true if, and only if, it is possible to do the action right now

Parameters:
x - Coordinate, for example mouse position
y - Coordinate, for example mouse position
o - Object the action should work on.
action - An action returned by a previous getActions call with the same x, y, o parameters It may be null, in which case the default action is requested for this x,y,o.
context - one of the context defined in the ContextualActionProvider class
Returns:
true if the action can be performed