Package org.eclipse.draw2d
Class Viewport
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.Viewport
- All Implemented Interfaces:
- PropertyChangeListener,- EventListener,- IFigure
- Direct Known Subclasses:
- FreeformViewport
A Viewport is a flexible window onto a 
ScrollPane and represents the
 visible portion of the ScrollPane.- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.draw2d.FigureFigure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigureIFigure.NoInsets
- 
Field SummaryFieldsFields inherited from class org.eclipse.draw2d.FigurebgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigureMAX_DIMENSION, MIN_DIMENSION, NO_INSETS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetClientArea(Rectangle rect) Copies the client area into the specificied Recangle, and returns that rectangle for convenience.Returns the view, which is the contents of theScrollPaneassociated with this Viewport.booleanReturnstrueif the Viewport resizes itself in the vertical direction when the available height of its view is decreased, false otherwise.booleanReturnstrueif the Viewport resizes itself in the horizontal direction when the available width of its view is decreased, false otherwise.Returns the RangeModel associated with the horizontal motion of this ViewportReturns the range model associated with the vertical motion of the Viewport.Returns the current location of this Viewport.booleanReturnstrueif this figure is capable of applying a local coordinate system which affects its children.protected voidPaints this Figure's client area.voidListens for either of theRangeModelsto fire a property change event and updates the view accordingly.protected voidSets extents ofRangeModelsto the client area of this Viewport.voidsetContents(IFigure figure) Sets this Viewport to be associated with the passed Figure.voidsetContentsTracksHeight(boolean track) Toggles the Viewport's ability to resize itself automatically when its view is decreased in size in the vertical direction.voidsetContentsTracksWidth(boolean track) Toggles the Viewport's ability to resize itself automatically when its view is decreased in size in the horizontal direction.voidsetHorizontalLocation(int value) Sets the horizontal location of the Viewport's view to the passed value.voidsetHorizontalRangeModel(RangeModel rangeModel) Sets the horizontal range model to the passed RangeModel.voidsetIgnoreScroll(boolean value) If value istrue, this viewport will ignore any scrolling that occurs until this method is called again withfalse.voidsetVerticalLocation(int value) Sets the vertical location of the Viewport's view to the passed value.voidsetVerticalRangeModel(RangeModel rangeModel) Sets the vertical range model to the passed RangeModel.voidsetViewLocation(int x, int y) Sets the location of the Viewport's view to the passed values.voidSets the location of the Viewport's view to the passed Point.voidTranslates a Translatable from this IFigure's parent's coordinates to this IFigure's local coordinates.voidTranslates a Translatable from this IFigure's coordinates to its parent's coordinates.booleanReturnstrueif this viewport uses graphics translation.voidvalidate()Indicates that this figure should make itself valid.Methods inherited from class org.eclipse.draw2d.Figureadd, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, 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, 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, handleMouseWheelScrolled, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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, translateToAbsolute, translateToRelative, useLocalCoordinates
- 
Field Details- 
PROPERTY_VIEW_LOCATIONID for the view location property- See Also:
 
 
- 
- 
Constructor Details- 
Viewportpublic Viewport()Constructs a new Viewport with the default values.
- 
Viewportpublic Viewport(boolean setting) Constructs a new Viewport. If setting istrue, the viewport will use graphics translation to paint.- Parameters:
- setting- whether to use graphics translation
 
 
- 
- 
Method Details- 
getClientAreaDescription copied from interface:IFigureCopies the client area into the specificied Recangle, and returns that rectangle for convenience.- Specified by:
- getClientAreain interface- IFigure
- Overrides:
- getClientAreain class- Figure
- Parameters:
- rect- The destination rectangle for the client area
- Returns:
- The same instance that was passed in, modified to contain the client area
- See Also:
 
- 
getContentsReturns the view, which is the contents of theScrollPaneassociated with this Viewport.- Returns:
- the contents
- Since:
- 2.0
 
- 
getHorizontalRangeModelReturns the RangeModel associated with the horizontal motion of this Viewport- Returns:
- the RangeModel
- Since:
- 2.0
 
- 
getContentsTracksHeightpublic boolean getContentsTracksHeight()Returnstrueif the Viewport resizes itself in the vertical direction when the available height of its view is decreased, false otherwise. This option is turned off by default, and can be activated by callingsetContentsTracksHeight(boolean)and passing intrue.- Returns:
- whether the contents tracks height
- Since:
- 2.0
 
