BiDialog

This class is used for dialog windows. Dialog windows are internal windows that require immediate attention. Dialog windows are modal to the application.

Example usage:

var confirm = new BiDialog("Are you sure");
// add components to the dialog
confirm.addEventListener("dialogresult", this.doSomething, this);
confirm.setVisible(true);

This class extends BiWindow and therefore all methods and fields available for BiWindow are also available for BiDialog .

Constructor

new BiDialog ( sCaption )

Parameters

NameTypeOptionalDefaultDescripton
sCaptionStringOptional caption text

Properties

NameTypegetsetDescripton
centeredBooleancheckedcheckedThis property decides whether to automatically center the dialog when it is shown
defaultFocusedComponentBiComponentcheckedcheckedThis allows you to set the component that should be focused when the dialog is shown. If null then, depending on the setting of the focusAcceptButton, either the acceptButton or the first focusable component is focused.
dialogResultObjectcheckedcheckedThe value set by the dialog before it is closed. the dialogResult should be set by the content of the dialog before it is closed
focusAcceptButtonBooleancheckedcheckedWhether to focus the accept button when the dialog is shown. If false the first focusable component is focused instead. If defaultFocusedComponent has been set this property is disregarded. Defaults to true.

Methods

NameDescription
centerDialogCenters the dialog window inside the application window

Events

NameTypeBubblesDescripton
dialogresultBiEventThis event is called when the dialog is closed (or hidden). This is the main event to use with dialogs since it is fired when the user closes it or selects a value in it.

Static Methods

NameDescription
createConfirmDialogCreates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to ask the user to confirm something. The buttons shown are set by the optionType.

The dialogResult for the dialog reflects the button clicked. The values are:

ok - The "OK" button was clicked
cancel - The "Cancel" button was clicked
yes - The "Yes" button was clicked
no - The "No" button was clicked

This method uses the static method provided by the BiOptionPane class.
createInputDialogCreates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to allow the user to enter a text value. The default text value can be provided using the sDefaultValue argument. The buttons provided for these dialogs are always an "OK" and a "Cancel" button.

The dialogResult for the dialog reflects whether the user entered any value and pressed "OK" or pressed "Cancel". The value is null when the user canceled the dialog, otherwise the entered string value is used.

This method uses the static method provided by the BiOptionPane class.
createMessageDialogCreates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to show a simple message. The iamge can either be set using the option type or by setting using the image argument.

The dialogResult for the dialog reflects the button clicked. The values are:

ok - The "OK" button was clicked
cancel - The "Cancel" button was clicked
yes - The "Yes" button was clicked
no - The "No" button was clicked

This method uses the static method provided by the BiOptionPane class.
createOptionDialogCreates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to show custom option buttons that the user can select between. The options argument should be used to define the buttons to use.

The dialogResult for the dialog reflects the button clicked. The value will be the object that the clicked button was created from.

This method uses the static method provided by the BiOptionPane class.

Static Fields

None.

Remarks

When the dialog is closed it is also disposed and can therefore not be used any more. To be able to reuse the dialog catch the beforeclose event and prevent the default action.

Method Details

centerDialog

Centers the dialog window inside the application window

Syntax

object.centerDialog ( )

Parameters

No arguments.

Return Type

void

Static Method Details

createConfirmDialog

Creates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to ask the user to confirm something. The buttons shown are set by the optionType.

The dialogResult for the dialog reflects the button clicked. The values are:

ok - The "OK" button was clicked
cancel - The "Cancel" button was clicked
yes - The "Yes" button was clicked
no - The "No" button was clicked

This method uses the static method provided by the BiOptionPane class.

Syntax

BiDialog . createConfirmDialog ( oMessage [ ,sCaption [ ,sMessageType [ ,sOptionType [ ,oImage ] ] ] ] )

Parameters

NameTypeOptionalDefaultDescripton
oMessageObjectThe text or BiComponent to show as a message inside the dialog
sCaptionStringcheckedSelect an Option The caption text to show on the dialog window
sMessageTypeStringcheckedquestion The type of the message that is shown. This sets the image on the option pane if no other image is provided. Valid values are:

plain - No image
error - Shows a stop (x) image
information - Shows an image with an 'i' on
warning - Shows an image with an exclamation mark on
question - Show a question mark image
sOptionTypeStringcheckedyesnocancel The option type describes what buttons to show on the optinon pane. This is ignored if the options are set. Valid values are:

