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...) |
m (Quentin.lemenez.cea.fr moved page Papyrus Developer Guide/NoScrollbar to Papyrus/Papyrus Developer Guide/NoScrollbar) |
||
(2 intermediate revisions by one other user not shown) | |||
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() { | |
− | 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> | ||
* 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> | ||
/** | /** | ||
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> | ||
/** | /** |
Latest revision as of 05:09, 26 January 2018
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