Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Papyrus/Papyrus Developer Guide/NoScrollbar
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