default - Usually shows an "OK" button
yesno - Shows a "Yes" and a "No" button
yesnocancel - Shows three buttons with the text "Yes", "No" and "Cancel"
okcancel - Shows a "OK" and a "Cancel" button
oImageBiImagecheckedThe image to show on the option pane. If left out then the image defined by the messageType is used.

Return Type

BiDialog

createInputDialog

Creates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to allow the user to enter a text value. The default text value can be provided using the sDefaultValue argument. The buttons provided for these dialogs are always an "OK" and a "Cancel" button.

The dialogResult for the dialog reflects whether the user entered any value and pressed "OK" or pressed "Cancel". The value is null when the user canceled the dialog, otherwise the entered string value is used.

This method uses the static method provided by the BiOptionPane class.

Syntax

BiDialog . createInputDialog ( oMessage [ ,sCaption [ ,sMessageType,oImage,sDefaultValue ] ] )

Parameters

NameTypeOptionalDefaultDescripton
oMessageObjectThe text or BiComponent to show as a message inside the dialog
sCaptionStringcheckedInput The caption text to show on the dialog window
sMessageTypeStringcheckedquestion The type of the message that is shown. This sets the image on the option pane if no other image is provided. Valid values are:

plain - No image
error - Shows a stop (x) image
information - Shows an image with an 'i' on
warning - Shows an image with an exclamation mark on
question - Show a question mark image
oImageBiImageThe image to show on the option pane. If left out then the image defined by the messageType is used.
sDefaultValueStringThe default text to show on the text field

Return Type

BiDialog

createMessageDialog

Creates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to show a simple message. The iamge can either be set using the option type or by setting using the image argument.

The dialogResult for the dialog reflects the button clicked. The values are:

ok - The "OK" button was clicked
cancel - The "Cancel" button was clicked
yes - The "Yes" button was clicked
no - The "No" button was clicked

This method uses the static method provided by the BiOptionPane class.

Syntax

BiDialog . createMessageDialog ( oMessage [ ,sCaption [ ,sMessageType,oImage ] ] )

Parameters

NameTypeOptionalDefaultDescripton
oMessageObjectThe text or BiComponent to show as a message inside the dialog
sCaptionStringcheckedMessage Optional caption text to show on the dialog window
sMessageTypeStringcheckedinformation The type of the message that is shown. This sets the image on the option pane if no other image is provided. Valid values are:

plain - No image
error - Shows a stop (x) image
information - Shows an image with an 'i' on
warning - Shows an image with an exclamation mark on
question - Show a question mark image
oImageBiImageOptional image to show on the option pane. If left out then the image defined by the messageType is used.

Return Type

BiDialog

createOptionDialog

Creates a new BiDialog with a option pane as the contentPane of the dialog window.

This dialog is used to show custom option buttons that the user can select between. The options argument should be used to define the buttons to use.

The dialogResult for the dialog reflects the button clicked. The value will be the object that the clicked button was created from.

This method uses the static method provided by the BiOptionPane class.

Syntax

BiDialog . createOptionDialog ( oMessage,sCaption,sMessageType,sOptionType,oImage,oOptions,oInitialValue )

Parameters

NameTypeOptionalDefaultDescripton
oMessageObjectThe text or BiComponent to show as a message inside the dialog
sCaptionStringThe caption text to show on the dialog window
sMessageTypeStringThe type of the message that is shown. This sets the image on the option pane if no other image is provided. Valid values are:

plain - No image
error - Shows a stop (x) image
information - Shows an image with an 'i' on
warning - Shows an image with an exclamation mark on
question - Show a question mark image
sOptionTypeStringOptional option type describes what buttons to show on the option pane. This is ignored if the options are set. Valid values are:

default - Usually shows an "OK" button
yesno - Shows a "Yes" and a "No" button
yesnocancel - Shows three buttons with the text "Yes", "No" and "Cancel"
okcancel - Shows a "OK" and a "Cancel" button
oImageBiImageOptional image to show on the option pane. If left out then the image defined by the messageType is used.
oOptionsObject[]Optional array describing what options/buttons to show on the option pane. This is an array of objects and if the object is a BiComponent then it is added as it is. If not, a new button is created where the text is taken by using the toString method on the object.
oInitialValueObjectOptional argument and can be used when oOptions is provided. This is used to define which of the options that should be treated as the default acceptButton

Return Type

BiDialog