- 
getContentsTracksWidthpublic boolean getContentsTracksWidth()Returnstrueif the Viewport resizes itself in the horizontal direction when the available width of its view is decreased, false otherwise. This option is turned off by default, and can be activated by callingsetContentsTracksWidth(boolean)and passing intrue.- Returns:
- whether the contents tracks width
- Since:
- 2.0
 
- 
getVerticalRangeModelReturns the range model associated with the vertical motion of the Viewport.- Returns:
- the RangeModel
- Since:
- 2.0
 
- 
getViewLocationReturns the current location of this Viewport.- Returns:
- the current location of this Viewport
- Since:
- 2.0
 
- 
paintClientAreaDescription copied from class:FigurePaints this Figure's client area. The client area is typically defined as the anything inside the Figure'sBorderorInsets, and by default includes the children of this Figure. On return, this method must leave the given Graphics in its initial state.- Overrides:
- paintClientAreain class- Figure
- Parameters:
- g- The Graphics used to paint
- See Also:
 
- 
isCoordinateSystempublic boolean isCoordinateSystem()Description copied from interface:IFigureReturnstrueif this figure is capable of applying a local coordinate system which affects its children.- Specified by:
- isCoordinateSystemin interface- IFigure
- Overrides:
- isCoordinateSystemin class- Figure
- Returns:
- trueif this figure provides local coordinates to children
- See Also:
 
- 
propertyChangeListens for either of theRangeModelsto fire a property change event and updates the view accordingly.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Parameters:
- event- the event
 
- 
readjustScrollBarsprotected void readjustScrollBars()Sets extents ofRangeModelsto the client area of this Viewport. Sets RangeModel minimums to zero. Sets RangeModel maximums to this Viewport's height/width.- Since:
- 2.0
 
- 
setContentsSets this Viewport to be associated with the passed Figure.- Parameters:
- figure- the new contents
- Since:
- 2.0
 
- 
setContentsTracksHeightpublic void setContentsTracksHeight(boolean track) Toggles the Viewport's ability to resize itself automatically when its view is decreased in size in the vertical direction. This is disabled by default.- Parameters:
- track- whether this viewport should track its height
- Since:
- 2.0
 
- 
setContentsTracksWidthpublic void setContentsTracksWidth(boolean track) Toggles the Viewport's ability to resize itself automatically when its view is decreased in size in the horizontal direction. This is disabled by default.- Parameters:
- track- whether this viewport should track its width
- Since:
- 2.0
 
- 
setHorizontalLocationpublic void setHorizontalLocation(int value) Sets the horizontal location of the Viewport's view to the passed value.- Parameters:
- value- the new horizontal location
- Since:
- 2.0
 
- 
setHorizontalRangeModelSets the horizontal range model to the passed RangeModel.- Parameters:
- rangeModel- the new horizontal range model
- Since:
- 2.0
 
- 
setIgnoreScrollpublic void setIgnoreScroll(boolean value) If value istrue, this viewport will ignore any scrolling that occurs until this method is called again withfalse.- Parameters:
- value- whether this viewport should ignore future scrolls
 
- 
setVerticalLocationpublic void setVerticalLocation(int value) Sets the vertical location of the Viewport's view to the passed value.- Parameters:
- value- the new vertical location
- Since:
- 2.0
 
- 
setVerticalRangeModelSets the vertical range model to the passed RangeModel.- Parameters:
- rangeModel- the new vertical RangeModel
- Since:
- 2.0
 
- 
setViewLocationpublic void setViewLocation(int x, int y) Sets the location of the Viewport's view to the passed values.- Parameters:
- x- The new x coordinate of the Viewport's view.
- y- The new y coordinate of the Viewport's view.
- Since:
- 2.0
 
- 
setViewLocationSets the location of the Viewport's view to the passed Point.- Parameters:
- p- The new location of the Viewport's view.
- Since:
- 2.0
 
- 
translateFromParentDescription copied from interface:IFigureTranslates a Translatable from this IFigure's parent's coordinates to this IFigure's local coordinates.- Specified by:
- translateFromParentin interface- IFigure
- Overrides:
- translateFromParentin class- Figure
- Parameters:
- t- The object to translate
- See Also:
 
- 
translateToParentDescription copied from interface:IFigureTranslates a Translatable from this IFigure's coordinates to its parent's coordinates.- Specified by:
- translateToParentin interface- IFigure
- Overrides:
- translateToParentin class- Figure
- Parameters:
- t- The object to translate
- See Also:
 
- 
useGraphicsTranslatepublic boolean useGraphicsTranslate()Returnstrueif this viewport uses graphics translation.- Returns:
- whether this viewport uses graphics translation
 
- 
validatepublic void validate()Description copied from interface:IFigureIndicates 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.
 
-