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"
(→How to) |
|||
Line 5: | Line 5: | ||
= How to = | = How to = | ||
− | *In the editpart parent ( | + | *In the editpart parent (compartmentEditPart) add in the method refreshvisual the line to not display scroll bar For example: |
<pre>protected void refreshVisuals() { | <pre>protected void refreshVisuals() { | ||
super.refreshVisuals(); | super.refreshVisuals(); | ||
Line 16: | Line 16: | ||
* For all children edit part, | * For all children edit part, | ||
− | - Overload the method | + | - Overload the method getDragTracker. 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 |
<pre> | <pre> | ||
/** | /** |
Revision as of 04:28, 13 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 (compartmentEditPart) 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 getDragTracker. 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