Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Papyrus/Papyrus Developer Guide/NoScrollbar"
(New page: = Goal = The goal is to display a compartment without scroll bar. All elements in this compartment cannot be move outdoor as (the behavior of the scrollbar) = How to = *In the editpa...) |
|||
Line 6: | Line 6: | ||
*In the editpart parent (compartmentEditPar) add in the method refreshvisual the line to not display scroll bar For example: | *In the editpart parent (compartmentEditPar) add in the method refreshvisual the line to not display scroll bar For example: | ||
− | + | <pre>protected void refreshVisuals() { | |
− | protected void refreshVisuals() { super.refreshVisuals(); ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER); refreshBounds(); } | + | super.refreshVisuals(); |
− | + | ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER); | |
+ | refreshBounds(); | ||
+ | } | ||
+ | </pre> | ||
<br> | <br> | ||
Line 25: | Line 28: | ||
} | } | ||
</pre> | </pre> | ||
− | <br> -Add an editpolicy for the role | + | <br> -Add an editpolicy for the role PRIMARY_DRAG_ROLE that provides A tracker for the constrained resize “NoScrollResizeTracker” A tracker for the constrained move “NoScrollDragEditPartsTrackerEx” |
<pre> | <pre> | ||
/** | /** |
Revision as of 08:25, 9 September 2011
Goal
The goal is to display a compartment without scroll bar. All elements in this compartment cannot be move outdoor as (the behavior of the scrollbar)
How to
- In the editpart parent (compartmentEditPar) add in the method refreshvisual the line to not display scroll bar For example:
protected void refreshVisuals() { super.refreshVisuals(); ((ResizableCompartmentFigure)getFigure()).getScrollPane().setScrollBarVisibility(org.eclipse.draw2d.ScrollPane.NEVER); refreshBounds(); }
- For all children edit part,
- Overload the method getDragTracke. The purpose of this method is to provide a tracker when you move the editpart. The NoScrollEditPartTracker provides a means to constraint movement in an a compartment without scroll bar
/** * the drag tracker has been specialized in order to constraint mvt inside its container without * scroll bar * {@inheritDoc} */ @Override public DragTracker getDragTracker(Request request) { return new NoScrollDragEditPartsTrackerEx(this); }
-Add an editpolicy for the role PRIMARY_DRAG_ROLE that provides A tracker for the constrained resize “NoScrollResizeTracker” A tracker for the constrained move “NoScrollDragEditPartsTrackerEx”
/** * this code has been overloaded in order to constraint the resize into its container without scroll bars *{@inheritDoc} */ @Override protected ResizeTracker getResizeTracker(int direction) { return new NoScrollResizeTracker((GraphicalEditPart) getHost(), direction); } /** * this code has been overloaded in order to constraint the move into its container without scroll bars *{@inheritDoc} */ @Override protected DragEditPartsTracker getDragTracker() { return new NoScrollDragEditPartsTrackerEx(getHost()); }
o See an example that contains theses two drag trackers: NoScrollClassifierResizableShapeEditPolicy