Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.ScrollPane


  public TrayScrollPaneLayout() {
    super();
  }

  public void layout(IFigure parent) {
    ScrollPane scrollpane = (ScrollPane)parent;
    Rectangle clientArea = parent.getClientArea();

    ScrollBar hBar = scrollpane.getHorizontalScrollBar(),
          vBar = scrollpane.getVerticalScrollBar();
    Viewport viewport = scrollpane.getViewport();

    Insets insets = new Insets();
    insets.bottom = hBar.getPreferredSize(clientArea.width, clientArea.height).height;
    insets.right  = vBar.getPreferredSize(clientArea.width, clientArea.height).width;

    int hVis = scrollpane.getHorizontalScrollBarVisibility(),
        vVis = scrollpane.getVerticalScrollBarVisibility();

    Dimension available = clientArea.getSize(),
      preferred =
        viewport.getPreferredSize(available.width, available.height).getCopy();
View Full Code Here


      }
      childrenFigure = target;
      childrenScrollPane.setContents(target);
    }
    protected ScrollPane createScrollpane() {
      ScrollPane scrollpane = new ScrollPane();
      scrollpane.getViewport().setContentsTracksWidth(true);
      scrollpane.getViewport().setContentsTracksHeight(true);
      scrollpane.setMinimumSize(new Dimension(0, 0));
      scrollpane.setHorizontalScrollBarVisibility(ScrollPane.NEVER);
      scrollpane.setVerticalScrollBar(new TrayScrollBar());
      scrollpane.getVerticalScrollBar().setStepIncrement(SCROLL_STEP);
      scrollpane.setLayoutManager(new TrayScrollPaneLayout());
      return scrollpane;
    }
View Full Code Here

  protected void reveal(GraphicalEditPart part) {
    // there's no need to scroll to the main edit part because it is always visible
    if (part instanceof MainTrayEditPart) return;

    MainTrayEditPart mainPart = getMainTrayEditPart(part);
    ScrollPane scrollpane = ((MainTrayEditPart.MainTrayContainerFigure)mainPart.getFigure()).getChildrenScrollPane();
    Viewport viewport = scrollpane.getViewport();
    Rectangle partBounds = part.getFigure().getBounds().getCopy();
    Rectangle portBounds = viewport.getBounds();
    if (!portBounds.contains(partBounds)) {
      Point topLocation = partBounds.getTopLeft();
     
      Point currentLocation = viewport.getViewLocation();
      int step = getScrollStep(part);
      if (currentLocation.getPosition(topLocation) == PositionConstants.NORTH) {
        currentLocation.y -= step;
        // ensure that we don't leave things "half-scrolled" at the top
        currentLocation.y = (currentLocation.y < step) ? 0 : currentLocation.y;
      } else {
        currentLocation.y += step;
      }
      viewport.setViewLocation(currentLocation);

      // refreshes the scrollbar so they can disppear if needed
      ScrollBar scrollbar = scrollpane.getVerticalScrollBar();
      scrollbar.invalidate();
      scrollbar.validate();
    }
  }
View Full Code Here

    private Label label = new Label();
   
    public ElementContainerFigure() {
        setSize(200, 150);
        setBorder(new LineBorder(1));
        ScrollPane scrollpane = new ScrollPane();
        pane = new FreeformLayer();
        pane.setLayoutManager(new FreeformLayout());
        setLayoutManager(new StackLayout());
        add(scrollpane);
        IFigure panel = new Layer();
        FlowLayout flowLayout = new FlowLayout();
        flowLayout.setMajorAlignment(FlowLayout.ALIGN_CENTER);
        panel.setLayoutManager(flowLayout);
        panel.add(label);
        add(panel);
        scrollpane.setViewport(new FreeformViewport());
        scrollpane.setContents(pane);
    }
View Full Code Here

private IFigure pane;

public CircuitFigure() {
  setBorder(new CircuitBorder());
  ScrollPane scrollpane = new ScrollPane();
  pane = new FreeformLayer();
  pane.setLayoutManager(new FreeformLayout());
  setLayoutManager(new StackLayout());
  add(scrollpane);
  scrollpane.setViewport(new FreeformViewport());
  scrollpane.setContents(pane);

  createConnectionAnchors();
  setBackgroundColor(ColorConstants.listBackground);
  setOpaque(true);
}
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.ScrollPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.