Automatic form generation method and system based on event agent

文档序号:1505366 发布日期:2020-02-07 浏览:4次 中文

阅读说明:本技术 基于事件代理的表单自动生成方法和系统 (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 example method 100 for automatic generation of a form based on an event agent is shown, according to an embodiment of the present disclosure.

As shown in FIG. 1, at block 110, the method 100 may include reading a form configuration template. In one embodiment, the form configuration template includes form elements and events bound to the corresponding form elements. For example, the form developer gathers the corresponding form elements according to the UI design and writes the form configuration using the API. Subsequently, the form developer may bind the form events, i.e., bind the corresponding events on the corresponding form elements, to form a form configuration template.

At block 120, the method 100 may include parsing the form configuration template. For example, the form configuration template may be parsed to split into form elements and events bound to the form elements, such that a form may be generated based on the form elements and processed through an event broker for events (e.g., various clicks, entries, etc. events triggered by user interaction with the form elements) to update the form.

At block 130, the method 100 may include determining an initial state of an form element. In one example, the initial state of an form element is the state of the form element defined in the form configuration template, such as the size, color, font, orientation on the form, and the like of the form element.

At block 140, the method 100 may include automatically generating a form based on the determined initial state of the form element. In one embodiment, the generated form includes form elements in their initial state.

In an embodiment, the method 100 may also optionally include receiving user interaction with the generated form and updating the generated form accordingly. In this embodiment, the user may click on the form (e.g., right click on a mouse to bring up a command menu, click on a form element on the form, etc.), enter content in an input field (e.g., enter a username, password, etc.), to interact with the form. After receiving the user interaction, the method 100 may update the form according to the user interaction, e.g., display a user name entered by the user, and so on.

In another embodiment, method 100 may also optionally include 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 this embodiment, after receiving a user interaction, the method 100 may first determine a form element associated with the user interaction, such as an identifier identifying the form element to which the user interaction is directed. The method 100 may then trigger an event that is bound to the form element (in the case where the form element has a related event bound to it) based on the identifier of the form element, and then update the form based on the triggered event. 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.

In yet another embodiment, the method 100 may also optionally include 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 this embodiment, the method 100 may trigger an event that binds to an identified form element based on the identifier of the form element (in the event that the form element binds with a related event), update the form based on the triggered event, and then update the form based on the updated form element's state, e.g., display the form element in the updated form element state.

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 method 100 may take various means to obtain the external data to complete the event, such as communicating with an external database to obtain the required data.

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 method 100, after determining the triggered event, may determine the life cycle of the event. If the lifetime of the event is determined to be expired (e.g., if the event is determined to be a one-time event, its lifetime should expire after processing the event), the method 100 may unbind it from the corresponding table element. Subsequently, when the user interacts with the form element again, the event will not be triggered.

Referring now to FIG. 2, shown is a block diagram of an example automatic form generation system 200 based on event brokers in accordance with an embodiment of the present disclosure.

As shown in FIG. 2, the system 200 may include a parsing engine 202, a table element manager 204, and an event agent manager 206. In some embodiments, the parsing engine 202 may be configured to read the form configuration template and parse the form configuration template to split it into form elements and events bound to the form elements. In this embodiment, the form configuration template includes form elements and events bound to the corresponding form elements. The form element manager 204 may be configured to receive the split form elements from the parsing engine 202, determine an initial state of the form elements, and automatically generate a form based on the determined initial state of the form elements. In an example, the generated form includes form elements in their initial state. The event proxy manager 206 may be configured to receive the split event bound to a table element from the parsing engine 202 for processing when the event is triggered. As such, these components (e.g., parsing engine 202, form element manager 204, and event agent manager 206) may cooperate with one another to complete the automatic generation of the form.

The cooperation of the components of system 200 will be described below in conjunction with fig. 3-4 and in conjunction with JSON. JSON (i.e., JS Object Notation) is a lightweight data interaction format that stores and represents data in a text format completely independent of the programming language, is easy to read and write, and is also easy to machine parse and generate. However, it will be apparent to those skilled in the art that any other suitable language known in the art may be used.

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 engine 202 may be configured to read the form configuration template 214. By way of example, form configuration template 214 is shown in JSON format, but any other suitable format may be employed by one skilled in the art. In this embodiment, the form configuration template includes form elements and events bound to the corresponding form elements. For example, the form developer gathers the corresponding form elements according to the UI design and writes the form configuration using the API. Subsequently, the form developer may bind the form events, i.e., bind the corresponding events on the corresponding form elements, to form a form configuration template. For example, FIG. 4 illustrates an example form configuration template 400 according to an embodiment of the present disclosure.

Subsequently, the parsing engine 202 may also be configured to parse the form configuration template 214. For example, the form configuration template 214 may be parsed to split into form elements and events bound to the form elements, such that a form may be generated based on the form elements and processed through an event broker for events (e.g., various clicks, entries, etc. events triggered by user interaction with the form elements) for updating the form.

Subsequently, parsing engine 202 may be configured to transmit the parsed table elements and events to table element manager 204 and event agent manager 206, respectively, as shown in FIG. 2.

In turn, form element manager 204 may be configured to receive the split form elements from parsing engine 202 and determine initial states of the form elements, and automatically generate a form based on the determined initial states of the form elements. In one example, the initial state of a form element is the state of the form element defined in the form configuration template, such as the size, color, font, orientation and layout of the form element, and the like. In this example, the generated form includes form elements in their initial state. For example, the example form configuration template 400 shown in FIG. 4, after processing via the event agent-based automatic form generation system 200, may result in the example form shown in FIG. 3 (i.e., the form included by the solid bold solid line in FIG. 3).

In an alternative embodiment, the form element manager 204 is further configured to receive user interactions with the generated form. For example, as shown in FIG. 2, the form element manager 204 may receive user input. In an example, a user may click on a form (e.g., right click on a mouse to bring up a command menu, click on an form element on a form, etc.), enter content in an input field (e.g., enter a username, password, etc.), and make user input to interact with the form. In connection with FIG. 3, a user may enter content in any of input box 1, input box 2, input box 3, input box 4 to interact with a form, and form element manager 204 may receive this content entered by the user.

In this embodiment, the form element manager 204 may also be configured to identify form elements for which a user's interactions are directed, trigger events that are bound to the identified form elements, and communicate the events to the event broker manager 206. In this embodiment, upon receiving a user interaction (e.g., the user entered the content "zhang san" in input box 1 of fig. 3), form element manager 204 may be configured to determine a form element associated with the user interaction, such as an identifier identifying the form element to which the user interaction is directed (e.g., input box 1). Subsequently, the form element manager 204 may be configured to trigger an event that is bound to the form element based on the identifier of the form element and then update the form based on the triggered event (e.g., display the input "Zhang three" in input box 1 of FIG. 3).

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 "input Box 2" in the form, the form will not change because it is not available for user interaction. In this embodiment, after the user makes this interaction a predetermined number of times (e.g., two consecutive times, etc.), a prompt may pop-up to assist the user in interacting with the form. For example, a prompt "please click on the input field portion to input content" may pop up. In some embodiments, this prompt may last for a predetermined time and then automatically disappear; while in other embodiments, the prompt is shown in the form of a pop-up window and the user is required to close the pop-up window to cancel the prompt.

In a further embodiment, the event broker manager 206 is further configured to update the state of the form element based on an event received from the form element manager 204. For example, as shown in FIG. 2, the event agent manager 206 may include an event response manager 208, which may be configured to respond to triggered events. For example, continuing the above example in connection with fig. 3, event agent manager 206, upon determining that the user entered content (e.g., "zhang three") in input box 1, may update the state of the form element based on the event (e.g., with content "zhang three" in the input box), and subsequently event response manager 208 may update the generated form based on the updated form element state (e.g., display content "zhang three" within input box 1 in the form of fig. 3). For example, as shown in FIG. 2, after completing processing of the event from the table element manager 204, the event proxy manager 206 may return a table element state update to the table element manager 204.

In yet another embodiment, the event broker manager 206 may be further configured to determine whether the triggered event is dependent on an external database, and in the event that the event is determined to be dependent on the external database, communicate with the external database to obtain corresponding data to update the state of the form element. For example, as shown in FIG. 2, the event agent manager 206 may optionally include an event dependency manager 210 configured to determine the dependency of the triggered event, e.g., whether it depends on an external database. If the event dependency manager 210 determines that the triggered event depends on an external database, it may communicate with the external database to obtain the required data. Subsequently, the event dependency manager 210 may send the retrieved data to the event response manager 208 for response to the event.

In yet another embodiment, the event broker manager 206 may be 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. For example, referring to FIG. 2, the event agent manager 206 may also optionally include an event lifecycle manager 212 configured to determine a lifecycle of the event. For example, if the event lifecycle manager 212 determines that the event is a one-time event, its lifetime should end after processing the event. Subsequently, the event lifecycle manager 212 can unbind the event from the corresponding table element. Thereafter, when the user interacts again with the form element, the event will not be triggered.

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 processor 505 and a memory 510. Memory 510 stores computer-executable instructions that are executable by processor 505 to implement the methods and processes described above in connection with fig. 1-4.

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.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种工程建设项目业务申报制表方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!