Skip to main content
Jump to: navigation, search

Papyrus/Papyrus Developer Guide/NoScrollbar

< Papyrus‎ | Papyrus Developer Guide
Revision as of 08:23, 9 September 2011 by Patrick.Tessier.cea.fr (Talk | contribs) (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...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 PRIMAR_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

Back to the top