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
| Name | Type | Optional | Default | Descripton |
sCaption |
String |
![]() |
Optional caption text |
Properties
| Name | Type | get | set | Descripton |
centered |
Boolean |
![]() |
![]() |
This property decides whether to automatically center the dialog when it is shown |
defaultFocusedComponent |
|
![]() |
![]() |
This allows you to set the component that should be focused when the dialog
is shown. If null then the acceptButton is used for this. |
dialogResult |
Object |
![]() |
![]() |
The value set by the dialog before it is closed. the dialogResult should be set by the content of the dialog before it is closed |
Methods
| Name | Description |
centerDialog |
Centers the dialog window inside the application window |
Events
| Name | Type | Bubbles | Descripton |
dialogresult |
|
This 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
| Name | Description |
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. |
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. |
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. |
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. |
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
| Name | Type | Optional | Default | Descripton |
oMessage |
Object |
The text or BiComponent to show as a message
inside the dialog |
||
sCaption |
String |
![]() |
Select an Option |
The caption text to show on the dialog window |
sMessageType |
String |
![]() |
question |
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 |
sOptionType |
String |
![]() |
yesnocancel |
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 |
oImage |
|
![]() |
The image to show on the option pane. If left out then the image defined by the messageType is used. |
Return Type
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
| Name | Type | Optional | Default | Descripton |
oMessage |
Object |
The text or BiComponent to show
as a message inside the dialog |
||
sCaption |
String |
![]() |
Input |
The caption text to show on the dialog window |
sMessageType |
String |
![]() |
question |
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 |
oImage |
|
The image to show on the option pane. If left out then the image
defined by the messageType is used. |
||
sDefaultValue |
String |
The default text to show on the text field |
Return Type
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
| Name | Type | Optional | Default | Descripton |
oMessage |
Object |
The text or
BiComponent to
show as a message inside the dialog |
||
sCaption |
String |
![]() |
Message |
Optional caption text to show on the dialog window |
sMessageType |
String |
![]() |
information |
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 |
oImage |
|
![]() |
Optional image to show on the option pane. If
left out then the image defined by the
messageType is used. |
Return Type
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
| Name | Type | Optional | Default | Descripton |
oMessage |
Object |
The text or BiComponent to show
as a message inside the dialog |
||
sCaption |
String |
The caption text to show on the dialog window | ||
sMessageType |
String |
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 |
||
sOptionType |
String |
![]() |
Optional 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 |
|
oImage |
|
![]() |
Optional image to show on the option pane. If left out then the image
defined by the messageType is used. |
|
oOptions |
Object[] |
![]() |
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. |
|
oInitialValue |
Object |
![]() |
Optional 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
|
