public class NonResizableEditPolicy extends SelectionHandlesEditPolicy
DragEditPartsTrackers, which allows the current
selection to be dragged.
During feedback, a rectangle filled using XOR and outlined with dashes is drawn. Subclasses can tailor the feedback.
handlesCOMPONENT_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_ROLEREQ_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 |
|---|
NonResizableEditPolicy() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createDragHandle(java.util.List handles,
int direction)
Creates a 'resize'/'drag' handle, which uses a
DragEditPartsTracker in case isDragAllowed() returns
true, and a SelectEditPartTracker otherwise. |
protected IFigure |
createDragSourceFeedbackFigure()
Creates the figure used for feedback.
|
protected void |
createMoveHandle(java.util.List handles)
Creates a 'move' handle, which uses a
DragEditPartsTracker in
case isDragAllowed() returns true, and a
SelectEditPartTracker otherwise. |
protected java.util.List |
createSelectionHandles()
Subclasses must implement to provide the list of handles.
|
void |
deactivate()
Extends deactivate to unhook the seleciton listener and to remove the
visual changes for representing selection/focus.
|
protected void |
eraseChangeBoundsFeedback(ChangeBoundsRequest request)
Erases drag feedback.
|
void |
eraseSourceFeedback(Request request)
Does nothing by default.
|
protected Command |
getAlignCommand(AlignmentRequest request)
Returns the command contribution to an alignment request
|
Command |
getCommand(Request request)
Returns
null by default. |
protected IFigure |
getDragSourceFeedbackFigure()
Lazily creates and returns the feedback figure used during drags.
|
protected DragEditPartsTracker |
getDragTracker()
Returns a drag tracker to use by a resize handle.
|
protected Rectangle |
getInitialFeedbackBounds()
Returns the bounds of the host's figure by reference to be used to
calculate the initial location of the feedback.
|
protected Command |
getMoveCommand(ChangeBoundsRequest request)
Returns the command contribution to a change bounds request.
|
protected Command |
getOrphanCommand(Request req)
Subclasses may override to contribute to the orphan request.
|
protected SelectEditPartTracker |
getSelectTracker()
Returns a selection tracker to use by a selection handle.
|
protected void |
hideFocus()
Hides the focus rectangle displayed in
showFocus(). |
boolean |
isDragAllowed()
Returns true if this EditPolicy allows its EditPart to be dragged.
|
void |
setDragAllowed(boolean isDragAllowed)
Sets the dragability of the EditPolicy to the given value.
|
protected void |
showChangeBoundsFeedback(ChangeBoundsRequest request)
Shows or updates feedback for a change bounds request.
|
protected void |
showFocus()
Shows a focus rectangle around the host's figure.
|
void |
showSourceFeedback(Request request)
Calls other methods as appropriate.
|
boolean |
understandsRequest(Request request)
Returns
true for move, align, add, and orphan request types. |
addSelectionHandles, getAdapter, hideSelection, removeSelectionHandles, showSelectionactivate, addSelectionListener, getTargetEditPart, removeSelectionListener, setFocus, setSelectedState, showPrimarySelectionaddFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedbackdebugFeedback, eraseTargetFeedback, getHost, setHost, showTargetFeedback, toStringprotected IFigure createDragSourceFeedbackFigure()
protected java.util.List createSelectionHandles()
SelectionHandlesEditPolicycreateSelectionHandles in class SelectionHandlesEditPolicynullSelectionHandlesEditPolicy.createSelectionHandles()protected void createDragHandle(java.util.List handles,
int direction)
DragEditPartsTracker in case isDragAllowed() returns
true, and a SelectEditPartTracker otherwise.handles - The list of handles to add the resize handle todirection - A position constant indicating the direction to create the
handle forprotected SelectEditPartTracker getSelectTracker()
ResizeTrackerprotected DragEditPartsTracker getDragTracker()
ResizeTrackerprotected void createMoveHandle(java.util.List handles)
DragEditPartsTracker in
case isDragAllowed() returns true, and a
SelectEditPartTracker otherwise.handles - The list of handles to add the move handle to.public void deactivate()
SelectionEditPolicydeactivate in interface EditPolicydeactivate in class SelectionEditPolicyEditPolicy.deactivate()protected void eraseChangeBoundsFeedback(ChangeBoundsRequest request)
request - the requestpublic void eraseSourceFeedback(Request request)
AbstractEditPolicyeraseSourceFeedback in interface EditPolicyeraseSourceFeedback in class AbstractEditPolicyrequest - the RequestEditPolicy.eraseSourceFeedback(org.eclipse.gef.Request)public Command getCommand(Request request)
AbstractEditPolicynull by default. null is used to
indicate that the EditPolicy does not contribute to the specified
Request.getCommand in interface EditPolicygetCommand in class AbstractEditPolicyrequest - the Requestnull or a Command contributionEditPolicy.getCommand(org.eclipse.gef.Request)protected IFigure getDragSourceFeedbackFigure()
protected Command getAlignCommand(AlignmentRequest request)
request - the alignment requestprotected Rectangle getInitialFeedbackBounds()
protected Command getMoveCommand(ChangeBoundsRequest request)
RequestConstants.REQ_MOVE_CHILDREN request. The
parent's contribution is returned.request - the change bounds requestprotected Command getOrphanCommand(Request req)
null is returned to indicate no participation. Orphan
requests are not forwarded to the host's parent here. That is done in
ComponentEditPolicy. So, if the host has a component editpolicy,
then the parent will already have a chance to contribute.req - the orphan requestnull by defaultprotected void hideFocus()
showFocus().hideFocus in class SelectionEditPolicyshowFocus(),
SelectionEditPolicy.hideFocus()public boolean isDragAllowed()
public void setDragAllowed(boolean isDragAllowed)
isDragAllowed - whether or not the EditPolicy can be dragged.protected void showChangeBoundsFeedback(ChangeBoundsRequest request)
request - the requestprotected void showFocus()
showFocus in class SelectionEditPolicySelectionEditPolicy.showFocus()public void showSourceFeedback(Request request)
showSourceFeedback in interface EditPolicyshowSourceFeedback in class AbstractEditPolicyrequest - the RequestEditPolicy.showSourceFeedback(org.eclipse.gef.Request)public boolean understandsRequest(Request request)
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 EditPolicyunderstandsRequest in class AbstractEditPolicyrequest - the Requesttrue if the EditPolicy understands the
specified requestEditPolicy.understandsRequest(org.eclipse.gef.Request)Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.