ComponentDialog 类
- java.
lang. Object - com.
microsoft. bot. dialogs. Dialog - com.
microsoft. bot. dialogs. DialogContainer - com.
microsoft. bot. dialogs. ComponentDialog
- com.
- com.
- com.
public class ComponentDialog
extends DialogContainer
由 Dialog 其他对话组成的 。 组件对话具有内部 DialogSet 和 DialogContext ,后者提供对父对话隐藏的内部对话堆栈。
字段摘要
修饰符和类型 | 字段和描述 |
---|---|
static final java.lang.String |
PERSISTEDDIALOGSTATE
持久化对话状态的 ID。 |
构造函数摘要
构造函数 | 说明 |
---|---|
ComponentDialog(String dialogId) |
初始化 ComponentDialog 类的新实例。 |
方法摘要
修饰符和类型 | 方法和描述 |
---|---|
Component |
addDialog(Dialog dialog)
将新的 Dialog 添加到组件对话框,并返回更新的组件。 |
java.util.concurrent.CompletableFuture<Dialog |
beginDialog(DialogContext outerDc, Object options)
在启动对话并将其推送到父级的对话堆栈时调用。 |
java.util.concurrent.CompletableFuture<Dialog |
continueDialog(DialogContext outerDc)
当对话为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。 |
Dialog |
createChildContext(DialogContext dc)
创建内部 DialogContext 。 |
protected
java.util.concurrent.CompletableFuture<Dialog |
endComponent(DialogContext outerDc, Object result)
在其父级上下文中结束组件对话框。 |
java.util.concurrent.CompletableFuture<java.lang.Void> |
endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)
在对话结束时调用。 |
protected java.util.concurrent.CompletableFuture<java.lang.Void> |
ensureInitialized(DialogContext outerDc)
确保对话已初始化。 |
java.lang.String |
getInitialDialogId()
获取分配给初始对话框的 ID。 |
protected
java.util.concurrent.CompletableFuture<Dialog |
onBeginDialog(DialogContext innerDc, Object options)
在启动对话并将其推送到父级的对话堆栈时调用。 |
protected
java.util.concurrent.CompletableFuture<Dialog |
onContinueDialog(DialogContext innerDc)
当对话为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。 |
protected java.util.concurrent.CompletableFuture<java.lang.Void> |
onEndDialog(TurnContext context, DialogInstance instance, DialogReason reason)
在对话结束时调用。 |
protected java.util.concurrent.CompletableFuture<java.lang.Void> |
onInitialize(DialogContext dc)
初始化对话。 |
protected java.util.concurrent.CompletableFuture<java.lang.Void> |
onRepromptDialog(TurnContext turnContext, DialogInstance instance)
当对话框应重新提示用户输入时调用。 |
java.util.concurrent.CompletableFuture<java.lang.Void> |
repromptDialog(TurnContext turnContext, DialogInstance instance)
当对话框应重新提示用户输入时调用。 |
java.util.concurrent.CompletableFuture<Dialog |
resumeDialog(DialogContext outerDc, DialogReason reason, Object result)
当父级对话堆栈上的子对话完成此轮次时调用,并将控件返回到此对话组件。 |
void |
setInitialDialogId(String withInitialDialogId)
设置分配给初始对话的 ID。 |
方法继承自 Dialog
方法继承自 DialogContainer
方法继承自 java.lang.Object
字段详细信息
PERSISTEDDIALOGSTATE
public static final String PERSISTEDDIALOGSTATE
持久化对话状态的 ID。
构造函数详细信息
ComponentDialog
方法详细信息
addDialog
public ComponentDialog addDialog(Dialog dialog)
将新的 Dialog 添加到组件对话框,并返回更新的组件。
参数:
返回:
The added dialog's <xref uid="com.microsoft.bot.dialogs.Dialog.telemetryClient" data-throw-if-not-resolved="false" data-raw-source="Dialog#telemetryClient"></xref> is set to the
<xref uid="com.microsoft.bot.dialogs.DialogContainer.telemetryClient" data-throw-if-not-resolved="false" data-raw-source="DialogContainer#telemetryClient"></xref> of the component dialog.
beginDialog
public CompletableFuture
在启动对话并将其推送到父级的对话堆栈时调用。
替代:
ComponentDialog.beginDialog(DialogContext outerDc, Object options)参数:
返回:
If the task is successful, the result indicates whether the dialog is
still active after the turn has been processed by the dialog.
continueDialog
public CompletableFuture
当对话为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。
替代:
ComponentDialog.continueDialog(DialogContext outerDc)参数:
返回:
If the task is successful, the result indicates whether the dialog is
still active after the turn has been processed by the dialog. The
result may also contain a return value. If this method is *not*
overridden, the component dialog calls the
<xref uid="com.microsoft.bot.dialogs.DialogContext.continueDialog*" data-throw-if-not-resolved="false" data-raw-source="DialogContext#continueDialog(CancellationToken)"></xref> method on its
inner dialog context. If the inner dialog stack is empty, the
component dialog ends, and if a <xref uid="com.microsoft.bot.dialogs.DialogTurnResult.result" data-throw-if-not-resolved="false" data-raw-source="DialogTurnResult#result"></xref> is
available, the component dialog uses that as its return value.
createChildContext
public DialogContext createChildContext(DialogContext dc)
创建内部 DialogContext 。
替代:
ComponentDialog.createChildContext(DialogContext dc)参数:
返回:
endComponent
protected CompletableFuture
在其父级上下文中结束组件对话框。
参数:
返回:
If the task is successful, the result indicates that the dialog ended
after the turn was processed by the dialog. In general, the parent
context is the dialog or bot turn handler that started the dialog. If
the parent is a dialog, the stack calls the parent's
<xref uid="com.microsoft.bot.dialogs.Dialog.resumeDialog(com.microsoft.bot.dialogs.DialogContext,com.microsoft.bot.dialogs.DialogReason,java.lang.Object)" data-throw-if-not-resolved="false" data-raw-source="Dialog#resumeDialog(DialogContext, DialogReason, Object)"></xref>
method to return a result to the parent dialog. If the parent dialog
does not implement `ResumeDialog`, then the parent will end, too, and
the result is passed to the next parent context, if one exists. The
returned <xref uid="com.microsoft.bot.dialogs.DialogTurnResult" data-throw-if-not-resolved="false" data-raw-source="DialogTurnResult"></xref> contains the return value in its
<xref uid="com.microsoft.bot.dialogs.DialogTurnResult.result" data-throw-if-not-resolved="false" data-raw-source="DialogTurnResult#result"></xref> property.
endDialog
public CompletableFuture
在对话结束时调用。
替代:
ComponentDialog.endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)参数:
返回:
When this method is called from the parent dialog's context, the
component dialog cancels all of the dialogs on its inner dialog stack
before ending.
ensureInitialized
protected CompletableFuture
确保对话已初始化。
参数:
返回:
getInitialDialogId
public String getInitialDialogId()
获取分配给初始对话框的 ID。
返回:
onBeginDialog
protected CompletableFuture
在启动对话并将其推送到父级的对话堆栈时调用。
参数:
返回:
If the task is successful, the result indicates whether the dialog is
still active after the turn has been processed by the dialog. By
default, this calls the
<xref uid="com.microsoft.bot.dialogs.Dialog.beginDialog(com.microsoft.bot.dialogs.DialogContext,java.lang.Object)" data-throw-if-not-resolved="false" data-raw-source="Dialog#beginDialog(DialogContext, Object)"></xref> method of the
component dialog's initial dialog, as defined by
InitialDialogId . Override this method in a derived class to
implement interrupt logic.
onContinueDialog
protected CompletableFuture
当对话为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。
参数:
返回:
If the task is successful, the result indicates whether the dialog is
still active after the turn has been processed by the dialog. The
result may also contain a return value. By default, this calls the
currently active inner dialog's
<xref uid="com.microsoft.bot.dialogs.Dialog.continueDialog(com.microsoft.bot.dialogs.DialogContext)" data-throw-if-not-resolved="false" data-raw-source="Dialog#continueDialog(DialogContext)"></xref> method. Override this
method in a derived class to implement interrupt logic.
onEndDialog
protected CompletableFuture
在对话结束时调用。
参数:
返回:
Override this method in a derived class to implement any additional
logic that should happen at the component level, after all inner
dialogs have been canceled.
onInitialize
protected CompletableFuture
初始化对话。
参数:
返回:
onRepromptDialog
protected CompletableFuture
当对话框应重新提示用户输入时调用。
参数:
返回:
Override this method in a derived class to implement any additional
logic that should happen at the component level, after the re-prompt
operation completes for the inner dialog.
repromptDialog
public CompletableFuture
当对话框应重新提示用户输入时调用。
替代:
ComponentDialog.repromptDialog(TurnContext turnContext, DialogInstance instance)参数:
返回:
resumeDialog
public CompletableFuture
当父级对话堆栈上的子对话完成此轮次时调用,并将控件返回到此对话组件。
替代:
ComponentDialog.resumeDialog(DialogContext outerDc, DialogReason reason, Object result)参数:
返回:
If the task is successful, the result indicates whether this dialog
is still active after this dialog turn has been processed. Generally,
the child dialog was started with a call to
BeginDialog(DialogContext, Object) in the parent's context.
However, if the <xref uid="com.microsoft.bot.dialogs.DialogContext.replaceDialog(java.lang.String,java.lang.Object)" data-throw-if-not-resolved="false" data-raw-source="DialogContext#replaceDialog(String, Object)"></xref>
method is called, the logical child dialog may be different than the
original. If this method is *not* overridden, the dialog
automatically calls its RepromptDialog(TurnContext,
DialogInstance) when the user replies.
setInitialDialogId
public void setInitialDialogId(String withInitialDialogId)
设置分配给初始对话的 ID。
参数: