Class: Dialog

sync.api.Dialog

new Dialog()

A dialog window with custom content.
Source:

Classes

SizeChangedEvent

Members

(static) ButtonConfiguration :string

Button configurations for a dialog.
Type:
  • string
Properties:
Name Type Description
OK_CANCEL string An OK and a Cancel button. This is the default configuration.
OK string Only an OK button.
CANCEL string Only a cancel button
YES_NO string A Yes and a No buttons
Source:

(static) EventType :string

Event types generated by the dialog.
Type:
  • string
Properties:
Name Type Description
SIZE_CHANGED string Generated when the dialog size changed.
See sync.api.Dialog.SizeChangedEvent for more details.
Source:

Methods

dispose()

Disposes all the resources associated with the dialog, un-registers all the listeners and removes it from the DOM.
Source:

focus()

Focuses the dialog window.
Source:

getElement() → {HTMLElement}

Returns the HTML element that represents the content of the dialog window, So that custom content can be added to it.
Source:
Returns:
The element of the dialog.
Type
HTMLElement

getEventTarget() → {goog.events.EventTarget}

Getter for the dialog event target.
Source:
Returns:
Type
goog.events.EventTarget

hide()

Hides the dialog window.
Source:

isVisible()

Returns true if the dialog is visible.
Source:

onSelect(callback)

Sets the callback to be called when a button is pressed. It is called only once - the next time the dialog is shown, you will need to register an onSelect callback again.
Parameters:
Name Type Description
callback sync.api.Dialog~onSelectCallback the callback used when the user chooses an option on the dialog.
Source:

setButtonConfiguration(config)

Sets the button configuration of the dialog.
Parameters:
Name Type Description
config sync.api.Dialog.ButtonConfiguration The button configuration
Source:

setContentPreferredSize(width, height)

Sets the preferred size for this dialog content.
Parameters:
Name Type Description
width number The preferred width.
height number The preferred height.
Source:

setModal(modal)

Makes the dialog modal/non-modal. The dialog is modal by default.
Parameters:
Name Type Description
modal boolean true if the dialog should be made modal.
Source:

setPreferredSize(width, height)

Sets the preferred size for this dialog.
Parameters:
Name Type Description
width number The preferred width.
height number The preferred height.
Source:

setResizable(resizable)

Sets the resizable flag for this dialog.
Parameters:
Name Type Description
resizable boolean If true, this dialog should become resizable.
Source:

setTitle(title)

Sets the title of the dialog window.
Parameters:
Name Type Description
title string The title of the dialog window.
Source:

show()

Shows the dialog window.
Source:

Type Definitions

onSelectCallback(key, event)

A callback that receives the key of the button that was pressed, and the select event itself.
Parameters:
Name Type Description
key string The key of the selected button.
event goog.event.Event The select event, which you can preventDefault() in order to keep the dialog open.
Source: