A method, system, device and storage medium for initializing controls in a page
By detecting and unbinding the circular dependency chain between controls, determining the root control and starting initialization from it, the problem of infinite loops and logic errors in control initialization in the prior art is solved, and the reliability and display effect of page initialization are improved.
Patent Information
- Application Number
- CN202210150935.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-02-18
AI Technical Summary
In the existing technology, when the control is initialized, the page falls into an infinite loop due to dependencies, thereby affecting the page display effect, and logical errors lead to initialization deviations.
By detecting and recording the cyclic dependency chain relationship between controls, performing an unbinding operation to obtain a non-cyclic dependency chain, and initializing controls sequentially starting from the root control to ensure the correctness of the initialization sequence.
It avoids the page initialization process from falling into an infinite loop, improves the reliability and logical correctness of page initialization, and ensures the correct final display of the page.
Smart Images

Figure CN114528047B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of control initialization, and in particular to a method, system, device and storage medium for initializing controls in a page. Background Art
[0002] Control initialization is an important step in rendering the page based on the configuration. The success or failure of control initialization directly affects the final display effect of the page. The core of the control initialization process is to process and analyze the initialization order of controls. The prior art mainly performs control initialization according to the loading order of controls. However, due to the dependency properties between controls, when the prior art performs control initialization according to the loading order of controls, there will be a risk of control initialization logic errors, which will lead to the risk of page initialization falling into an infinite loop. Summary of the invention
[0003] The purpose of the embodiments of the present invention is to provide a method, system, device and storage medium for initializing controls in a page, so as to improve the reliability of the page initialization process. The specific technical solution is as follows:
[0004] A method for initializing a control in a page, the method comprising:
[0005] Dependencies among controls in a page are determined, where the controls are visual graphic elements placed on a form.
[0006] Based on the dependency relationship, a circular dependency chain formed by controls having a circular dependency relationship is determined.
[0007] Perform unbinding operations on each circular dependency chain to obtain a non-circular dependency chain.
[0008] A root control is determined from the non-circular dependency chain, wherein the root control is a control that does not depend on other controls.
[0009] According to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located.
[0010] Optionally, determining the dependency relationship of controls in the page includes:
[0011] Traverse each control in the control set, and determine whether the attribute data of the target control matches the identifier of other controls according to the preset dependency detection rules. If so, determine that the target control depends on the other controls, and record the dependency relationship of the target control, wherein the target control is the control detected in the control set, the other controls are the controls in the control set except the target control, and the dependency relationship includes: the identifier of the target control and the identifier of at least one other control on which the target control depends.
[0012] Optionally, the determining, based on the dependency relationship, a circular dependency chain formed by controls having a circular dependency relationship includes:
[0013] According to the dependency relationship, the dependency chain of each control is determined.
[0014] For each dependency chain:
[0015] Any control in the dependency chain is used as the initial control. Starting from the initial control, each control is sequentially instantiated as the current control along the dependency chain until the current control is an already instantiated control or the current control does not have any controls that it depends on in the dependency chain.
[0016] If the current control is a control that has been instantiated, it is determined that the dependency chain is a circular dependency chain.
[0017] If the current control does not have any dependent control in the dependency chain, the dependency chain is determined to be an initialization execution chain.
[0018] Optionally, the instantiation operation includes:
[0019] The instance of the current control is searched from the preset first-level cache. If the instance cannot be found, the instance is searched from the preset second-level cache.
[0020] If the instance of the current control cannot be found in the preset secondary cache, the instance of the current control is generated according to the configuration data of the current control, and the instance is added to the preset secondary cache.
[0021] Optionally, the current control is a control that has been instantiated, specifically:
[0022] The preset secondary cache stores the control of the instance of the current control.
[0023] Optionally, an unbinding operation is performed on each circular dependency chain to obtain a non-circular dependency chain, including:
[0024] For each circular dependency chain:
[0025] When the current control is a control that has been instantiated, the control that depends on the current control in the circular dependency chain is searched in the order in which the instantiation operation is performed along the circular dependency chain.
[0026] For the control that depends on the current control, the identifier data of the current control in the dependent data set of the control is deleted, so that the control does not depend on the current control.
[0027] Optionally, the initializing each control in the page in sequence along the acyclic dependency chain where the root control is located, starting from the root control, according to the dependency relationship of each control in the acyclic dependency chain where the root control is located, includes:
[0028] For each control in each non-circular dependency chain: obtaining an identifier of the control. According to the identifier of the control, searching a corresponding control initialization method from a preset database, wherein there is a corresponding relationship between the control initialization method and the control.
[0029] For each non-circular dependency chain: starting from the root control, along the non-circular dependency chain, each control is initialized in turn using the control initialization method.
[0030] A system for initializing controls in a page, the system comprising:
[0031] The dependency identification module is used to determine the dependency relationship between various controls in the page, and the controls are visual graphic elements placed on the form.
[0032] The circular dependency processing module determines, based on the dependency relationship, a circular dependency chain formed by each control having a circular dependency relationship, and performs an unbinding operation on each circular dependency chain to obtain a non-circular dependency chain.
[0033] The initialization execution module is used to determine a root control from the acyclic dependency chain, wherein the root control is a control that does not depend on other controls. According to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located.
[0034] Optionally, the dependency identification module is configured to:
[0035] Traverse each control in the control set, and determine whether the attribute data of the target control matches the identifier of other controls according to the preset dependency detection rules. If so, determine that the target control depends on the other controls, and record the dependency relationship of the target control, wherein the target control is the control detected in the control set, the other controls are the controls in the control set except the target control, and the dependency relationship includes: the identifier of the target control and the identifier of at least one other control on which the target control depends.
[0036] Optionally, the circular dependency processing module is configured to:
[0037] According to the dependency relationship, the dependency chain of each control is determined.
[0038] For each dependency chain:
[0039] Any control in the dependency chain is used as the initial control. Starting from the initial control, each control is sequentially instantiated as the current control along the dependency chain until the current control is an already instantiated control or the current control does not have any controls that it depends on in the dependency chain.
[0040] If the current control is a control that has been instantiated, it is determined that the dependency chain is a circular dependency chain.
[0041] If the current control does not have any dependent control in the dependency chain, the dependency chain is determined to be an initialization execution chain.
[0042] Optionally, the circular dependency processing module is further configured to:
[0043] The instance of the current control is searched from the preset first-level cache. If the instance cannot be found, the instance is searched from the preset second-level cache.
[0044] If the instance of the current control cannot be found in the preset secondary cache, the instance of the current control is generated according to the configuration data of the current control, and the instance is added to the preset secondary cache.
[0045] Optionally, the circular dependency processing module is further configured to:
[0046] For each circular dependency chain:
[0047] When the current control is a control that has been instantiated, the control that depends on the current control in the circular dependency chain is searched in the order in which the instantiation operation is performed along the circular dependency chain.
[0048] For the control that depends on the current control, the identifier data of the current control in the dependent data set of the control is deleted, so that the control does not depend on the current control.
[0049] Optionally, the initialization execution module is configured to:
[0050] For each control in each non-circular dependency chain: obtaining an identifier of the control. According to the identifier of the control, searching a corresponding control initialization method from a preset database, wherein there is a corresponding relationship between the control initialization method and the control.
[0051] For each non-circular dependency chain: starting from the root control, along the non-circular dependency chain, each control is initialized in turn using the control initialization method.
[0052] The embodiments of the present invention provide a method, system, device and storage medium for initializing controls in a page. By adding the steps of detecting and recording the circular dependency chain relationship between controls and performing an unbinding operation on the circular dependency chain, each dependency chain participating in the page initialization process is a non-circular dependency chain, thereby avoiding the risk of the page initialization process falling into an infinite loop and improving the reliability of the page initialization process. At the same time, the present invention determines the initialization logic of each control in the page by determining the dependency relationship between the root control and the controls, thereby avoiding the risk of deviation in the page initialization process due to logical errors and improving the reliability of the page initialization process. It can be seen that the present invention achieves the invention purpose of improving the reliability of the page initialization process.
[0053] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A flowchart of a control initialization method provided by an embodiment of the present invention;
[0056] Figure 2 A schematic diagram of a circular dependency chain provided for an optional embodiment of the present invention;
[0057] Figure 3 A flowchart for determining a circular dependency chain is provided for an optional embodiment of the present invention;
[0058] Figure 4 A block diagram of a control initialization system provided by an embodiment of the present invention;
[0059] Figure 5 A block diagram of a control initialization device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0061] The embodiment of the present invention provides a method for initializing a control in a page, such as Figure 1 As shown, the method includes:
[0062] S101. Determine the dependency relationship between controls in a page, where a control is a visual graphic element placed on a form.
[0063] The above controls may be visual graphic elements placed on a form, such as buttons, dialog boxes, and file edit boxes on a page.
[0064] Optionally, in an optional embodiment of the present invention, the above dependency relationship means that the functional realization of a control needs to rely on the assistance of another control. The dependency relationship can be used as the basis for the execution order of the initialization of controls in the page. The existence form of the above dependency relationship can be a data set, and the data in the set includes but is not limited to: basic information of the control, basic information of the controls that the control depends on, and the type of dependency relationship. Among them, the type of the above dependency relationship includes but is not limited to: reference relationship of control values and input parameter dependency relationship required for initialization.
[0065] S102: Based on the dependency relationship, determine a circular dependency chain formed by controls having a circular dependency relationship.
[0066] Optionally, in an optional embodiment of the present invention, the above-mentioned circular dependency relationship may refer to a relationship of mutual dependence between two controls. Since in the process of initializing page controls, it is necessary to determine the initialization order of each control in the page according to the dependency relationship. In the process of initializing controls in the page, due to the existence of the above-mentioned circular dependency relationship among controls in the dependency chain, the initialization process of the page will be at risk of falling into an infinite loop. By adding the step of detecting and recording the circular dependency chain relationship between controls, the present invention reduces the risk of the page initialization process falling into an infinite loop and improves the reliability of the page initialization process compared to the prior art.
[0067] S103: Perform an unbinding operation on each circular dependency chain to obtain a non-circular dependency chain.
[0068] Optionally, in an optional embodiment of the present invention, the operation object of the above-mentioned unbinding operation can be a control in a circular dependency chain with a circular dependency relationship. Specifically, the above-mentioned unbinding operation is performed on the dependent data of the control with a circular dependency relationship, so that the circular dependency chain is converted into a non-circular dependency chain with only a one-way dependency relationship. By performing the unbinding operation on the circular dependency chain, the present invention makes each dependency chain participating in the page initialization process a non-circular dependency chain, thereby avoiding the risk of the page initialization process falling into an infinite loop and improving the reliability of the page initialization process.
[0069] Optionally, in another optional embodiment of the present invention, the acyclic dependency chain may be a dependency chain in which no cyclic dependency relationship exists between the controls in the dependency chain.
[0070] S104: Determine a root control from the non-circular dependency chain, wherein the root control is a control that does not depend on other controls.
[0071] Optionally, in an optional embodiment of the present invention, the root control may be determined from a non-circular dependency chain according to the dependency relationship.
[0072] S105 , according to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located.
[0073] Optionally, in an optional embodiment of the present invention, the present invention determines the root control, and according to the root control and the above-mentioned dependency relationship, determines the initialization logic of "starting from the root control, and performing initialization on each control in sequence along the non-circular dependency chain where the root control is located" for each control in the non-circular dependency chain. Since the prior art relies on the order in which the controls are loaded to initialize the controls in the page, it is inevitable that the display effect after the page is initialized will be deviated due to logical errors. Therefore, by determining the above-mentioned initialization logic, the present invention avoids the risk of deviation in the page initialization process due to logical errors, thereby improving the reliability of the page initialization process.
[0074] The present invention adds the steps of detecting and recording the circular dependency chain relationship between controls, and performs an unbinding operation on the circular dependency chain, so that each dependency chain participating in the page initialization process is a non-circular dependency chain, thereby avoiding the risk of the page initialization process falling into an infinite loop and improving the reliability of the page initialization process. At the same time, the present invention determines the initialization logic of each control in the page by determining the dependency relationship between the root control and the controls, thereby avoiding the risk of deviation in the page initialization process due to logic errors and improving the reliability of the page initialization process. It can be seen that the present invention achieves the invention purpose of improving the reliability of the page initialization process.
[0075] Optionally, the above-mentioned determination of dependencies among controls in the page includes:
[0076] Traverse each control in the control set, and determine whether the attribute data of the target control matches the identifier of other controls according to the preset dependency detection rules. If so, determine that the target control depends on the other controls, and record the dependency relationship of the target control, wherein the target control is the control detected in the control set, and the other controls are the controls in the control set except the target control, and the dependency relationship includes: the identifier of the target control and the identifier of at least one other control on which the target control depends.
[0077] Optionally, in an optional embodiment of the present invention, the data types in the above-mentioned attribute data include but are not limited to: an identifier that depends on the control, a reference relationship of the control storage value, and input parameters required to initialize the control, etc.
[0078] Optionally, in another optional embodiment of the present invention, the data in the above dependency relationship, in addition to the above "identifier of the target control and identifier of at least one other control that the target control depends on", may also include: basic information of the target control and data such as the type of dependency relationship. It should be noted that the above dependency relationship and the data types it contains are well known to those skilled in the art, and the present invention does not impose too many restrictions or redundant descriptions on this.
[0079] Optionally, in another optional embodiment of the present invention, the specific implementation of the above-mentioned "determining whether the attribute data of the target control matches the identifier of other controls" may be:
[0080] Assume that there are two controls, control A and control B, and the attribute data of control A stores the input parameter data for initializing the controls.
[0081] According to the identifier of control B, a preset word boundary matching algorithm is used to match the attribute data of control A. When the preset word boundary matching algorithm determines that the input parameter data in the attribute data of control A meets the matching rule with the identifier of control B, it is determined that control A depends on control B.
[0082] It should be noted that the above-mentioned implementation method of performing data matching verification using a preset word boundary matching algorithm is a technical means well known to those skilled in the art, and the present invention will not be elaborated in detail herein.
[0083] Optionally, based on the dependency relationship, determining a circular dependency chain formed by controls having a circular dependency relationship includes:
[0084] According to the dependency relationship, determine the dependency chain of each control.
[0085] For each dependency chain: any control in the dependency chain is used as the initial control. Starting from the initial control, each control along the dependency chain is instantiated as the current control in sequence until the current control is an already instantiated control or the current control does not have any dependent controls in the dependency chain.
[0086] If the current control is a control that has been instantiated, it is determined that the dependency chain is a circular dependency chain.
[0087] If the current control does not have any dependent control in the dependency chain, the dependency chain is determined to be an initialization execution chain.
[0088] Optionally, the instantiation operation includes:
[0089] Searches for an instance of the current control from the preset first-level cache. If not found, searches for an instance from the preset second-level cache.
[0090] If the instance of the current control cannot be found in the preset secondary cache, an instance of the current control is generated according to the configuration data of the current control, and the instance is added to the preset secondary cache.
[0091] Optionally, the current control is a control that has been instantiated:
[0092] The default secondary cache stores the control that has an instance of the current control.
[0093] In order to explain the above “determining the circular dependency chain formed by each control with a circular dependency relationship based on the dependency relationship”, hereby specifically combines the following Figure 2 and Figure 3 A specific embodiment of the present invention is shown for explanation:
[0094] For the convenience of description, it is assumed that Figure 2 The circular dependency chain shown in the figure. The circular dependency chain includes control 1, control 2 and control 3, all of which are represented by numbered circles. The dependency relationship between the controls is: control 1 depends on control 2, control 2 depends on control 3, and control 3 depends on control 1.
[0095] Determine control 1 as the initial control, as follows Figure 2 Starting from the dependency chain shown in the figure, each control is instantiated. Figure 3 As shown:
[0096] Step S301, searching for an instance of control 1 from a preset first-level cache, triggering step S302.
[0097] Step S302: If no instance of the control 1 is found in the preset first-level cache, an instance of the control 1 is created, which triggers step S303.
[0098] Step S303, adding the instance of control 1 to the preset secondary cache, triggering step S304.
[0099] Step S304, adding control 1 to the set to be initialized, triggering step S305.
[0100] Step S305, searching for an instance of control 2 from a preset first-level cache, triggering step S306.
[0101] Step S306: If no instance of control 2 is found in the preset first-level cache, an instance of control 2 is created, which triggers step S307.
[0102] Step S307, adding the instance of control 2 to the preset secondary cache, triggering step S308.
[0103] Step S308: Add control 2 to the set to be initialized, triggering step S309.
[0104] Step S309, searching for an instance of control 3 from the preset first-level cache, triggering step S310.
[0105] Step S310: If no instance of the control 3 is found in the preset first-level cache, an instance of the control 3 is created, which triggers step S311.
[0106] Step S311, adding the instance of control 3 to the preset secondary cache, triggering step S312.
[0107] Step S312, adding control 3 to the set to be initialized, triggering step S313.
[0108] Step S313, searching for an instance of control 1 from a preset first-level cache, triggering step S314.
[0109] Step S314: No instance of control 1 is found in the preset first-level cache, which triggers step S315.
[0110] Step S315, find the instance of control 1 from the preset secondary cache, and trigger step S316.
[0111] Optionally, in an optional embodiment of the present invention, after the above step S315, the identifier of the control 3 may be searched from the set to be initialized and recorded. The identifier of the control 3 may be used for the following unbinding operation of the circular dependency chain.
[0112] Step S316, completing instantiation, and determining the dependency chain as a circular dependency chain.
[0113] It should be noted that this embodiment is only intended to explain the process of determining the circular dependency chain. The technology of the instantiation operation is well known to those skilled in the art, and the present invention does not make too many limitations on this.
[0114] Optionally, an unbinding operation is performed on each circular dependency chain to obtain a non-circular dependency chain, including:
[0115] For each circular dependency chain:
[0116] When the current control is a control that has been instantiated, the control that depends on the current control in the circular dependency chain is searched in the order in which the instantiation operation is performed along the circular dependency chain.
[0117] For a control that depends on the current control, the identifier data of the current control in the dependent data set of the control is deleted so that the control does not depend on the current control.
[0118] Optionally, according to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located, including:
[0119] For each control in each non-circular dependency chain: obtaining an identifier of the control. According to the identifier of the control, searching for a corresponding control initialization method from a preset database, wherein there is a corresponding relationship between the control initialization method and the control.
[0120] For each non-circular dependency chain: starting from the root control, along the non-circular dependency chain, each control is initialized in turn using the control initialization method.
[0121] Optionally, in an optional embodiment of the present invention, the above-mentioned control initialization method can be stored in a preset database.
[0122] Corresponding to the above method embodiment, the present invention also provides an initialization system for controls in a page, such as Figure 4 As shown, the system includes:
[0123] The dependency identification module 401 is used to determine the dependency relationship between the controls in the page. The controls are visual graphic elements placed on the form.
[0124] The circular dependency processing module 402 determines, based on the dependency relationship, a circular dependency chain formed by each control having a circular dependency relationship, and performs an unbinding operation on each circular dependency chain to obtain a non-circular dependency chain.
[0125] Initialization execution module 403 is used to determine the root control from the acyclic dependency chain, wherein the root control is a control that does not depend on other controls. According to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located.
[0126] Optionally, the dependency identification module 401 is configured to:
[0127] Traverse each control in the control set, and determine whether the attribute data of the target control matches the identifier of other controls according to the preset dependency detection rules. If so, determine that the target control depends on the other controls, and record the dependency relationship of the target control, wherein the target control is the control detected in the control set, and the other controls are the controls in the control set except the target control, and the dependency relationship includes: the identifier of the target control and the identifier of at least one other control on which the target control depends.
[0128] Optionally, the circular dependency processing module 402 is configured to:
[0129] According to the dependency relationship, determine the dependency chain of each control.
[0130] For each dependency chain:
[0131] Any control in the dependency chain is used as the initial control. Starting from the initial control, each control along the dependency chain is instantiated as the current control in sequence until the current control is an already instantiated control or the current control does not have any dependent controls in the dependency chain.
[0132] If the current control is a control that has been instantiated, it is determined that the dependency chain is a circular dependency chain.
[0133] If the current control does not have any dependent control in the dependency chain, the dependency chain is determined to be an initialization execution chain.
[0134] Optionally, the circular dependency processing module 402 is further configured to:
[0135] Searches for an instance of the current control from the preset first-level cache. If not found, searches for an instance from the preset second-level cache.
[0136] If the instance of the current control cannot be found in the preset secondary cache, an instance of the current control is generated according to the configuration data of the current control, and the instance is added to the preset secondary cache.
[0137] Optionally, the circular dependency processing module 402 is further configured to:
[0138] For each circular dependency chain:
[0139] When the current control is a control that has been instantiated, the control that depends on the current control in the circular dependency chain is searched in the order in which the instantiation operation is performed along the circular dependency chain.
[0140] For a control that depends on the current control, the identifier data of the current control in the dependent data set of the control is deleted so that the control does not depend on the current control.
[0141] Optionally, the initialization execution module 403 is configured as:
[0142] For each control in each non-circular dependency chain: obtaining an identifier of the control. According to the identifier of the control, searching for a corresponding control initialization method from a preset database, wherein there is a corresponding relationship between the control initialization method and the control.
[0143] For each non-circular dependency chain: starting from the root control, along the non-circular dependency chain, each control is initialized in turn using the control initialization method.
[0144] The embodiment of the present invention provides a device for initializing controls in a page, such as Figure 5 As shown, the device includes:
[0145] Processor 501;
[0146] A memory 502 for storing instructions executable by the processor 601;
[0147] The processor 501 is configured to execute instructions to implement any of the above methods for initializing controls in a page.
[0148] An embodiment of the present invention provides a computer storage medium. When instructions in the computer-readable storage medium are executed by a processor of a device, the device can execute any of the above methods for initializing controls in a page.
[0149] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0150] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0151] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0152] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0153] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0154] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for initializing a control in a page, characterized in that: The method comprises: Determine the dependency relationship of each control in the page, wherein the control is a visual graphic element placed on the form; According to the dependency relationship, the dependency chain of each control is determined; for each dependency chain: any control in the dependency chain is used as the initial control; starting from the initial control, each control is sequentially instantiated as the current control along the dependency chain until the current control is an instantiated control or the current control does not have any control that it depends on in the dependency chain; if the current control is an instantiated control, the dependency chain is determined to be a circular dependency chain; if the current control does not have any control that it depends on in the dependency chain, the dependency chain is determined to be an initialization execution chain; For each of the circular dependency chains: when the current control is an instantiated control, search for controls in the circular dependency chain that depend on the current control in the order in which the instantiation operations are performed along the circular dependency chain; for the control that depends on the current control, delete the identifier data of the current control in the dependency data set of the control, so that the control does not depend on the current control, and obtain a non-circular dependency chain; Determine a root control from the non-circular dependency chain, wherein the root control is a control that does not depend on other controls; According to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located.
2. The method according to claim 1, characterized in that Determining the dependency relationship between controls in the page includes: Traverse each control in the control set, and determine whether the attribute data of the target control matches the identifiers of other controls according to the preset dependency detection rules. If so, determine that the target control depends on the other controls, and record the dependency relationship of the target control, wherein the target control is the control detected in the control set, the other controls are the controls in the control set other than the target control, and the dependency relationship includes: the identifier of the target control and the identifier of at least one other control on which the target control depends.
3. The method according to claim 1, characterized in that The instantiation operation includes: Searching for an instance of the current control from a preset first-level cache, and if the instance cannot be found, searching for the instance from a preset second-level cache; If the instance of the current control cannot be found in the preset secondary cache, the instance of the current control is generated according to the configuration data of the current control, and the instance is added to the preset secondary cache.
4. The method according to claim 3, characterized in that The current control is a control that has been instantiated, specifically: The preset secondary cache stores the control of the instance of the current control.
5. The method according to claim 1, characterized in that The initializing of each control in the page in sequence along the acyclic dependency chain where the root control is located, starting from the root control, according to the dependency relationship of each control in the acyclic dependency chain where the root control is located, includes: For each control in each non-circular dependency chain: obtaining an identifier of the control; searching a corresponding control initialization method from a preset database according to the identifier of the control, wherein there is a corresponding relationship between the control initialization method and the control; For each non-circular dependency chain: starting from the root control, along the non-circular dependency chain, each control is initialized in turn using the control initialization method.
6. A system for initializing controls in a page, characterized in that: The system comprises: A dependency identification module is used to determine the dependency relationship of each control in the page, wherein the control is a visual graphic element placed on the form; A circular dependency processing module is used to determine the dependency chain of each control according to the dependency relationship; for each dependency chain: any control in the dependency chain is used as the initial control; starting from the initial control, each control is sequentially instantiated as the current control along the dependency chain until the current control is a control that has been instantiated or the current control does not have any control that it depends on in the dependency chain; if the current control is a control that has been instantiated, the dependency chain is determined to be a circular dependency chain; if the current control does not have any control that it depends on in the dependency chain, the dependency chain is determined to be an initialization execution chain; for each of the circular dependency chains: when the current control is a control that has been instantiated, the control that depends on the current control in the circular dependency chain is searched in the order of executing the instantiation operation along the circular dependency chain; for the control that depends on the current control, the identifier data of the current control is deleted from the dependency data set of the control so that the control does not depend on the current control, and a non-circular dependency chain is obtained; An initialization execution module is used to determine a root control from the acyclic dependency chain, wherein the root control is a control that does not depend on other controls; according to the dependency relationship of each control in the acyclic dependency chain where the root control is located, starting from the root control, each control in the page is initialized in sequence along the acyclic dependency chain where the root control is located.
7. A device for initializing controls in a page, characterized in that: The device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for initializing controls in a page as claimed in any one of claims 1 to 5.
8. A computer storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a device for initializing controls in a page, the device for initializing controls in a page is enabled to execute the method for initializing controls in a page as claimed in any one of claims 1 to 5.
