Package org.eclipse.draw2d
Class ScrollPane
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.ScrollPane
- All Implemented Interfaces:
IFigure
- Direct Known Subclasses:
PuristicScrollPane
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIterator
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
IFigure.NoInsets
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant indicating to always show the ScrollBarstatic final int
Constant indicating to show as needed, when the ScrollPane can't contain its viewprotected ScrollBar
The horizontal scrollbarstatic final int
Constant indicating to never show the ScrollBarprotected ScrollBar
The vertical scrollbarprotected Viewport
The viewport being scrolledFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates a new horizontally oriented ScrollBar and adds it to this ScrollPane.protected void
Creates a new vertically oriented ScrollBar and adds it to this ScrollPane.protected void
Creates a new Viewport and adds it to this ScrollPane.Returns the contents of the viewport.Returns the ScrollPane's horizontal ScrollBar.int
Returns the visibility of the ScrollPane's horizontal ScrollBar.Returns the ScrollPane's vertical ScrollBar.int
Returns the visibility of the ScrollPane's vertical ScrollBar.getView()
Deprecated.use getContents()Returns the ScrollPane'sViewport
.boolean
isOpaque()
Returns true because ScrollPanes are always opaque.void
scrollHorizontalTo
(int x) Scrolls the Scrollpane horizontally x pixels from its left-most position.void
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
Sets the ScrollPane's horizontal ScrollBar to the passed ScrollBar.void
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
Sets the ScrollPane's vertical ScrollBar to the passed Scrollbar.void
Sets the vertical ScrollBar visibility of the ScrollPane to the passed value.void
Deprecated.call setContents(IFigure) insteadvoid
setViewport
(Viewport vp) Sets the ScrollPane's Viewport to the passed value.void
validate()
Indicates that this figure should make itself valid.Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, 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, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, 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
-
Field Details
-
NEVER
public static final int NEVERConstant indicating to never show the ScrollBar- See Also:
-
AUTOMATIC
public static final int AUTOMATICConstant indicating to show as needed, when the ScrollPane can't contain its view- See Also:
-
ALWAYS
public static final int ALWAYSConstant indicating to always show the ScrollBar- See Also:
-
viewport
The viewport being scrolled -
hBar
The horizontal scrollbar -
vBar
The vertical scrollbar
-
-
Constructor Details
-
ScrollPane
public ScrollPane()Constructs a new ScrollPane with a ScrollPaneLayout.- Since:
- 2.0
-
-
Method Details
-
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
Returns the ScrollPane's horizontal ScrollBar.- Returns:
- the 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 constantsNEVER
,AUTOMATIC
, andALWAYS
. The default isAUTOMATIC
.- Returns:
- the visiblity of the horizontal scrollbar
- Since:
- 2.0
-
getVerticalScrollBar
Returns the ScrollPane's vertical ScrollBar.- Returns:
- teh 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 constantsNEVER
,AUTOMATIC
, andALWAYS
. The default isAUTOMATIC
.- Returns:
- the visibility of the vertical scrollbar
- Since:
- 2.0
-
getContents
Returns the contents of the viewport.- Returns:
- the contents of the viewport
-
getView
Deprecated.use getContents()Returns the ScrollPane's view. The view is the IFigure that is the contents of the ScrollPane.- Returns:
- the contents
- Since:
- 2.0
-
getViewport
Returns the ScrollPane'sViewport
.- Returns:
- the viewport
- Since:
- 2.0
-
isOpaque
public boolean isOpaque()Returns true because ScrollPanes are always opaque. -
scrollHorizontalTo
public void scrollHorizontalTo(int x) Scrolls the Scrollpane horizontally x pixels from its left-most position.- Parameters:
x
- the amount to scroll horizontally- Since:
- 2.0
-
scrollTo
Scrolls the Scrollpane horizontally from its left-most position by location.x pixels and vertically from its top-most position by location.y pixels.- Parameters:
location
- the point to scroll to- Since:
- 2.0
-
scrollVerticalTo
public void scrollVerticalTo(int y) Scrolls the Scrollpane vertically y pixels from its top-most position.- Parameters:
y
- the amount to scroll vertically- Since:
- 2.0
-
setContents
Sets the contents of the current viewport.- Parameters:
figure
- the contents of the viewport
-
setHorizontalScrollBar
Sets the ScrollPane's horizontal ScrollBar to the passed ScrollBar.- Parameters:
bar
- the new horizontal scrollbar- Since:
- 2.0
-
setHorizontalScrollBarVisibility
public void setHorizontalScrollBarVisibility(int v) Sets the horizontal ScrollBar visibility of the ScrollPane to the passed value. These are represented by the integer class constantsNEVER
,AUTOMATIC
, andALWAYS
. The default isAUTOMATIC
.- Parameters:
v
- the new horizontal visibility- Since:
- 2.0
-
setScrollBarVisibility
public void setScrollBarVisibility(int v) Sets both the horizontal and vertical ScrollBar visibilities of the ScrollPane to the passed value. These are represented by the integer class constantsNEVER
,AUTOMATIC
, andALWAYS
. The default isAUTOMATIC
.- Parameters:
v
- the new vertical and horizontal visibility- Since:
- 2.0
-
setVerticalScrollBar
Sets the ScrollPane's vertical ScrollBar to the passed Scrollbar.- Parameters:
bar
- the new vertical scrollbar- Since:
- 2.0
-
setVerticalScrollBarVisibility
public void setVerticalScrollBarVisibility(int v) Sets the vertical ScrollBar visibility of the ScrollPane to the passed value. These are represented by the integer class constantsNEVER
,AUTOMATIC
, andALWAYS
. The default isAUTOMATIC
.- Parameters:
v
- the new vertical scrollbar visibility- Since:
- 2.0
-
setView
Deprecated.call setContents(IFigure) insteadSets the ScrollPane's view to the passed IFigure. The view is the top-level IFigure which represents the contents of the ScrollPane.- Parameters:
figure
- the new contents- Since:
- 2.0
-
setViewport
Sets the ScrollPane's Viewport to the passed value.- Parameters:
vp
- the new viewport- Since:
- 2.0
-
validate
public void validate()Description copied from interface:IFigure
Indicates that this figure should make itself valid. Validation includes invoking layout on a LayoutManager if present, and then validating all children figures. Default validation uses pre-order, depth-first ordering.
-