Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d
Class Viewport

java.lang.Object
  extended by

org.eclipse.draw2d.Figure
      extended by
org.eclipse.draw2d.Viewport
All Implemented Interfaces:
java.util.EventListener, IFigure, java.beans.PropertyChangeListener
Direct Known Subclasses:
FreeformViewport

public class Viewport
extends Figure
implements java.beans.PropertyChangeListener

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


Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d. Figure
Figure.FigureIterator, Figure.IdentitySearch
 
Nested classes inherited from class org.eclipse.draw2d. IFigure
IFigure.NoInsets
 
Field Summary
static java.lang.String PROPERTY_VIEW_LOCATION
          ID for the view location property
 
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 ()
          Constructs a new Viewport with the default values.
Viewport (boolean setting)
          Constructs a new Viewport.
 
Method Summary
  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.
 
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, getClientArea, 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, 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
 
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 final java.lang.String PROPERTY_VIEW_LOCATION
ID for the view location property

See Also:
Constant Field Values
Constructor Detail

Viewport

public Viewport()
Constructs a new Viewport with the default values.


Viewport

public Viewport(boolean setting)
Constructs a new Viewport. If setting is true, the viewport will use graphics translation to paint.

Parameters:
setting - whether to use graphics translation
Method Detail

getClientArea

public 
Rectangle getClientArea(
Rectangle rect)
Description copied from interface: IFigure
Copies the client area into the specificied Recangle, and returns that rectangle for convenience.

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

getContents

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

Returns:
the contents
Since:
2.0

getHorizontalRangeModel

public 
RangeModel getHorizontalRangeModel()
Returns the RangeModel associated with the horizontal motion of this Viewport

Returns:
the RangeModel
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(boolean) and passing in true.

Returns:
whether the contents tracks height
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(boolean) and passing in true.

Returns:
whether the contents tracks width
Since:
2.0

getVerticalRangeModel

public 
RangeModel getVerticalRangeModel()
Returns the range model associated with the vertical motion of the Viewport.

Returns:
the RangeModel
Since:
2.0

getViewLocation

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

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 area is typically defined as the anything inside the Figure's Border or Insets, and by default includes the children of this Figure. On return, this method must leave the given Graphics in its initial state.

Overrides:
paintClientArea in class Figure
Parameters:
g - The Graphics used to paint
See Also:
Figure.paintClientArea(Graphics)

isCoordinateSystem

public boolean isCoordinateSystem()
Description copied from interface: IFigure
Returns true if this figure is capable of applying a local coordinate system which affects its children.

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

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Listens for either of the RangeModels to fire a property change event and updates the view accordingly.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - the event

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 Viewport's height/width.

Since:
2.0

setContents

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

Parameters:
figure - the new contents
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.

Parameters:
track - whether this viewport should track its height
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.

Parameters:
track - whether this viewport should track its width
Since:
2.0

setHorizontalLocation

public 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

setHorizontalRangeModel

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

Parameters:
rangeModel - the new horizontal range model
Since:
2.0

setIgnoreScroll

public void setIgnoreScroll(boolean value)
If value is true, this viewport will ignore any scrolling that occurs until this method is called again with false.

Parameters:
value - whether this viewport should ignore future scrolls

setVerticalLocation

public 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

setVerticalRangeModel

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

Parameters:
rangeModel - the new vertical 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 IFigure's parent's coordinates to this IFigure's local coordinates.

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

translateToParent

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

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

useGraphicsTranslate

public boolean useGraphicsTranslate()
Returns true if this viewport uses graphics translation.

Returns:
whether this viewport uses graphics translation

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.

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

Eclipse Draw2d
3.3

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire