Automatic form generation method and system based on event agent
阅读说明:本技术 基于事件代理的表单自动生成方法和系统 (Automatic form generation method and system based on event agent ) 是由 徐晓笑 于 2019-10-15 设计创作,主要内容包括:本公开涉及一种基于事件代理的自动生成表单的方法系统。所述方法包括:读取表单配置模板,所述表单配置模板包括各表单元素以及绑定到相应表单元素的事件;解析所述表单配置模板以将其拆分成表单元素和绑定到表单元素的事件;确定所述表单元素的初始状态;以及基于所确定的表单元素的初始状态来自动生成表单,其中所述表单包括处于其初始状态的表单元素。(The present disclosure relates to a method and a system for automatically generating a form based on an event agent. The method comprises the following steps: reading a form configuration template, the form configuration template including form elements and events bound to the corresponding form elements; parsing the form configuration template to split it into form elements and events bound to form elements; determining an initial state of the episomal element; and automatically generating a form based on the determined initial state of the form element, wherein the form includes the form element in its initial state.)
1. A method for automatically generating a form based on an event agent comprises the following steps:
reading a form configuration template, the form configuration template including form elements and events bound to the corresponding form elements;
parsing the form configuration template to split it into form elements and events bound to form elements;
determining an initial state of the episomal element; and
automatically generating a form based on the determined initial state of the form element, wherein the form includes the form element in its initial state.
2. The method of claim 1, further comprising receiving user interaction with the generated form and updating the generated form accordingly.
3. The method of claim 2, further comprising:
identifying a table element to which the interaction is directed; and
the generated form is updated based on the events bound to the identified form elements.
4. The method of claim 3, further comprising:
triggering an event that binds to the identified form element;
updating a state of the form element based on the event; and
the generated form is updated based on the updated table element states.
5. The method of claim 3, wherein updating the state of the form element based on the event further comprises:
determining whether the event depends on an external database, and in the event that the event is determined to depend on an external database, communicating with the external database to obtain corresponding data to update the state of the form element.
6. The method of claim 3, wherein updating the state of the form element based on the event further comprises:
determining a life cycle of the event, and upon determining an end of life of the event, unbinding the event from the form element such that the form element no longer has the event.
7. The method of claim 2, wherein the interaction comprises one or more of: click on the form element, enter the content in the input field.
8. A system for automatically generating forms based on an event broker, comprising:
a parsing engine configured to:
reading a form configuration template, the form configuration template including form elements and events bound to the corresponding form elements; and
parsing the form configuration template to split it into form elements and events bound to form elements;
a form element manager configured to:
receiving the split form elements from the parsing engine;
determining an initial state of the episomal element; and
automatically generating a form based on the determined initial state of the form elements, the form including the form elements in their initial state; and
an event agent manager configured to:
receiving a split event bound to a form element from the parsing engine for processing when the event is triggered.
9. The system of claim 8, wherein the form element manager is further configured to receive user interactions with the generated form.
10. The system of claim 9, wherein the form element manager is further configured to identify a form element for which the interaction is directed, trigger an event bound to the identified form element, and communicate the event to the event broker manager.
11. The system of claim 10, wherein the event agent manager is further configured to update the state of the form element based on the event.
12. The system of claim 11, wherein the event agent manager is further configured to:
determining whether the event depends on an external database, and in the event that the event is determined to depend on an external database, communicating with the external database to obtain corresponding data to update the state of the form element.
13. The system of claim 11, wherein the event agent manager is further configured to:
determining a life cycle of the event, and upon determining an end of life of the event, unbinding the event from the form element such that the form element no longer has the event.
14. The system of claim 11, wherein the event agent manager is further configured to communicate the updated state of the form element to the form element manager.
15. The system of claim 14, wherein the form element manager is further configured to update the generated form based on a state of the updated form element.
16. The system of claim 8, wherein the interaction comprises one or more of: click on the form element, enter the content in the input field.
17. A computer-readable medium having stored thereon computer-executable instructions that, when executed by a computer, cause the computer to perform the method of any of claims 1 to 7.
Technical Field
The disclosure relates to a method and a system for automatic generation of a form based on an event agent.
Background
In an enterprise-level middle background system, development of a large number of form pages is typically required to be completed in a short time. The form generally involves form data write-back, linkage between form elements, various complex verifications of the form elements, and user prompts after the verification, so the interaction is often complex. Developers often need to waste a lot of time developing a form page.
Therefore, a method for generating a complete form function simply and quickly is urgently needed to improve the generation and development efficiency of the form.
Disclosure of Invention
In order to improve the development efficiency of forms and unify the interaction of the forms, the invention provides a method and a system for automatically generating the forms based on event agents.
According to a first aspect of the present disclosure, there is provided a method for automatically generating a form based on an event broker, including: reading a form configuration template, the form configuration template including form elements and events bound to the corresponding form elements; parsing the form configuration template to split it into form elements and events bound to form elements; determining an initial state of the episomal element; and automatically generating a form based on the determined initial state of the form element, wherein the form includes the form element in its initial state.
In an embodiment, the method further comprises receiving user interaction with the generated form and updating the generated form accordingly.
In another embodiment, the method further comprises identifying a form element for which the interaction is directed; and updating the generated form based on the event bound to the identified form element.
In yet another embodiment, the method further comprises triggering an event that binds to the identified form element; updating a state of the form element based on the event; and updating the generated form based on the updated table element state.
In yet another embodiment, updating the state of the form element based on the event further includes determining whether the event is dependent on an external database, and in the event that the event is determined to be dependent on an external database, communicating with the external database to obtain corresponding data to update the state of the form element.
In yet another embodiment, updating the state of the form element based on the event further includes determining a life cycle of the event and unbinding the event from the form element upon determining the end of life of the event such that the form element no longer has the event.
In yet another embodiment, the interaction comprises one or more of: click on the form element, enter the content in the input field.
According to a second aspect of the present disclosure, there is provided a system for automatically generating a form based on an event broker, comprising: a parsing engine configured to: reading a form configuration template, the form configuration template including form elements and events bound to the corresponding form elements; and parsing the form configuration template to split it into form elements and events bound to form elements; a form element manager configured to: receiving the split form elements from the parsing engine; determining an initial state of the episomal element; and automatically generating a form based on the determined initial state of the form element, the form including the form element in its initial state; and an event agent manager configured to: receiving a split event bound to a form element from the parsing engine for processing when the event is triggered.
In an embodiment, the form element manager is further configured to receive user interaction with the generated form.
In another embodiment, the form element manager is further configured to identify a form element for which the interaction is directed, trigger an event bound to the identified form element, and communicate the event to the event broker manager.
In yet another embodiment, the event broker manager is further configured to update the state of the form element based on the event.
In yet another embodiment, the event broker manager is further configured to determine whether the event depends on an external database, and in the event that the event is determined to depend on an external database, communicate with the external database to retrieve corresponding data to update the state of the form element.
In yet another embodiment, the event broker manager is further configured to determine a lifecycle of the event, and upon determining an end-of-life of the event, unbind the event from the form element such that the form element no longer has the event.
In yet another embodiment, the event broker manager is further configured to communicate the updated state of the form element to the form element manager.
In yet another embodiment, the form element manager is further configured to update the generated form based on the state of the updated form element.
In yet another embodiment, the interaction comprises one or more of: click on the form element, enter the content in the input field.
According to a third aspect of the present disclosure, there is provided a computer-readable medium having stored thereon computer-executable instructions which, when executed by a computer, cause the computer to perform the method as described according to the first aspect of the present disclosure.
Aspects generally include methods, apparatus, systems, computer program products, and processing systems substantially as described herein with reference to and as illustrated by the accompanying drawings.
The foregoing has outlined rather broadly the features and technical advantages of an example in accordance with the present disclosure in order that the detailed description that follows may be better understood. Additional features and advantages will be described hereinafter. The conception and specific examples disclosed may be readily utilized as a basis for modifying or designing other structures for carrying out the same purposes of the present disclosure. Such equivalent constructions do not depart from the scope of the appended claims. The features of the concepts disclosed herein, both as to their organization and method of operation, together with associated advantages, will be better understood from the following description when considered in connection with the accompanying figures. Each of the figures is provided for the purposes of illustration and description and does not define the limits of the claims.
Drawings
So that the manner in which the above recited features of the present disclosure can be understood in detail, a more particular description of the disclosure, briefly summarized above, may be had by reference to aspects, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only certain typical aspects of this disclosure and are therefore not to be considered limiting of its scope, for the description may admit to other equally effective aspects. The same reference numbers in different drawings may identify the same or similar elements.
FIG. 1 is a flow diagram of an example method of automatic generation of a form based on an event agent according to an embodiment of the present disclosure;
FIG. 2 is a block diagram of an example form automatic generation system based on an event agent, according to an embodiment of the present disclosure;
FIG. 3 illustrates an example of a form to be generated in accordance with an embodiment of the present disclosure;
FIG. 4 illustrates an example configuration template corresponding to the example form of FIG. 3, according to an embodiment of the present disclosure; and
FIG. 5 is a schematic block diagram of an example form automatic generation system based on event brokers in accordance with an embodiment of the present disclosure.
Detailed Description
The detailed description set forth below in connection with the appended drawings is intended as a description of various configurations and is not intended to represent the only configurations in which the concepts described herein may be practiced. The detailed description includes specific details to provide a thorough understanding of the various concepts. It will be apparent, however, to one skilled in the art that these concepts may be practiced without these specific details.
In the existing form design and generation process, for a common form, a developer needs to collect corresponding form elements according to UI design and write the attributes and layout of the collected form elements by using API. The developer then decorates the form elements using the form function method and then binds the form validation, submission methods. Thereafter, the form generation system receives the form elements written by the developer and their layout and decoration, makes a verification and generates the form.
For the linkage form, a developer needs to bind the correlation relationship of the related form elements, obtain element data through communication with a back end, and manually update the form element data. The form generation system then receives the form elements written by the developer along with their layout and decorations, makes a verification and generates the form.
Therefore, in the conventional form design and generation method, the API design is complex, and the development of a developer is difficult. In addition, a large amount of attribute-related and layout codes still need to be written in a common form, a method for automatically generating the form based on a certain grammar rule is not available, a large amount of codes are wasted, and the development efficiency is low. As for the linkage form, because a set of uniform interaction mode is not abstracted, the linkage relation among data interaction and form elements at the rear end and manual processing is needed, so that the development cost is increased, and code redundancy is caused.
Referring initially to FIG. 1, a flow diagram of an
As shown in FIG. 1, at
At
At
At
In an embodiment, the
In another embodiment,
In yet another embodiment, the
In this embodiment, updating the state of a tableelement based on an event may further comprise: determining whether the event depends on an external database, and in the event that the event is determined to depend on the external database, communicating with the external database to obtain corresponding data to update the state of the form element. For example, where an event requires external data support, the
In this embodiment, updating the state of a tableelement based on an event may further comprise: the life cycle of an event is determined, and upon determining the end of life of an event, the event is unbound from the form element such that the form element no longer has the event. For example, the
Referring now to FIG. 2, shown is a block diagram of an example automatic
As shown in FIG. 2, the
The cooperation of the components of
An example of a form to be generated is shown in solid bold lines in fig. 3. In this example, the layout of the form elements is defaulted to horizontal (i.e., horizontal). An example form configuration template for such a form is shown in FIG. 4.
Referring back to FIG. 2, the parsing
Subsequently, the parsing
Subsequently, parsing
In turn,
In an alternative embodiment, the
In this embodiment, the
As will be appreciated by those skilled in the art, in the event that a form element is not available for interaction with a user (e.g., no binding event), then the user's interaction with the form element will not cause a change to the form. For example, in connection with FIG. 3, if the user clicks on the text portion "
In a further embodiment, the
In yet another embodiment, the
In yet another embodiment, the
As described above, the method and system of the present disclosure make API design simple and easy to handle; and unified rule convention configuration is used, so that development cost is reduced, and code redundancy is reduced. According to the method, the API design is simplified through the state of the abstract form, the event agent manager and the form element manager are introduced to split and decouple the event and the form element, and the complex interaction logic is abstracted into a fixed mode through the association of the form of the event agent, so that the code development of a user is reduced, and the production efficiency is improved.
FIG. 5 is a schematic block diagram of an example form automatic generation system 500 based on an event agent in accordance with an embodiment of the present disclosure. As shown, the example form automatic generation system 500 based on an event agent includes a
The foregoing detailed description includes references to the accompanying drawings, which form a part hereof. The drawings illustrate by way of illustration specific embodiments that can be practiced. These embodiments are also referred to herein as "examples". Such examples may include elements other than those illustrated or described. However, examples including the elements shown or described are also contemplated. Moreover, it is contemplated to use the examples shown or described with any combination or permutation of those elements, or with reference to a particular example (or one or more aspects thereof) shown or described herein, or with reference to other examples (or one or more aspects thereof) shown or described herein.
In the appended claims, the terms "comprises," "comprising," and "includes" are open-ended, that is, a system, device, article, or process that includes elements in the claims other than those elements recited after such terms is considered to be within the scope of that claim. Furthermore, in the appended claims, the terms "first," "second," and "third," etc. are used merely as labels, and are not intended to indicate a numerical order of their objects.
In addition, the order of operations illustrated in this specification is exemplary. In alternative embodiments, the operations may be performed in a different order than illustrated in the figures, and the operations may be combined into a single operation or split into additional operations.
The above description is intended to be illustrative, and not restrictive. For example, the above-described examples (or one or more aspects thereof) may be used in conjunction with other embodiments. Other embodiments may be used, such as by one of ordinary skill in the art, after reviewing the above description. The abstract allows the reader to quickly ascertain the nature of the technical disclosure. This Abstract is submitted with the understanding that it will not be used to interpret or limit the scope or meaning of the claims. Furthermore, in the foregoing detailed description, various features may be grouped together to streamline the disclosure. However, the claims may not recite every feature disclosed herein because embodiments may characterize a subset of the features. Moreover, embodiments may include fewer features than are disclosed in a particular example. Thus the following claims are hereby incorporated into the detailed description, with one claim standing on its own as a separate embodiment. The scope of the embodiments disclosed herein should be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.
- 上一篇:一种医用注射器针头装配设备
- 下一篇:一种工程建设项目业务申报制表方法