Sequenceablepublic class ProviderFormInfo extends Object implements Sequenceable
Form provider to set form information such as the content to be displayed
on the remote form and the trigger events.
A form displays brief information about a Page ability on the UI of another application and provides basic interactive features.
The following two roles are involved in the presentation of a form depending on who provides or displays the content:
Form instances uniquely identified by their form ID. AbilitySlice objects. Only one client can
connect to the Form Manager Service on a single AbilitySlice. AbilitySlice to
lay out Form instances displayed on the ability slice. AbilitySlice#acquireForm(Intent, AbilitySlice.FormCallback) to send a request
to the Form Manager Service through the form framework to request the form to be displayed. Ability#onCreateForm(Intent) on the form provider to notify
the form provider to create a Form instance. When creating a Form instance, specify
the form name and grid style in an Intent object. You can also set attributes of components
and register a listener for click events. AbilitySlice.FormCallback#onAcquired(int, Form) on the client
to notify the client in an asynchronous way that the form display request has been processed. Form#getComponent() to obtain the root component of the form,
and uses the layout method provided in AbilitySlice to inflate the form content
to the layout of the client. The form provider provides the following functions:
AbilitySlice#acquireForm(Intent, AbilitySlice.FormCallback), the form framework then calls
Ability#onCreateForm(Intent) on the form provider to notify the provider to create a
Form instance. setJsBindingData(ohos.aafwk.ability.FormBindingData) to set the values of variables in
the JavaScript code for a JS form. ComponentProvider to set the layout and click events for a form,
and uses mergeActions(ohos.agp.components.ComponentProvider) to merge the specified actions to the created form. Ability#onUpdateForm(int) on the form provider
to notify the form provider to update a Form instance. The form provider then obtains
the latest form data and calls Ability#updateForm(int, FormBindingData) or
Ability#updateForm(int, ComponentProvider) to update a JS form or Java form, respectively. Ability#onDeleteForm(int) on the form provider
to notify the form provider to delete a Form instance. The form provider then deletes
the persistent form instance data. Ability#onTriggerFormEvent(int, String) on the form provider to notify the form provider that
a JS form event has been triggered. This callback must be overridden to perform operations after
the specified event is triggered. SystemCapability.Aafwk#ABILITYSequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static Sequenceable.Producer<ProviderFormInfo> |
PRODUCER |
Creates a
ProviderFormInfo object from a Parcel object. |
| 构造器 | 说明 |
|---|---|
ProviderFormInfo() |
A constructor used to create a
ProviderFormInfo instance for a JS form. |
ProviderFormInfo(int resId,
Context context) |
A constructor used to create a
ProviderFormInfo instance for a Java form. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static ProviderFormInfo |
createFromParcel(Parcel parcel) |
Creates a
ProviderFormInfo object from a specified Parcel object. |
ComponentProvider |
getComponentProvider() |
Obtains the
ComponentProvider data contained in this ProviderFormInfo object. |
FormBindingData |
getJsBindingData() |
Obtains the binding data of the JS form.
|
boolean |
isJsForm() |
Checks whether this form is a JS form.
|
boolean |
marshalling(Parcel out) |
Marshals this
ProviderFormInfo object into a Parcel object. |
void |
mergeActions(ComponentProvider componentProviderActions) |
Merges the actions specified in a
ComponentProvider into
the ComponentProvider object contained in this ProviderFormInfo object. |
void |
setJsBindingData(FormBindingData data) |
Sets binding data for the JS form in this
ProviderFormInfo object. |
boolean |
unmarshalling(Parcel in) |
Unmarshals this
ProviderFormInfo object from a Parcel object. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic static final Sequenceable.Producer<ProviderFormInfo> PRODUCER
ProviderFormInfo object from a Parcel object.
This constant is used together with marshalling(ohos.utils.Parcel) and is
the encapsulation of the unmarshalling(ohos.utils.Parcel) method.public ProviderFormInfo(int resId,
Context context)
ProviderFormInfo instance for a Java form.resId - Indicates the ID of the layout file used in the ProviderFormInfo instance.context - Indicates the ability context, which is used for initialization.public ProviderFormInfo()
ProviderFormInfo instance for a JS form.public static ProviderFormInfo createFromParcel(Parcel parcel)
ProviderFormInfo object from a specified Parcel object.
This method is used together with Parcel.writeSequenceable(Sequenceable) and
is the encapsulation of the Parcel.readSequenceable(Sequenceable) method.parcel - Indicates the Parcel object from which data of
the new ProviderFormInfo object is read.ProviderFormInfo object.Parcel.writeSequenceable(ohos.utils.Sequenceable)public ComponentProvider getComponentProvider()
ComponentProvider data contained in this ProviderFormInfo object.ComponentProvider object.public boolean marshalling(Parcel out)
ProviderFormInfo object into a Parcel object.marshalling 在接口中 Sequenceableout - Indicates the Parcel object for marshalling.true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
ProviderFormInfo object from a Parcel object.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object for unmarshalling.true if the unmarshalling is successful; returns false otherwise.public void mergeActions(ComponentProvider componentProviderActions)
ComponentProvider into
the ComponentProvider object contained in this ProviderFormInfo object.componentProviderActions - Indicates the ComponentProvider object containing the actions to merge.public FormBindingData getJsBindingData()
public void setJsBindingData(FormBindingData data)
ProviderFormInfo object.data - Indicates the binding data to set.public boolean isJsForm()
true if this form is a JS form; returns false otherwise.