IBM ILOG Dojo Diagrammer 1.1 API Documentation
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

ibm_ilog.diagram.widget.Viewport

Object » ibm_ilog.diagram.util.DeferredInitialization » ibm_ilog.diagram.widget.Viewport
dojo.require("ibm_ilog.diagram.widget.Viewport");

The Viewport class is an abstract class that provides basic infrastructure over which to construct concrete Diagram viewports. A Viewport object is a collaborator of the Diagram widget that abstracts this notion of viewport. The Diagram widget can then deal with the the viewport independently of how it is actually implemented. The main responsibility of the viewport object is to control the current viewable rectangle of the Diagram and report updates to it. The following concept definitions help understand the Viewport API: - Content Rectangle The area inside which the viewport can move, mostly based on the content bounding box. - View Rectangle The rectangular portion of the content that is currently visible in the viewport. - Client Size The size of the UI space that allows the contents to be viewed. authors: AV

Method Summary

Event Summary

Attached Objects

Methods

bringIntoView
translate the view just enough so that a given element is fully visible
ParameterTypeDescription
nodeibm_ilog.diagram.Node
marginNumber
Optional.
centerAt
Centers the viewport at the requested point, without changing the zoom.
ParameterTypeDescription
pPoint
options
clientToContent
returns a matrix that transforms a client coordinate into a content coordinate
contentToClient
returns a matrix that transforms a content coordinate into a client coordinate
destroy
Gracefully destroys the receiver
eventClientLocation
ParameterTypeDescription
e
eventContentLocation
ParameterTypeDescription
e
getAirFactor
Returns the content air percentage with respect to the client size
getAnimLength
getAnimSteps
getAnimated
getBackgroundShape
getClientSize
Returns the current viewport client size
getContent
getContentRect

This value is updated by content BB change notifications (see _onContentBoundingBoxChanged)

getDiagram
getEventSource
getEventSourceBackground
getHudLayer
getHudSize
getMaxZoom
Returns the current maximum zoom constraint.
getMinZoom
Returns the current minimum zoom constraint.
getOverlayLayer
getRefreshContentsInterval
getRefreshContentsSuspended
getResizeMode
getSurface
getUnderlayLayer
getViewRect
The currently displayed area in diagram coordinates.
getViewportInverseTransform
getViewportTransform
getZoom
Returns the current zoom level based on the current view rectangle and content size.
initialize
Constructs a Viewport for collaborating with the diagram.
ParameterTypeDescription
diagramibm_ilog.diagram.widget.DiagramThe diagram
isHudEnabled
isHudZoomFeedbackEnabled
isInitialized
Returns whether the initialization process is done.
pointClientToContent
transforms a client coordinate into a content coordinate
ParameterTypeDescription
pPoint
pointContentToClient
transforms a content coordinate into a client coordinate
ParameterTypeDescription
pPoint
prepareViewRect

Some corrections may be applied to r before assigning it as the current View Rectangle: - if width xor height are set, set the other based on current viewport aspect ratio - for each axis: - if origin is not defined and length is, make origin so that center is preserved - if origin is defined but width is not, keep current length - if both width and height are set but the aspect ratio is not correct, correct short side to match correct aspect ratio and maintain visibility of desired area. - if r goes beyond height or width, constrain location to make r within - if r lies before the origin, set location to origin - apply zoom constraints

ParameterTypeDescription
rdojox.gfx.Rectangle
viewRectdojox.gfx.Rectangle
refresh
Forces a refresh contents procedure, where the content rect is updated and consequently associated scrollbars and other features.
registerHudComponent
ParameterTypeDescription
component
reset
setAirFactor
Sets the content air percentage with respect to the client size
ParameterTypeDescription
factorNumber
setAnimLength
ParameterTypeDescription
millisecondsNumber
setAnimSteps
ParameterTypeDescription
stepsNumber
setAnimated
ParameterTypeDescription
animatedBoolean
setClientSize
Sets the Client Size
ParameterTypeDescription
szSize
setHudEnabled
ParameterTypeDescription
bBoolean
setHudZoomFeedbackEnabled
ParameterTypeDescription
bBoolean
setMaxZoom
Sets a maximum zoom and updates the view rectangle based on new constraints.
ParameterTypeDescription
zNumber
setMinZoom
Sets a minimum zoom and updates the view rectangle based on new constraints.
ParameterTypeDescription
zNumber
setRefreshContentsInverval
ParameterTypeDescription
msIntervalNumber
setRefreshContentsSuspended
ParameterTypeDescription
suspendedBoolean
setResizeMode
ParameterTypeDescription
mNumber
setSize
Sets the Viewport Size
ParameterTypeDescription
szSize
setViewRect

Some corrections are applied to r. See prepareViewRect.

ParameterTypeDescription
rdojox.gfx.Rectangle
optionsObj
Optional.
.animate animation of the viewport .instant cancel animated viewport .forceApply causes the view rect to be applied even if it has not changed .center causes the view rect to be centered
setZoom
This method is a helper that actually controls setSourceRect expanding or shrinking the view rectangle size to achieve the zoom effect.
ParameterTypeDescription
zoomNumber
options.animateanimation of the viewport .instant cancel animated viewport .forceApply causes the view rect to be applied even if it has not changed
stopAnimation
templateString
This method is must return the template that the Diagram widget must use in order to use the receiver as viewport. diagram: ibm_ilog.diagram.widget.Diagram The diagram
toString
visualizeArea
Makes the r rectangle visible, givin it an extra air between the area and the borders of the viewport if possible. The view may be zoomed out if required, but it is never zoomed in.
ParameterTypeDescription
rdojox.gfx.RectangleThe area to make visible. airFactor: Percent of the area that is reserved as air. Overrides the default air factor defined bu the member _focusAirFactor.
options{expandCurrent,airFactor}
whenLoaded
Registers a callback to be executed after the instance has been initialized, or executes immediately if already initialized.
ParameterTypeDescription
cb
eb
zoomAt
Scales the current zooms by a given factor z, using point p as pivot.
ParameterTypeDescription
pPoint
zNumber
options

Events

onClientSizeChanged
The viewport has been resized (implies the related onSourceChanged event)
onContentRectChanged
Event triggered when the content rect has changed.
onLayoutHud
onViewRectChanged
The view rectangle has been updated. scrollbars may have reappeared/disappeared