Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.ScrollBar


        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


  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();

    boolean none = available.contains(preferred),
        both = !none && vVis != NEVER && hVis != NEVER && preferred.contains(available),
        showV = both || preferred.height > available.height,
        showH = both || preferred.width > available.width;

    //Adjust for visibility override flags
    showV = !(vVis == NEVER) && (showV || vVis == ALWAYS);
    showH = !(hVis == NEVER) && (showH || hVis == ALWAYS);

    if (!showV) insets.right = 0;
    if (!showH) insets.bottom = 0;
    Rectangle bounds, viewportArea = clientArea;

    if (showV) {
      bounds = new Rectangle(
        viewportArea.right() - insets.right,
        viewportArea.y, insets.right, viewportArea.height);
      vBar.setBounds(bounds);
    }
    if (showH) {
      bounds = new Rectangle(viewportArea.x,
        viewportArea.bottom() - insets.bottom,
        viewportArea.width, insets.bottom);
      hBar.setBounds(bounds);
    }
    vBar.setVisible(showV);
    hBar.setVisible(showH);
    viewport.setBounds(viewportArea);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.ScrollBar

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.