GEF (MVC)
3.8.1.201211122107

org.eclipse.gef.editpolicies
Class ScrollableSelectionFeedbackEditPolicy

java.lang.Object
  extended by org.eclipse.gef.editpolicies.AbstractEditPolicy
      extended by org.eclipse.gef.editpolicies.GraphicalEditPolicy
          extended by org.eclipse.gef.editpolicies.SelectionEditPolicy
              extended by org.eclipse.gef.editpolicies.ScrollableSelectionFeedbackEditPolicy
All Implemented Interfaces:
EditPolicy, RequestConstants

public class ScrollableSelectionFeedbackEditPolicy
extends SelectionEditPolicy

A 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 GhostImageFigures.

Since:
3.6

Field Summary
 
Fields inherited from interface org.eclipse.gef.EditPolicy
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
 
Fields inherited from interface org.eclipse.gef.RequestConstants
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 Summary
ScrollableSelectionFeedbackEditPolicy()
           
 
Method Summary
 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().
 
Methods inherited from class org.eclipse.gef.editpolicies.SelectionEditPolicy
addSelectionListener, getTargetEditPart, hideFocus, removeSelectionListener, setFocus, setSelectedState, showFocus, showPrimarySelection
 
Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy
addFeedback, getHostFigure, getLayer, removeFeedback
 
Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
debugFeedback, eraseSourceFeedback, eraseTargetFeedback, getCommand, getHost, showSourceFeedback, showTargetFeedback, toString, understandsRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScrollableSelectionFeedbackEditPolicy

public ScrollableSelectionFeedbackEditPolicy()
Method Detail

activate

public void activate()
Description copied from class: SelectionEditPolicy
Extends activate to hook the appropriate listener and to initialize the visual changes for representing selection/focus.

Specified by:
activate in interface EditPolicy
Overrides:
activate in class SelectionEditPolicy
See Also:
SelectionEditPolicy.activate()

addFeedbackFigure

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.

Parameters:
feedbackFigure - the feedback figure to add to the feedback layer
feedbackFigureAbsoluteBounds - the absolute bounds used to layout the feedback figure

createConnectionFeedbackFigure

protected void createConnectionFeedbackFigure(ConnectionEditPart connectionEditPart)
Creates a ghost image feedback figure for the given ConnectionEditPart's figure and adds it to the feedback layer.

Parameters:
connectionEditPart -

createConnectionFeedbackFigures

protected void createConnectionFeedbackFigures()
Creates the connection layer feedback figures.


createNodeFeedbackFigure

protected void createNodeFeedbackFigure(GraphicalEditPart childEditPart)
Creates a ghost image feedback figure for the given GraphicalEditPart's figure and adds it to the feedback layer.

Parameters:
childEditPart -

createNodeFeedbackFigures

protected void createNodeFeedbackFigures()
Creates the primary layer feedback figures.


deactivate

public void deactivate()
Description copied from class: SelectionEditPolicy
Extends deactivate to unhook the seleciton listener and to remove the visual changes for representing selection/focus.

Specified by:
deactivate in interface EditPolicy
Overrides:
deactivate in class SelectionEditPolicy
See Also:
SelectionEditPolicy.deactivate()

getAlpha

protected int getAlpha()
Used to obtain the alpha value used for all feedback figures. The valid range is the one documented for Graphics.setAlpha(int).

Returns:
the alpha

getFeedbackLayer

protected IFigure getFeedbackLayer()
Description copied from class: GraphicalEditPolicy
Returns the layer used for displaying feedback.

Overrides:
getFeedbackLayer in class GraphicalEditPolicy
Returns:
the feedback layer
See Also:
GraphicalEditPolicy.getFeedbackLayer()

getHostFigureViewport

protected Viewport getHostFigureViewport()
Provides access to the host figure's Viewport.

Returns:
the nested Viewport of the host figure's ScrollPane

hideFeedback

protected void hideFeedback()
Removes all feedback figures from the feedback layer as well as from the feedbackFigures list.


hideSelection

protected void hideSelection()
Description copied from class: SelectionEditPolicy
Override to hide selection

Specified by:
hideSelection in class SelectionEditPolicy
See Also:
SelectionEditPolicy.hideSelection()

setAlpha

public void setAlpha(int alpha)
Used to specify the alpha value used for all feedback figures. The valid range is the one documented for Graphics.setAlpha(int).

Parameters:
alpha -

setHost

public void setHost(EditPart host)
Description copied from interface: EditPolicy
Sets the host in which this EditPolicy is installed.

Specified by:
setHost in interface EditPolicy
Overrides:
setHost in class AbstractEditPolicy
Parameters:
host - the host EditPart
See Also:
AbstractEditPolicy.setHost(EditPart)

showFeedback

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. Feedback figures are only created in case there are children or connections, which are not fully visible.


showSelection

protected void showSelection()
Description copied from class: SelectionEditPolicy
Override to show selection

Specified by:
showSelection in class SelectionEditPolicy
See Also:
SelectionEditPolicy.showSelection()

updateFeedback

protected void updateFeedback()
Removes any existing feedback figures by delegating to hideFeedback(). In case the host edit part is the primary selection, recreates feedback figures via showFeedback().


GEF (MVC)
3.8.1.201211122107

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.