public class DefaultDialogHandler extends java.lang.Object implements DialogHandler
DialogHandler
that will display an appropriate UI modal dialog for each method. All dialog texts are localized
with English language. If you need to support other languages or localize the dialogs, please
consider using your own implementation of the DialogHandler.Constructor and Description |
---|
DefaultDialogHandler(javax.swing.JComponent component) |
Modifier and Type | Method and Description |
---|---|
void |
onAlert(DialogParams params)
This method is invoked when JavaScript alert dialog should be displayed.
|
CloseStatus |
onBeforeUnload(UnloadDialogParams params)
This method is invoked before web page unload.
|
CloseStatus |
onColorChooser(ColorChooserParams params)
This method is invoked when user selects HTML5 input element with type=color.
|
CloseStatus |
onConfirmation(DialogParams params)
This method is invoked when JavaScript confirmation dialog should be displayed.
|
CloseStatus |
onFileChooser(FileChooserParams params)
This method is invoked when file selection is to be done.
|
CloseStatus |
onPrompt(PromptDialogParams params)
This method is invoked when JavaScript prompt dialog should be displayed.
|
CloseStatus |
onReloadPostData(ReloadPostDataParams params)
This method is invoked when attempt to reload a web page that has POST data and the user
must confirm whether POST data must be sent again or reload must be canceled.
|
CloseStatus |
onSelectCertificate(CertificatesDialogParams params)
This method is invoked when web server requires authorization via SSL client certificate.
|
public DefaultDialogHandler(javax.swing.JComponent component)
public void onAlert(DialogParams params)
DialogHandler
params
. Please note that it's not necessary to
display modal dialog in this method.
While this method is executed the Browser and JavaScript main threads will be blocked.
Right after this method returns, Browser and JavaScript main threads continue
their execution. It means that while this method is blocked, you cannot use any
Browser functionality and you will not receive any events from Browser component. If you
block this method forever, the whole Browser functionality will be blocked forever
as well.onAlert
in interface DialogHandler
params
- the alert dialog parameters.public CloseStatus onConfirmation(DialogParams params)
DialogHandler
params
. Please note that it's not necessary to
display modal dialog in this method.
While this method is executed the Browser and JavaScript main threads will be blocked.
Right after this method returns, Browser and JavaScript main threads continue
their execution. It means that while this method is blocked, you cannot use any
Browser functionality and you will not receive any events from Browser component. If you
block this method forever, the whole Browser functionality will be blocked forever
as well.onConfirmation
in interface DialogHandler
params
- the confirmation dialog parameters.CloseStatus.OK
when dialog was closed successfully or CloseStatus.CANCEL
when dialog was canceled.public CloseStatus onPrompt(PromptDialogParams params)
DialogHandler
params
.
Please note that it's not necessary to display modal dialog in this method.
The prompt dialog contains a text field with prompt text. User can input any text
in this text field. To provide the new prompt text back to JavaScript use the
PromptDialogParams.setPromptText(String)
method.
While this method is executed the Browser and JavaScript main threads will be blocked.
Right after this method returns, Browser and JavaScript main threads continue
their execution. It means that while this method is blocked, you cannot use any
Browser functionality and you will not receive any events from Browser component. If you
block this method forever, the whole Browser functionality will be blocked forever
as well.onPrompt
in interface DialogHandler
params
- the prompt dialog parameters such as dialog message and default prompt text.CloseStatus.OK
when dialog was closed successfully or CloseStatus.CANCEL
when dialog was canceled.public CloseStatus onFileChooser(FileChooserParams params)
DialogHandler
FileChooserParams.getMode()
method.
Please note that it's not necessary to display file chooser dialog in this method. You can
set the path to the selected file manually via FileChooserParams.setSelectedFiles(File...)
method.
To provide the selected file path use the FileChooserParams.setSelectedFiles(File...)
method.
While this method is executed the Browser main threads will be blocked. Right after this
method returns, Browser main threads continue their execution. It means that while this
method is blocked, you cannot use any Browser functionality and you will not receive any
events from Browser component. If you block this method forever, the whole Browser
functionality will be blocked forever as well.onFileChooser
in interface DialogHandler
params
- the file chooser dialog parameters such as dialog mode that you can get from
FileChooserParams.getMode()
.CloseStatus.OK
when dialog was closed successfully or CloseStatus.CANCEL
when dialog was closed via Cancel button.public CloseStatus onBeforeUnload(UnloadDialogParams params)
DialogHandler
window.onbeforeunload
JavaScript function, so that a confirmation dialog will
be shown every time when user try to reload web page or navigate to another web page.
You can use this method to display an appropriate confirmation message dialog to
ask user whether he or she really wants to leave or reload the web page. To find out
whether web page will be reloaded you can check the
UnloadDialogParams.isReload()
method.
While this method is executed the Browser main threads will be blocked. Right after
this method returns, Browser main threads continue their execution. It means that
while this method is blocked, you cannot use any Browser functionality and you will
not receive any events from Browser component. If you block this method forever,
the whole Browser functionality will be blocked forever as well.onBeforeUnload
in interface DialogHandler
params
- the unload dialog parameters such as dialog message and reload flag.CloseStatus.OK
when web page can be unloaded or CloseStatus.CANCEL
when unload operation must be canceled.public CloseStatus onSelectCertificate(CertificatesDialogParams params)
DialogHandler
CertificatesDialogParams.getCertificates()
method. To inform the web
server to use a specific client certificate use the CertificatesDialogParams.setSelectedCertificate(Certificate)
method. The Certificate
can be one of the certificates from the list, or you can
construct it from an existing X509Certificate
instance using the
corresponding constructor Certificate.Certificate(X509Certificate)
You can use this method to display a dialog with a list of available certificates that allows
end user to select the required certificate manually or cancel SSL authorization.onSelectCertificate
in interface DialogHandler
params
- use it to get information about SSL authorization request, get a list of
available certificates and select the required one.CloseStatus.OK
when certificate is selected or CloseStatus.CANCEL
when authorization must be canceled.public CloseStatus onReloadPostData(ReloadPostDataParams params)
DialogHandler
onReloadPostData
in interface DialogHandler
params
- the reload dialog parameters.CloseStatus.OK
when reloading is confirmed or CloseStatus.CANCEL
when
reloading must be canceled.public CloseStatus onColorChooser(ColorChooserParams params)
DialogHandler
onColorChooser
in interface DialogHandler
params
- the color chooser dialog params.CloseStatus.OK
when dialog was closed successfully or CloseStatus.CANCEL
when dialog was closed via Cancel button.