Eclipse Draw2d
2.1

org.eclipse.draw2d
Class ScrollPane

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
        |
        +--org.eclipse.draw2d.ScrollPane
All Implemented Interfaces:
IFigure

public class ScrollPane
extends Figure

A class which implements automatic horizontal and/or vertical scrolling for a single IFigure child. ScrollBar visibilites are represented by integer class constants: NEVER: Never show the ScrollBar AUTOMATIC: Show as needed, when the ScrollPane can no longer contain its view. ALWAYS: Always show the ScrollBar. To use, instantiate a ScrollPane object and call its setView(IFigure) method passing the IFigure that is desired to have scrolling ability.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator
 
Nested classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
static int ALWAYS
           
static int AUTOMATIC
           
protected  ScrollBar hBar
           
static int NEVER
           
protected  ScrollBar vBar
           
protected  Viewport viewport
           
 
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
ScrollPane()
          Constructs a new ScrollPane with a ScrollPaneLayout.
 
Method Summary
protected  void createHorizontalScrollBar()
          Creates a new horizontally oriented ScrollBar and adds it to this ScrollPane.
protected  void createVerticalScrollBar()
          Creates a new vertically oriented ScrollBar and adds it to this ScrollPane.
protected  void createViewport()
          Creates a new Viewport and adds it to this ScrollPane.
 IFigure getContents()
          Returns the contents of the viewport.
 ScrollBar getHorizontalScrollBar()
          Returns the ScrollPane's horizontal ScrollBar.
 int getHorizontalScrollBarVisibility()
          Returns the visibility of the ScrollPane's horizontal ScrollBar.
 ScrollBar getVerticalScrollBar()
          Returns the ScrollPane's vertical ScrollBar.
 int getVerticalScrollBarVisibility()
          Returns the visibility of the ScrollPane's vertical ScrollBar.
 IFigure getView()
          Deprecated. use getContents()
 Viewport getViewport()
          Returns the ScrollPane's Viewport.
 boolean isOpaque()
          Returns true if this IFigure is opaque.
 void scrollHorizontalTo(int x)
          Scrolls the Scrollpane horizontally x pixels from its left-most position.
 void scrollTo(Point location)
          Scrolls the Scrollpane horizontally from its left-most position by location.x pixels and vertically from its top-most position by location.y pixels.
 void scrollVerticalTo(int y)
          Scrolls the Scrollpane vertically y pixels from its top-most position.
 void setContents(IFigure figure)
          Sets the contents of the current viewport.
 void setHorizontalScrollBar(ScrollBar bar)
          Sets the ScrollPane's horizontal ScrollBar to the passed ScrollBar.
 void setHorizontalScrollBarVisibility(int v)
          Sets the horizontal ScrollBar visibility of the ScrollPane to the passed value.
 void setScrollBarVisibility(int v)
          Sets both the horizontal and vertical ScrollBar visibilities of the ScrollPane to the passed value.
 void setVerticalScrollBar(ScrollBar bar)
          Sets the ScrollPane's vertical ScrollBar to the passed Scrollbar.
 void setVerticalScrollBarVisibility(int v)
          Sets the vertical ScrollBar visibility of the ScrollPane to the passed value.
 void setView(IFigure figure)
          Deprecated. call setContents(IFigure) instead
 void setViewport(Viewport vp)
          Sets the ScrollPane's Viewport to the passed value.
 void validate()
          Causes this IFigure to layout itself, as well as its children.
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addFigureListener, addFocusListener, addKeyListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isEnabled, isFocusTraversable, isMouseEventTarget, isRequestFocusEnabled, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeFigureListener, removeFocusListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEVER

public static final int NEVER
See Also:
Constant Field Values

AUTOMATIC

public static final int AUTOMATIC
See Also:
Constant Field Values

ALWAYS

public static final int ALWAYS
See Also:
Constant Field Values

viewport

protected Viewport viewport

hBar

protected ScrollBar hBar

vBar

protected ScrollBar vBar
Constructor Detail

ScrollPane

public ScrollPane()
Constructs a new ScrollPane with a ScrollPaneLayout.

Since:
2.0
Method Detail

createHorizontalScrollBar

protected void createHorizontalScrollBar()
Creates a new horizontally oriented ScrollBar and adds it to this ScrollPane.

Since:
2.0

createViewport

