public abstract class SelectionEditPolicy extends GraphicalEditPolicy
This EditPolicy adds itself as an EditPartListener
so that it can
observe selection. When selection or focus changes, the EditPolicy will
update itself and call the appropriate methods.
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 |
---|
SelectionEditPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Extends activate to hook the appropriate listener and to initialize the
visual changes for representing selection/focus.
|
protected void |
addSelectionListener()
Adds an EditPartListener to the host to observe selection/focus changes.
|
void |
deactivate()
Extends deactivate to unhook the seleciton listener and to remove the
visual changes for representing selection/focus.
|
EditPart |
getTargetEditPart(Request request)
Returns
null by default. |
protected void |
hideFocus()
Override to hide focus
|
protected abstract void |
hideSelection()
Override to hide selection
|
protected void |
removeSelectionListener()
Removes the EditPartListener used to observe selection
|
protected void |
setFocus(boolean value)
Sets the internal focus value.
|
protected void |
setSelectedState(int type)
Sets the internal selection value.
|
protected void |
showFocus()
Override to show focus.
|
protected void |
showPrimarySelection()
Calls
showSelection() by default. |
protected abstract void |
showSelection()
Override to show selection
|
addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback
debugFeedback, eraseSourceFeedback, eraseTargetFeedback, getCommand, getHost, setHost, showSourceFeedback, showTargetFeedback, toString, understandsRequest
public void activate()
activate
in interface EditPolicy
activate
in class AbstractEditPolicy
EditPolicy.activate()
protected void addSelectionListener()
public void deactivate()
deactivate
in interface EditPolicy
deactivate
in class AbstractEditPolicy
EditPolicy.deactivate()
public EditPart getTargetEditPart(Request request)
AbstractEditPolicy
null
by default. null
indicates that
this policy is unable to determine the target for the specified
Request
.getTargetEditPart
in interface EditPolicy
getTargetEditPart
in class AbstractEditPolicy
request
- the Requestnull
or the appropriate target EditPart
EditPolicy.getTargetEditPart(Request)
protected void hideFocus()
showFocus()
protected abstract void hideSelection()
protected void removeSelectionListener()
protected void setFocus(boolean value)
showFocus()
or
hideFocus()
will be called.value
- true
if the EditPolicy should show focusprotected void setSelectedState(int type)
type
- the type of selection the EditPolicy should displayprotected void showFocus()
hideFocus()
protected void showPrimarySelection()
showSelection()
by default. Override to distinguish
between primary and normal selection.protected abstract void showSelection()
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.