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.
当显示JavaScript警报对话框时,将调用此方法。 |
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.
当用户选择type = color的HTML5输入元素时,将调用此方法。 |
CloseStatus |
onConfirmation(DialogParams params)
This method is invoked when JavaScript confirmation dialog should be displayed.
当显示JavaScript确认对话框时,将调用此方法。 |
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.
当显示JavaScript提示对话框时,将调用此方法。 |
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.
当尝试重新加载具有POST数据的网页时,将调用此方法,并且用户必须确认是否必须重新发送POST数据或必须取消重新加载。 |
CloseStatus |
onSelectCertificate(CertificatesDialogParams params)
This method is invoked when web server requires authorization via SSL client certificate.
当Web服务器需要通过SSL客户端证书进行授权时,将调用此方法。 |
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.
-使用它来获取有关SSL授权请求的信息,获取可用证书的列表,然后选择所需的证书。
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.
对话框成功关闭时或通过“取消”按钮关闭对话框时。