Draw2D v2.0

org.eclipse.draw2d
Class Viewport

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
        |
        +--org.eclipse.draw2d.Viewport
All Implemented Interfaces:
EventListener, IFigure, PropertyChangeListener
Direct Known Subclasses:
FreeformViewport

public class Viewport
extends Figure
implements PropertyChangeListener

A Viewport is a flexible window onto a ScrollPane and represents the visible portion of the ScrollPane.


Inner classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator
 
Inner classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
static String PROPERTY_VIEW_LOCATION
           
 
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
Viewport()
           
Viewport(boolean setting)
           
 
Method Summary
 IFigure findDescendantAtExcluding(int x, int y, Collection set)
          Return the first IFigure found at point (x, y) that is not amongst the Collection set.
 Rectangle getClientArea(Rectangle rect)
          Modifies the given Rectangle so that it represents this Figure's client area, then returns it.
 IFigure getContents()
          Returns the view, which is the contents of the ScrollPane associated with this Viewport.
 boolean getContentsTracksHeight()
          Returns true if the Viewport resizes itself in the vertical direction when the available height of its view is decreased, false otherwise.
 boolean getContentsTracksWidth()
          Returns true if the Viewport resizes itself in the horizontal direction when the available width of its view is decreased, false otherwise.
 RangeModel getHorizontalRangeModel()
          Returns the RangeModel associated with the horizontal motion of this Viewport.
 RangeModel getVerticalRangeModel()
          Returns the RangeModel associated with the vertical motion of the Viewport.
 Point getViewLocation()
          Returns the current location of this Viewport.
protected  void paintClientArea(Graphics g)
          Paints this Figure's client area.
 void propertyChange(PropertyChangeEvent event)
           
protected  void readjustScrollBars()
          Sets extents of RangeModels to the client area of this Viewport.
 void setContents(IFigure figure)
          Sets this Viewport to be associated with the passed Figure.
 void setContentsTracksHeight(boolean track)
          Toggles the Viewport's ability to resize itself automatically when its view is decreased in size in the vertical direction.
 void setContentsTracksWidth(boolean track)
          Toggles the Viewport's ability to resize itself automatically when its view is decreased in size in the horizontal direction.
 void setHorizontalLocation(int value)
          Sets the horizontal location of the Viewport's view to the passed value.
 void setHorizontalRangeModel(RangeModel rangeModel)
          Sets the horizontal range model to the passed RangeModel.
 void setIgnoreScroll(boolean value)
           
 void setVerticalLocation(int value)
          Sets the vertical location of the Viewport's view to the passed value.
 void setVerticalRangeModel(RangeModel rangeModel)
          Sets the vertical range model to the passed RangeModel.
 void setViewLocation(int x, int y)
          Sets the location of the Viewport's view to the passed values.
 void setViewLocation(Point p)
          Sets the location of the Viewport's view to the passed Point.
 void translateFromParent(Translatable t)
          Translates a Translatable from this figure's parent's coordinates to this figure's local coordinates.
 void translateToParent(Translatable t)
          Translates a Translatable from this figure's coordinates to its parent's coordinates.
 boolean useGraphicsTranslate()
           
 void validate()
          Causes this figure 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, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocation, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, isEnabled, isFocusTraversable, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, 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, setUpdateManager, setValid, setVisible, translate, translateToAbsolute, translateToRelative, useLocalCoordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_VIEW_LOCATION

public static String PROPERTY_VIEW_LOCATION
Constructor Detail

Viewport

public Viewport()

Viewport

public Viewport(boolean setting)
Method Detail

findDescendantAtExcluding

public IFigure findDescendantAtExcluding(int x,
                                         int y,
                                         Collection set)
Return the first IFigure found at point (x, y) that is not amongst the Collection set.
Overrides:
findDescendantAtExcluding in class Figure
Parameters:
x - X coordinate of point where desired descendant is located.
y - Y coordinate of point where desired descendant is located.
set - Collection to check for exclusion.
Since:
2.0

getClientArea

public Rectangle getClientArea(Rectangle rect)
Description copied from class: Figure
Modifies the given Rectangle so that it represents this Figure's client area, then returns it.
Overrides:
getClientArea in class Figure

getContents

public IFigure getContents()
Returns the view, which is the contents of the ScrollPane associated with this Viewport.
Since:
2.0

getHorizontalRangeModel

public RangeModel getHorizontalRangeModel()
Returns the RangeModel associated with the horizontal motion of this Viewport.
Since:
2.0

getContentsTracksHeight

public boolean getContentsTracksHeight()
Returns true if 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 calling setContentsTracksHeight(true).
Since:
2.0

getContentsTracksWidth

public boolean getContentsTracksWidth()
Returns true if 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 calling setContentsTracksWidth(true).
Since:
2.0

getVerticalRangeModel

public RangeModel getVerticalRangeModel()
Returns the RangeModel associated with the vertical motion of the Viewport.
Since:
2.0

getViewLocation

public Point getViewLocation()
Returns the current location of this Viewport.
Since:
2.0

paintClientArea

protected void paintClientArea(Graphics g)
Description copied from class: Figure
Paints this Figure's client area. The client ares is typically defined as the anything inside the figures border or insets, and by default includes the children of this figure. This method levaes the graphics context in its initial state.
Overrides:
paintClientArea in class Figure

propertyChange

public void propertyChange(PropertyChangeEvent event)
Specified by:
propertyChange in interface PropertyChangeListener

readjustScrollBars

protected void readjustScrollBars()
Sets extents of RangeModels to the client area of this Viewport. Sets RangeModel minimums to zero. Sets RangeModel maximums to this Viewports height/width.
Since:
2.0

setContents

public void setContents(IFigure figure)
Sets this Viewport to be associated with the passed Figure.
Since:
2.0

setContentsTracksHeight

public 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.
Since:
2.0

setContentsTracksWidth

public 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.
Since:
2.0

setHorizontalLocation

public void setHorizontalLocation(int value)
Sets the horizontal location of the Viewport's view to the passed value.
Since:
2.0

setHorizontalRangeModel

public void setHorizontalRangeModel(RangeModel rangeModel)
Sets the horizontal range model to the passed RangeModel.
Since:
2.0

setIgnoreScroll

public void setIgnoreScroll(boolean value)

setVerticalLocation

public void setVerticalLocation(int value)
Sets the vertical location of the Viewport's view to the passed value.
Since:
2.0

setVerticalRangeModel

public void setVerticalRangeModel(RangeModel rangeModel)
Sets the vertical range model to the passed RangeModel.
Since:
2.0

setViewLocation

public 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

setViewLocation

public void setViewLocation(Point p)
Sets the location of the Viewport's view to the passed Point.
Parameters:
p - The new location of the Viewport's view.
Since:
2.0

translateFromParent

public void translateFromParent(Translatable t)
Description copied from interface: IFigure
Translates a Translatable from this figure's parent's coordinates to this figure's local coordinates.
Overrides:
translateFromParent in class Figure

translateToParent

public void translateToParent(Translatable t)
Description copied from interface: IFigure
Translates a Translatable from this figure's coordinates to its parent's coordinates.
Overrides:
translateToParent in class Figure

useGraphicsTranslate

public boolean useGraphicsTranslate()

validate

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

Draw2D v2.0