protected void createViewport()
Creates a new Viewport and adds it to this ScrollPane.

Since:
2.0

createVerticalScrollBar

protected void createVerticalScrollBar()
Creates a new vertically oriented ScrollBar and adds it to this ScrollPane.

Since:
2.0

getHorizontalScrollBar

public ScrollBar getHorizontalScrollBar()
Returns the ScrollPane's horizontal ScrollBar.

Since:
2.0

getHorizontalScrollBarVisibility

public int getHorizontalScrollBarVisibility()
Returns the visibility of the ScrollPane's horizontal ScrollBar. These are represented by the integer class constants NEVER, AUTOMATIC, and ALWAYS. Default is AUTOMATIC.

Since:
2.0

getVerticalScrollBar

public ScrollBar getVerticalScrollBar()
Returns the ScrollPane's vertical ScrollBar.

Since:
2.0

getVerticalScrollBarVisibility

public int getVerticalScrollBarVisibility()
Returns the visibility of the ScrollPane's vertical ScrollBar. These are represented by the integer class constants NEVER, AUTOMATIC, and ALWAYS. Default is AUTOMATIC.

Since:
2.0

getContents

public IFigure getContents()
Returns the contents of the viewport.

Returns:
the contents of the viewport

getView

public IFigure getView()
Deprecated. use getContents()

Returns the ScrollPane's view. The view is the IFigure that is the contents of the ScrollPane.

Since:
2.0

getViewport

public Viewport getViewport()
Returns the ScrollPane's Viewport.

Since:
2.0

isOpaque

public boolean isOpaque()
Description copied from interface: IFigure
Returns true if this IFigure is opaque.

Specified by:
isOpaque in interface IFigure
Overrides:
isOpaque in class Figure
See Also:
IFigure.isOpaque()

scrollHorizontalTo

public void scrollHorizontalTo(int x)
Scrolls the Scrollpane horizontally x pixels from its left-most position.

Since:
2.0

scrollTo

public void scrollTo(Point location)
Scrolls the Scrollpane horizontally from its left-most position by location.x pixels and vertically from its top-most position by location.y pixels.

Since:
2.0

scrollVerticalTo

public void scrollVerticalTo(int y)
Scrolls the Scrollpane vertically y pixels from its top-most position.

Since:
2.0

setContents

public void setContents(IFigure figure)
Sets the contents of the current viewport.

Parameters:
figure - the contents of the viewport

setHorizontalScrollBar

public void setHorizontalScrollBar(ScrollBar bar)
Sets the ScrollPane's horizontal ScrollBar to the passed ScrollBar.

Since:
2.0

setHorizontalScrollBarVisibility

public void setHorizontalScrollBarVisibility(int v)
Sets the horizontal ScrollBar visibility of the ScrollPane to the passed value. Valid visiblities are represented by the integer class constants NEVER, AUTOMATIC, and ALWAYS. Default is AUTOMATIC.

Since:
2.0

setScrollBarVisibility

public void setScrollBarVisibility(int v)
Sets both the horizontal and vertical ScrollBar visibilities of the ScrollPane to the passed value. Valid visiblities are represented by the integer class constants NEVER, AUTOMATIC, and ALWAYS. Default is AUTOMATIC.

Since:
2.0

setVerticalScrollBar

public void setVerticalScrollBar(ScrollBar bar)
Sets the ScrollPane's vertical ScrollBar to the passed Scrollbar.

Since:
2.0

setVerticalScrollBarVisibility

public void setVerticalScrollBarVisibility(int v)
Sets the vertical ScrollBar visibility of the ScrollPane to the passed value. Valid visiblities are represented by the integer class constants NEVER, AUTOMATIC, and ALWAYS. Default is AUTOMATIC.

Since:
2.0

setView

public void setView(IFigure figure)
Deprecated. call setContents(IFigure) instead

Sets the ScrollPane's view to the passed IFigure. The view is the top-level IFigure which represents the contents of the ScrollPane.

Since:
2.0

setViewport

public void setViewport(Viewport vp)
Sets the ScrollPane's Viewport to the passed value.

Since:
2.0

validate

public void validate()
Description copied from interface: IFigure
Causes this IFigure to layout itself, as well as its children.

Specified by:
validate in interface IFigure
Overrides:
validate in class Figure
See Also:
IFigure.validate()

Eclipse Draw2d
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.