Class RapidContext.Widget.Dialog

Extends: RapidContext.Widget

The dialog widget class. Used to provide a resizeable and moveable window within the current page. Internally it uses a number of <div> HTML elements.

Source code: RapidContext_Widget_Dialog.js

Class Summary
 
Creates a new dialog widget.
Method Summary
 
moveTo(x, y)
Moves the dialog to the specified position (relative to the parent DOM node).
 
Moves the dialog to the apparent center (relative to the parent DOM node).
 
Resets the scroll offsets for all child elements in the dialog.
 
resizeTo(width, height)
Resizes the dialog to the specified size (in pixels).
 
Resizes the dialog to the optimal size for the current content.
 
setAttrs(attrs)
Updates the dialog or HTML DOM node attributes.
Methods borrowed from class RapidContext.Widget:
addAll, addChildNode, addClass, animate, blurAll, destroy, disable, enable, getChildNodes, hasClass, hide, isDisabled, isHidden, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass, uid
Event Summary
 
Emitted when the dialog is hidden.
 
Emitted when the dialog is moved.
 
Emitted when the dialog is resized.
 
Emitted when the dialog is shown.
Class Detail
RapidContext.Widget.Dialog(attrs)
Creates a new dialog widget.
JavaScript:
var h1 = MochiKit.DOM.H1({}, "Hello, world!");
var attrs = { title: "Hello", modal: true };
var helloDialog = RapidContext.Widget.Dialog(attrs, h1);
RapidContext.Util.registerSizeConstraints(helloDialog, "200", "75");
User Interface XML:
<Dialog id="helloDialog" title="Hello" modal="true" w="200" h="75">
  <h1>Hello, world!</h1>
</Dialog>
Parameters:
{Object} attrs
the widget and node attributes
{String} attrs.title Optional
the dialog title, defaults to Dialog
{Boolean} attrs.modal Optional
the modal dialog flag, defaults to false
{Boolean} attrs.system Optional
the system dialog flag, implies modal, defaults to false
{Boolean} attrs.center Optional
the center dialog flag, defaults to true
{Boolean} attrs.closeable Optional
the closeable dialog flag, defaults to true
{Boolean} attrs.resizeable Optional
the resize dialog flag, defaults to true
{Boolean} attrs.hidden Optional
the hidden widget flag, defaults to true
{Object} ... Optional
the child widgets or DOM nodes
Returns:
{Widget} the widget DOM node
Method Detail
setAttrs(attrs)
Updates the dialog or HTML DOM node attributes.
Parameters:
{Object} attrs
the widget and node attributes to set
{String} attrs.title Optional
the dialog title
{Boolean} attrs.modal Optional
the modal dialog flag
{Boolean} attrs.system Optional
the system dialog flag, implies modal
{Boolean} attrs.center Optional
the center dialog flag
{Boolean} attrs.closeable Optional
the closeable dialog flag
{Boolean} attrs.resizeable Optional
the resize dialog flag
{Boolean} attrs.hidden Optional
the hidden widget flag

moveTo(x, y)
Moves the dialog to the specified position (relative to the parent DOM node). The position will be restrained by the parent DOM node size.
Parameters:
{Number} x
the horizontal position (in pixels)
{Number} y
the vertical position (in pixels)

moveToCenter()
Moves the dialog to the apparent center (relative to the parent DOM node). The vertical position actually uses the golden ratio instead of the geometric center for improved visual alignment.

{Dimensions} resizeTo(width, height)
Resizes the dialog to the specified size (in pixels). The size will be restrained by the parent DOM node size.
Parameters:
{Number} width
the width (in pixels)
{Number} height
the height (in pixels)
Returns:
{Dimensions} an object with w and h properties for the actual size used

{Dimensions} resizeToContent()
Resizes the dialog to the optimal size for the current content. Note that the size reported by the content may vary depending on if it has already been displayed, is absolutely positioned, etc. The size will be restrained by the parent DOM node size.
Returns:
{Dimensions} an object with w and h properties for the actual size used

resetScroll()
Resets the scroll offsets for all child elements in the dialog.
Event Detail
onshow()
Emitted when the dialog is shown. This event signal carries no event information.

onhide()
Emitted when the dialog is hidden. This event signal carries no event information.

onmove()
Emitted when the dialog is moved. The event will be sent repeatedly when moving with a mouse drag operation. This event signal contains the new element position as payload.

onresize()
Emitted when the dialog is resized. The event will be sent repeatedly when resizing with a mouse drag operation. This event signal contains the new element dimensions as payload.