public class ScrollableSelectionFeedbackEditPolicy extends SelectionEditPolicy
SelectionEditPolicy
, which may be registered to an
IScrollableEditPart
to provide primary selection feedback by
rendering the hidden contents of the host figure's ScrollPane
's
nested Viewport
by means of GhostImageFigure
s.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 |
---|
ScrollableSelectionFeedbackEditPolicy() |
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 |
addFeedbackFigure(IFigure feedbackFigure,
Rectangle feedbackFigureAbsoluteBounds)
Adds a given feedback figure to the feedback layer (using the provided
bounds to layout it) and registers it in the local
feedbackFigures list. |
protected void |
createConnectionFeedbackFigure(ConnectionEditPart connectionEditPart)
Creates a ghost image feedback figure for the given
ConnectionEditPart 's figure and adds it to the feedback layer. |
protected void |
createConnectionFeedbackFigures()
Creates the connection layer feedback figures.
|
protected void |
createNodeFeedbackFigure(GraphicalEditPart childEditPart)
Creates a ghost image feedback figure for the given
GraphicalEditPart 's figure and adds it to the feedback layer. |
protected void |
createNodeFeedbackFigures()
Creates the primary layer feedback figures.
|
void |
deactivate()
Extends deactivate to unhook the seleciton listener and to remove the
visual changes for representing selection/focus.
|
protected int |
getAlpha()
Used to obtain the alpha value used for all feedback figures.
|
protected IFigure |
getFeedbackLayer()
Returns the layer used for displaying feedback.
|
protected Viewport |
getHostFigureViewport()
Provides access to the host figure's
Viewport . |
protected void |
hideFeedback()
Removes all feedback figures from the feedback layer as well as from the
feedbackFigures list. |
protected void |
hideSelection()
Override to hide selection
|
void |
setAlpha(int alpha)
Used to specify the alpha value used for all feedback figures.
|
void |
setHost(EditPart host)
Sets the host in which this EditPolicy is installed.
|
protected void |
showFeedback()
Creates feedback figures for all node figures nested within the host
figure's viewport, as well as for all incoming and outgoing connections
of these nodes.
|
protected void |
showSelection()
Override to show selection
|
protected void |
updateFeedback()
Removes any existing feedback figures by delegating to
hideFeedback() . |
addSelectionListener, getTargetEditPart, hideFocus, removeSelectionListener, setFocus, setSelectedState, showFocus, showPrimarySelection
addFeedback, getHostFigure, getLayer, removeFeedback
debugFeedback, eraseSourceFeedback, eraseTargetFeedback, getCommand, getHost, showSourceFeedback, showTargetFeedback, toString, understandsRequest
public ScrollableSelectionFeedbackEditPolicy()
public void activate()
SelectionEditPolicy
activate
in interface EditPolicy
activate
in class SelectionEditPolicy
SelectionEditPolicy.activate()
protected void addFeedbackFigure(IFigure feedbackFigure, Rectangle feedbackFigureAbsoluteBounds)
feedbackFigures
list.feedbackFigure
- the feedback figure to add to the feedback layerfeedbackFigureAbsoluteBounds
- the absolute bounds used to layout the feedback figureprotected void createConnectionFeedbackFigure(ConnectionEditPart connectionEditPart)
ConnectionEditPart
's figure and adds it to the feedback layer.connectionEditPart
- protected void createConnectionFeedbackFigures()
protected void createNodeFeedbackFigure(GraphicalEditPart childEditPart)
GraphicalEditPart
's figure and adds it to the feedback layer.childEditPart
- protected void createNodeFeedbackFigures()
public void deactivate()
SelectionEditPolicy
deactivate
in interface EditPolicy
deactivate
in class SelectionEditPolicy
SelectionEditPolicy.deactivate()
protected int getAlpha()
Graphics.setAlpha(int)
.protected IFigure getFeedbackLayer()
GraphicalEditPolicy
getFeedbackLayer
in class GraphicalEditPolicy
GraphicalEditPolicy.getFeedbackLayer()
protected Viewport getHostFigureViewport()
Viewport
.Viewport
of the host figure's
ScrollPane
protected void hideFeedback()
feedbackFigures
list.protected void hideSelection()
SelectionEditPolicy
hideSelection
in class SelectionEditPolicy
SelectionEditPolicy.hideSelection()
public void setAlpha(int alpha)
Graphics.setAlpha(int)
.alpha
- public void setHost(EditPart host)
EditPolicy
setHost
in interface EditPolicy
setHost
in class AbstractEditPolicy
host
- the host EditPartAbstractEditPolicy.setHost(EditPart)
protected void showFeedback()
protected void showSelection()
SelectionEditPolicy
showSelection
in class SelectionEditPolicy
SelectionEditPolicy.showSelection()
protected void updateFeedback()
hideFeedback()
. In case the host edit part is the primary
selection, recreates feedback figures via showFeedback()
.Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.