public class ResizableEditPolicy extends NonResizableEditPolicy
DragEditPartsTracker
.
During feedback, a rectangle filled using XOR and outlined with dashes is drawn. Subclasses may tailor the feedback.
handles
COMPONENT_ROLE, CONNECTION_BENDPOINTS_ROLE, CONNECTION_ENDPOINTS_ROLE, CONNECTION_ROLE, CONTAINER_ROLE, DIRECT_EDIT_ROLE, GRAPHICAL_NODE_ROLE, LAYOUT_ROLE, NODE_ROLE, PRIMARY_DRAG_ROLE, SELECTION_FEEDBACK_ROLE, TREE_CONTAINER_ROLE
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
Constructor and Description |
---|
ResizableEditPolicy()
Constructs a new
ResizableEditPolicy . |
Modifier and Type | Method and Description |
---|---|
protected void |
createResizeHandle(java.util.List handles,
int direction)
Creates a 'resize' handle, which uses a
ResizeTracker in case
resizing is allowed in the respective direction, otherwise returns a drag
handle by delegating to
NonResizableEditPolicy.createDragHandle(List, int) . |
protected java.util.List |
createSelectionHandles()
Subclasses must implement to provide the list of handles.
|
void |
eraseSourceFeedback(Request request)
Dispatches erase requests to more specific methods.
|
Command |
getCommand(Request request)
Returns
null by default. |
protected Command |
getResizeCommand(ChangeBoundsRequest request)
Returns the command contribution for the given resize request.
|
int |
getResizeDirections()
Returns the directions in which resizing should be allowed
Valid values are bit-wise combinations of:
PositionConstants.NORTH
PositionConstants.SOUTH
PositionConstants.EAST
PositionConstants.WEST
or PositionConstants.NONE . |
protected ResizeTracker |
getResizeTracker(int direction)
Returns a resize tracker for the given direction to be used by a resize
handle.
|
void |
setResizeDirections(int newDirections)
Sets the directions in which handles should allow resizing.
|
void |
showSourceFeedback(Request request)
Calls other methods as appropriate.
|
boolean |
understandsRequest(Request request)
Returns
true for move, align, add, and orphan request types. |
createDragHandle, createDragSourceFeedbackFigure, createMoveHandle, deactivate, eraseChangeBoundsFeedback, getAlignCommand, getDragSourceFeedbackFigure, getDragTracker, getInitialFeedbackBounds, getMoveCommand, getOrphanCommand, getSelectTracker, hideFocus, isDragAllowed, setDragAllowed, showChangeBoundsFeedback, showFocus
addSelectionHandles, getAdapter, hideSelection, removeSelectionHandles, showSelection
activate, addSelectionListener, getTargetEditPart, removeSelectionListener, setFocus, setSelectedState, showPrimarySelection
addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback
debugFeedback, eraseTargetFeedback, getHost, setHost, showTargetFeedback, toString
public ResizableEditPolicy()
ResizableEditPolicy
.protected java.util.List createSelectionHandles()
SelectionHandlesEditPolicy
createSelectionHandles
in class NonResizableEditPolicy
null
SelectionHandlesEditPolicy.createSelectionHandles()
protected void createResizeHandle(java.util.List handles, int direction)
ResizeTracker
in case
resizing is allowed in the respective direction, otherwise returns a drag
handle by delegating to
NonResizableEditPolicy.createDragHandle(List, int)
.handles
- The list of handles to add the resize handle todirection
- A position constant indicating the direction to create the
handle forprotected ResizeTracker getResizeTracker(int direction)
direction
- the resize direction for the ResizeTracker
.ResizeTracker
public void eraseSourceFeedback(Request request)
eraseSourceFeedback
in interface EditPolicy
eraseSourceFeedback
in class NonResizableEditPolicy
request
- the RequestEditPolicy.eraseSourceFeedback(org.eclipse.gef.Request)
public Command getCommand(Request request)
AbstractEditPolicy
null
by default. null
is used to
indicate that the EditPolicy does not contribute to the specified
Request
.getCommand
in interface EditPolicy
getCommand
in class NonResizableEditPolicy
request
- the Requestnull
or a Command contributionEditPolicy.getCommand(org.eclipse.gef.Request)
protected Command getResizeCommand(ChangeBoundsRequest request)
RequestConstants.REQ_RESIZE_CHILDREN
. The
parent's edit policies determine how to perform the resize based on the
layout manager in use.request
- the resize requestpublic void setResizeDirections(int newDirections)
newDirections
- the direction in which resizing is allowedpublic void showSourceFeedback(Request request)
NonResizableEditPolicy
showSourceFeedback
in interface EditPolicy
showSourceFeedback
in class NonResizableEditPolicy
request
- the RequestEditPolicy.showSourceFeedback(org.eclipse.gef.Request)
public boolean understandsRequest(Request request)
NonResizableEditPolicy
true
for move, align, add, and orphan request types.
This method is never called for some of these types, but they are
included for possible future use.understandsRequest
in interface EditPolicy
understandsRequest
in class NonResizableEditPolicy
request
- the Requesttrue
if the EditPolicy understands the
specified requestEditPolicy.understandsRequest(org.eclipse.gef.Request)
public int getResizeDirections()
PositionConstants.NONE
.Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.