public class Viewport extends Figure implements java.beans.PropertyChangeListener
ScrollPane and represents the
visible portion of the ScrollPane.Figure.FigureIterator, Figure.IdentitySearchIFigure.NoInsets| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_VIEW_LOCATION
ID for the view location property
|
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipMAX_DIMENSION, MIN_DIMENSION, NO_INSETS| Constructor and Description |
|---|
Viewport()
Constructs a new Viewport with the default values.
|
Viewport(boolean setting)
Constructs a new Viewport.
|
| Modifier and Type | Method and Description |
|---|---|
Rectangle |
getClientArea(Rectangle rect)
Copies the client area into the specificied Recangle, and returns that
rectangle for convenience.
|
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 range model associated with the vertical motion of the
Viewport.
|
Point |
getViewLocation()
Returns the current location of this Viewport.
|
boolean |
isCoordinateSystem()
Returns
true if this figure is capable of applying a local
coordinate system which affects its children. |
protected void |
paintClientArea(Graphics g)
Paints this Figure's client area.
|
void |
propertyChange(java.beans.PropertyChangeEvent event)
Listens for either of the
RangeModels to fire a
property change event and updates the view accordingly. |
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)
If value is
true, this viewport will ignore any
scrolling that occurs until this method is called again with
false. |
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 IFigure's parent's coordinates to
this IFigure's local coordinates.
|
void |
translateToParent(Translatable t)
Translates a Translatable from this IFigure's coordinates to its parent's
coordinates.
|
boolean |
useGraphicsTranslate()
Returns
true if this viewport uses graphics translation. |
void |
validate()
Indicates that this figure should make itself valid.
|
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, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, 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, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, 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, translateToAbsolute, translateToRelative, useLocalCoordinatespublic static final java.lang.String PROPERTY_VIEW_LOCATION
public Viewport()
public Viewport(boolean setting)
true, the
viewport will use graphics translation to paint.setting - whether to use graphics translationpublic Rectangle getClientArea(Rectangle rect)
IFiguregetClientArea in interface IFiguregetClientArea in class Figurerect - The destination rectangle for the client areaIFigure.getClientArea(Rectangle)public IFigure getContents()
ScrollPane
associated with this Viewport.public RangeModel getHorizontalRangeModel()
public boolean getContentsTracksHeight()
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(boolean) and passing in
true.public boolean getContentsTracksWidth()
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(boolean) and passing
in true.public RangeModel getVerticalRangeModel()
public Point getViewLocation()
protected void paintClientArea(Graphics g)
FigureBorder or Insets, and by
default includes the children of this Figure. On return, this method must
leave the given Graphics in its initial state.paintClientArea in class Figureg - The Graphics used to paintFigure.paintClientArea(Graphics)public boolean isCoordinateSystem()
IFiguretrue if this figure is capable of applying a local
coordinate system which affects its children.isCoordinateSystem in interface IFigureisCoordinateSystem in class Figuretrue if this figure provides local coordinates to
childrenFigure.isCoordinateSystem()public void propertyChange(java.beans.PropertyChangeEvent event)
RangeModels to fire a
property change event and updates the view accordingly.propertyChange in interface java.beans.PropertyChangeListenerevent - the eventprotected void readjustScrollBars()
RangeModels to the client area of this
Viewport. Sets RangeModel minimums to zero. Sets RangeModel maximums to
this Viewport's height/width.public void setContents(IFigure figure)
figure - the new contentspublic void setContentsTracksHeight(boolean track)
track - whether this viewport should track its heightpublic void setContentsTracksWidth(boolean track)
track - whether this viewport should track its widthpublic void setHorizontalLocation(int value)
value - the new horizontal locationpublic void setHorizontalRangeModel(RangeModel rangeModel)
rangeModel - the new horizontal range modelpublic void setIgnoreScroll(boolean value)
true, this viewport will ignore any
scrolling that occurs until this method is called again with
false.value - whether this viewport should ignore future scrollspublic void setVerticalLocation(int value)
value - the new vertical locationpublic void setVerticalRangeModel(RangeModel rangeModel)
rangeModel - the new vertical RangeModelpublic void setViewLocation(int x,
int y)
x - The new x coordinate of the Viewport's view.y - The new y coordinate of the Viewport's view.public void setViewLocation(Point p)
p - The new location of the Viewport's view.public void translateFromParent(Translatable t)
IFiguretranslateFromParent in interface IFiguretranslateFromParent in class Figuret - The object to translateIFigure.translateFromParent(Translatable)public void translateToParent(Translatable t)
IFiguretranslateToParent in interface IFiguretranslateToParent in class Figuret - The object to translateIFigure.translateToParent(Translatable)public boolean useGraphicsTranslate()
true if this viewport uses graphics translation.public void validate()
IFigurevalidate in interface IFigurevalidate in class FigureIFigure.validate()Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.