A method and system for replacing control type
By backing up control properties in user interface editing, obtaining indexes and generating new control nodes, the problems of cumbersome operations and inaccurate attribute settings in the existing technology are solved, and one-click replacement of control types and precise attribute synchronization is realized, which improves editing efficiency.
Patent Information
- Application Number
- CN202210523585.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-13
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-05-13
AI Technical Summary
When editing the user interface, the existing technology requires deleting the original control and dragging and dropping the new control again, resulting in cumbersome operations and error-prone, and the inability to accurately set the position and attributes.
By obtaining the control tree node, backing up the control properties, traversing the child nodes recursively, getting the index, generating a new control node, moving the child nodes and deleting the original control node, resetting the new control properties to complete the control type replacement.
One-click replacement of control types is realized, user interface editing efficiency is improved, the integrity of the original control hierarchical tree structure is maintained, and control properties are accurately synchronized.
Smart Images

Figure CN114895907B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of user interface editing, and in particular to a method and system for replacing a control type. Background Art
[0002] When editing the user interface, for different projects, it is sometimes necessary to replace the controls in the interface. Some need to replace the button of type A with the button of type B, and some need to change the edit box of the position into a drop-down box. The normal operation is to delete the original control first, then drag and drop the new control to the position, and then set the properties that have been set one by one. This operation is more cumbersome, and the position and properties may not be set accurately. If the control type of the position can be directly replaced, and then if there are the same properties, the property settings can be traversed directly, thus avoiding the cumbersome operation of adding and setting the properties after deletion, and only one-click operation is required, which will help improve the efficiency of replacing controls. The prior art mainly deletes the original control first, then drags and drops the new control to the position, and then sets the properties that have been set one by one. This operation is more cumbersome, and the position may not be set accurately, and the properties may be set incorrectly.
[0003] In addition, there is a patent in the prior art: Method and device for implementing control replacement during transcoding, with a Chinese patent publication number of CN103226475A. A method for implementing control replacement during transcoding includes the following steps: offline acquisition of a first control on a web page and a first content node manipulated by the first control; outputting the first content node to a template file in the form of pattern and xpath; loading the template file online; when the web page accessed by the user includes the pattern and xpath in the template file, identifying and marking the first control of the web page and the first content node manipulated by the first control; generating a second control by rewriting the script to replace the first control. The invention also proposes a device for implementing control replacement during transcoding. The invention replaces the controls and nodes in the original web page that use scripts but cannot work normally, so that users can browse these web pages normally when using mobile terminals, providing convenience for users. This patent is mainly aimed at the control replacement method during web page transcoding, identifying content nodes through online template files, and rewriting scripts to achieve control replacement.
[0004] The method of use of this patent is to replace controls by overwriting and adding the index of the control hierarchy tree node and traversing the property container, which is completely different. The objects and methods of use of this patent are mainly for web page transcoding, while this patent is mainly for replacing the control type of the existing interface. Summary of the invention
[0005] To overcome the above problems, the purpose of the present invention is to provide a method for replacing control types, which can convert the control types of controls at the same position on the user interface, thereby helping to improve the efficiency of user editing interfaces.
[0006] The present invention is implemented by the following scheme: a method for replacing a control type, the method comprising the following steps:
[0007] Step S1, select a control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control;
[0008] Step S2, traverse the properties of the current control and back up all the properties of the current control, wherein the properties include name, control type, area location and size;
[0009] Step S3, recursively traverse the control subnodes of the current control to obtain information of all control subnodes;
[0010] Step S4, obtaining the index of the current control in the parent control node according to the current control name;
[0011] Step S5: Generate a new control node based on the obtained parent control node index, and insert the new control node under the parent control node;
[0012] Step S6, move all control child nodes of the current control to the new control node, and then delete the current control node;
[0013] Step S7: reset the properties of the new control node to the previously backed-up control properties, thereby completing the space type replacement.
[0014] Furthermore, the step S1 is further specified as follows: when editing the interface, each interface has a corresponding control hierarchy tree, which is a multi-branch tree structure. The multi-branch tree structure includes all controls on the current interface and the corresponding control hierarchy. Each control in the interface scene has its own corresponding control tree node on the control hierarchy tree. Select an interface control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control.
[0015] Furthermore, the step S2 is further specified as follows: traverse the properties of the current control to obtain the name, control type, area position and size of the current control, which are the basic properties for generating the interface control; then save the basic properties and other properties except these basic properties in a property container as a backup.
[0016] Furthermore, the step S4 is further specified as follows: the control hierarchy tree is a multi-branch tree structure, each control node has a corresponding control index, and according to the current control name, all child controls of its parent control are traversed to obtain the index of the current control in its parent control node. Through the node index of the control, the specific position and hierarchical relationship of the control in its parent control can be obtained.
[0017] Furthermore, the step S5 is further specified as follows: after obtaining the index of the current control in the parent control node, a new control is regenerated at the index according to the name, control type, area position and size of the backed-up current control, the control type of the new control is set to the control type to be replaced, the new control name, area position and size are set to be consistent with the current control, and the control node corresponding to the new control is inserted under the parent control node of the current control.
[0018] Furthermore, the step S7 is further specified as follows: according to the control type of the new control, all properties of the corresponding control type are obtained and saved in a new property container; the property container of the control that was originally backed up is used as the old property container; then, the new property container and the old property container are traversed at the same time to obtain the property names of the same properties, and these same properties are placed in an identical property container; finally, the identical property container is traversed, and according to the property names of the same properties, the identical property values corresponding to the identical property names in the old property container are set for the new control, so that the properties after resetting the new control are the control properties that were originally backed up.
[0019] The present invention provides a system for replacing a control type, the system comprising a control acquisition module, a backup attribute module, a control subnode acquisition module, an index acquisition module, a new control generation module, a node movement module, and a replacement module;
[0020] The control acquisition module selects a control whose control type needs to be replaced and acquires a control tree node corresponding to the current control;
[0021] The backup attribute module traverses the attributes of the current control and backs up all the attributes of the current control, including the name, control type, area location and size;
[0022] The control subnode acquisition module recursively traverses the control subnodes of the current control to acquire information of all control subnodes;
[0023] The index acquisition module acquires the index of the current control in the parent control node according to the name of the current control;
[0024] The new control generation module generates a new control node based on the obtained parent control node index, and inserts the new control node under the parent control node;
[0025] The node moving module moves all control child nodes of the current control to the new control node, and then deletes the current control node;
[0026] The replacement module resets the properties of the new control node to the previously backed-up control properties, thereby completing the space type replacement.
[0027] Furthermore, the implementation method of obtaining the control module is further specified as follows: when editing the interface, each interface has a corresponding control hierarchy tree, which is a multi-branch tree structure. The multi-branch tree structure contains all the controls on the current interface and the corresponding control hierarchy. Each control in the interface scene has its own corresponding control tree node on the control hierarchy tree. Select an interface control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control.
[0028] Furthermore, the implementation method of the backup attribute module is further specified as follows: traverse the attributes of the current control to obtain the name, control type, area position and size of the current control, which are the basic attributes for generating interface controls; then save the basic attributes and other attributes except these basic attributes in an attribute container as a backup.
[0029] Furthermore, the implementation method of the index acquisition module is further specified as follows: the control hierarchy tree is a multi-branch tree structure, each control node has a corresponding control index, and according to the current control name, all child controls of its parent control are traversed to obtain the index of the current control in its parent control node. Through the node index of the control, the specific position and hierarchical relationship of the control in its parent control can be obtained.
[0030] Furthermore, the implementation method of the new control generation module is further specified as follows: after obtaining the index of the current control in the parent control node, a new control is regenerated at the index according to the name, control type, area position and size of the backed-up current control, the control type of the new control is set to the control type that needs to be replaced, the new control name, area position and size are set to be consistent with the current control, and the control node corresponding to the new control is inserted under the parent control node of the current control.
[0031] Furthermore, the implementation method of the replacement module is further specified as follows: according to the control type of the new control, all properties of the corresponding control type are obtained and saved in a new property container; the property container of the control that was originally backed up is used as the old property container; then, the new property container and the old property container are traversed at the same time to obtain the property names of the same properties, and these same properties are placed in an identical property container; finally, the identical property container is traversed, and according to the property names of the same properties, the identical property values corresponding to the identical property names in the old property container are set for the new control, so that the properties after resetting the new control are the control properties that were originally backed up.
[0032] The beneficial effects of the present invention are: 1. The control type of the control replaced by this patent does not change the control hierarchy tree structure of the original interface. Before and after the control type is replaced, the consistency of the original control hierarchy tree structure is maintained, and the original interface control hierarchy is not affected, and the modification is more independent. The commonly used method of replacing the control type requires deleting the original control and then adding the control of the new control type. All of them are added from the last node of the insertion hierarchy, which destroys the original control hierarchy tree structure. The commonly used method of replacing the control type does not have independence and affects the hierarchy structure of the original interface.
[0033] 2. The control type of the control replaced by this patent can inherit the attribute values of all the same attributes for the attributes of the original control type by traversing the attribute container, without having to set the attributes one by one later. The commonly used method of replacing the control type requires manual setting of the original attributes one by one after replacing the control type, and the position and size cannot be set very accurately. The present invention improves the accuracy of the synchronous control attributes. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a schematic flow chart of the working principle of the method of the present invention.
[0035] Figure 2 It is a schematic diagram of the structure of the control hierarchy tree in one embodiment of the present invention.
[0036] Figure 3 It is a functional block diagram of the system of the present invention. DETAILED DESCRIPTION
[0037] The present invention will be further described below in conjunction with the accompanying drawings.
[0038] See also Figure 1 As shown, a method for replacing a control type of the present invention comprises the following steps:
[0039] Step S1, select a control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control;
[0040] Step S2, traverse the properties of the current control and back up all the properties of the current control, wherein the properties include name, control type, area location and size;
[0041] Step S3, recursively traverse the control subnodes of the current control to obtain information of all control subnodes;
[0042] Step S4, obtaining the index of the current control in the parent control node according to the current control name;
[0043] Step S5: Generate a new control node based on the obtained parent control node index, and insert the new control node under the parent control node;
[0044] Step S6, move all control child nodes of the current control to the new control node, and then delete the current control node;
[0045] Step S7: reset the properties of the new control node to the previously backed-up control properties, thereby completing the space type replacement.
[0046] The present invention will be further described below in conjunction with a specific embodiment:
[0047] The present invention provides a method for replacing a control type, which mainly backs up the position, size and other property information of the original control in advance. According to the control hierarchy tree corresponding to the interface, after obtaining the index of the current control in its parent control and all the child nodes of the current control node, a new child control is created under its parent control, and the backed-up property information such as the position and size of the original control is set. Then, all the child nodes of the current control node are transferred to the newly created node, and then the original control is deleted to keep the nodes of the control hierarchy tree consistent. Finally, by traversing and comparing the properties, the properties of the replaced control are reset to the original control properties.
[0048] The specific implementation steps of this solution are:
[0049] 1. Select a control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control;
[0050] When editing an interface, each interface has its own control hierarchy tree (the control hierarchy tree is a multi-branch tree structure), which contains all the controls on the current interface and the corresponding control hierarchy (such as Figure 2 As shown in the figure). Each control in the interface scene has its own corresponding control tree node in the control hierarchy tree. Select an interface control whose control type needs to be replaced to obtain the control tree node corresponding to the current control.
[0051] 2. Traverse the properties of the current control and back up all the properties of the current control, including name, control type, area location and size;
[0052] Traverse the properties of the current control to obtain the name, control type, area position and size of the current control, which are the basic properties of the generated interface control. Then save these basic properties and other properties except these basic properties (other properties include image path, image background color, transparency, shadow color, rendering mode and other properties) in a property container as a backup. It is mainly necessary to determine the position and size information of the control through the basic properties, and then determine the specific control details based on other properties.
[0053] 3. Recursively traverse the control child nodes of the current control and obtain the information of all control child nodes;
[0054] After replacing the control type, the original control hierarchy tree structure cannot be affected. All child nodes of the original control need to remain consistent with the original. Therefore, it is necessary to recursively traverse all control child nodes of the current control to obtain all control child node information for subsequent control child node processing. Since the control hierarchy tree is a multi-branch tree structure, it can be achieved by using recursive traversal of the multi-branch tree.
[0055] 4. Get the index of the current control in the parent control node according to its name;
[0056] Because the control hierarchy tree is a multi-branch tree structure, each control node has its own control index. According to the current control name, traverse all child controls of its parent control and obtain the index of the current control in its parent control node. Through the control node index, you can get the specific position of the control in its parent control and the hierarchical relationship.
[0057] 5. Generate a new control node based on the obtained parent control node index, and insert the new control under the parent control node;
[0058] After obtaining the index of the current control in its parent control node, regenerate a new control at the index according to the name, type, and area position size of the current control backed up in step 1, set the control type of the new control to the control type to be replaced, set the new control name and area position size to be consistent with the current control, and insert the control node corresponding to the new control into the parent control node of the current control.
[0059] 6. Move all control child nodes of the current control node to the new control node, and then delete the current control node;
[0060] After generating the new control, move all control child nodes of the current control node to the new control node, and then delete the current control node to keep the control hierarchy tree nodes consistent.
[0061] 7. Reset the properties of the new control to the previously backed-up control properties;
[0062] Finally, according to the control type of the new control, all properties of the corresponding control type are obtained and saved in the new property container. The previously backed-up control property container is used as the old property container. Then, the two property containers are traversed at the same time to obtain the property names of the same properties and place these same properties in the same property container. Finally, the same property container is traversed, and according to the property names of the same properties, the same property values corresponding to the same property names in the old property container are set for the new control. In this way, the properties of the reset new control can be the control properties that were previously backed up.
[0063] See also Figure 2 As shown, the present invention provides a system for replacing a control type, the system comprising a control acquisition module, a backup attribute module, a control subnode acquisition module, an index acquisition module, a new control generation module, a node movement module, and a replacement module;
[0064] The control acquisition module selects a control whose control type needs to be replaced and acquires a control tree node corresponding to the current control;
[0065] The implementation method of obtaining the control module is further specified as follows: when editing the interface, each interface has a corresponding control hierarchy tree, which is a multi-branch tree structure. The multi-branch tree structure contains all the controls on the current interface and the corresponding control hierarchy. Each control in the interface scene has its own corresponding control tree node on the control hierarchy tree. Select an interface control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control.
[0066] The backup attribute module traverses the attributes of the current control and backs up all the attributes of the current control, including the name, control type, area location and size;
[0067] The implementation method of the backup attribute module is further specifically as follows: traverse the attributes of the current control to obtain the name, control type, area position and size of the current control, which are the basic attributes for generating interface controls; then save the basic attributes and other attributes except these basic attributes in an attribute container as a backup.
[0068] The control subnode acquisition module recursively traverses the control subnodes of the current control to acquire information of all control subnodes;
[0069] The index acquisition module acquires the index of the current control in the parent control node according to the name of the current control;
[0070] The implementation method of the index acquisition module is further specified as follows: the control hierarchy tree is a multi-branch tree structure, each control node has a corresponding control index, and according to the current control name, all child controls of its parent control are traversed to obtain the index of the current control in its parent control node. Through the node index of the control, the specific position and hierarchical relationship of the control in its parent control can be obtained.
[0071] The new control generation module generates a new control node based on the obtained parent control node index, and inserts the new control node under the parent control node;
[0072] The implementation method of the new control generation module is further specifically as follows: after obtaining the index of the current control in the parent control node, a new control is regenerated at the index according to the name, control type, area position and size of the backed-up current control, the control type of the new control is set to the control type that needs to be replaced, the new control name, area position and size are set to be consistent with the current control, and the control node corresponding to the new control is inserted under the parent control node of the current control.
[0073] The node moving module moves all control child nodes of the current control to the new control node, and then deletes the current control node;
[0074] After generating the new control, move all control child nodes of the current control node to the new control node, and then delete the current control node to keep the control hierarchy tree nodes consistent.
[0075] The replacement module resets the properties of the new control node to the previously backed-up control properties, thereby completing the space type replacement. The implementation of the replacement module is further specifically as follows: according to the control type of the new control, all properties of the corresponding control type are obtained and saved in a new property container; the property container of the previously backed-up control is used as the old property container; then, the new property container and the old property container are traversed at the same time, the property names of the same properties are obtained, and these same properties are placed in an identical property container; finally, the identical property container is traversed, and according to the property names of the same properties, the identical property values corresponding to the identical property names in the old property container are set for the new control, so that the properties of the new control after resetting are the originally backed-up control properties.
[0076] The application scenarios of the present invention are as follows:
[0077] When editing an interface, each interface has its own control hierarchy tree, which contains all the controls on the current interface and the corresponding control hierarchy. Each control in the interface scene has its own corresponding control tree node on the control hierarchy tree. Figure 2As shown, the first layer has only one root control A; the second layer has controls B, C, and D, all of which are child controls of the root control A; the third layer has controls E, F, G, and H, control E is a child control of control B, control F and G are child controls of control C, and control H is a child control of control D.
[0078] Select an interface control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control. For example, select control C in the interface scene, which corresponds to Figure 2 Control C of the control hierarchy tree is located at the second level of the control hierarchy tree. Its parent control node is control A, and its child control nodes are control F and control G.
[0079] Traverse the properties of the current control to obtain the name, control type, area position and size of the current control, which are the basic properties for generating interface controls. Then save all the properties except these basic properties in a property container as a backup. For example, the name of the current control is C, the control type is the image type, the area position is (0,0), and the size is 500x400 (that is, the control width is 500 and the height is 400). Then other properties include image path, image background color, transparency, shadow color, rendering mode and other properties. Put all these other properties in a property container as an old property container.
[0080] After replacing the control type, the original control hierarchy tree structure cannot be affected, and all child nodes of the original control need to remain consistent with the original. Therefore, it is necessary to recursively traverse all control child nodes of the current control to obtain all control child node information for subsequent control child node processing. For example, through recursive traversal of the control hierarchy tree, all control child nodes of the current control C are obtained, including control F and control G.
[0081] Then, according to the name of the current control, all child controls of its parent control are traversed to obtain the index of the current control in its parent control node. For example, the parent node of the current control C is control A. By traversing the three child nodes of control A, the index of the current control C in control A is 2.
[0082] After obtaining the index of the current control in its parent control node, a new control is regenerated at the index according to the name, type, and area position size of the current control, and the control type of the new control is set to the control type to be replaced. The new control name and area position size are set to be consistent with the current control, and the control node corresponding to the new control is also inserted under the parent control node of the current control. For example, after obtaining the index of control C in control A as 2, a new control is created at the index. If the control type to be replaced is a button type, the generated new control is set to the button type, and then the name is set to C, the area position is (0,0), and the size is 500x400 (that is, the control width is 500 and the height is 400), which is consistent with the original picture control C. At this time, the index of the original control C is 3 and the index of control D is 4.
[0083] After generating a new control, move all control child nodes of the current control node to the new control node, and then delete the current control node. For example, after generating a button control C, the button control C has no child control nodes. You need to transfer all controls F and G under the original picture control C to the newly generated button control C as child control nodes of the button control C. Then, delete the picture control C from the control tree node. Then, the index of control D moves forward one position due to the deletion of the picture control C. Finally, the index of control D is 3, the same as at the beginning.
[0084] Finally, according to the control type of the new control, all the properties of the corresponding control type are obtained and saved in the new property container. The control property container that was backed up previously is used as the old property container. Then, traverse the two property containers at the same time, obtain the property names of the same properties, and place these same properties in the same property container. Finally, traverse the same property container, and set the same property value corresponding to the same property name in the old property container for the new control according to the property name of the same property, so that the properties after resetting the new control can be the control properties that were backed up previously. For example, if the control type of the new control is a button, there will be properties such as the default button image, the image when clicked, the image when suspended, transparency, shadow color, rendering mode, etc. These properties need to be placed in a new property container, and traverse the old property container and the new property container at the same time to obtain the same properties, such as transparency, shadow color, rendering mode, etc., and place these same properties in the same property container. Next, traverse the same property container, set the same properties of the original picture control C to the button control C, and the control type can be converted with one click.
[0085] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.
Claims
1. A method for replacing a control type, characterized in that: The method comprises the following steps: Step S1, select a control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control; Step S2, traverse the properties of the current control and back up all the properties of the current control, wherein the properties include name, control type, area location and size; Step S3, recursively traverse the control subnodes of the current control to obtain information of all control subnodes; Step S4, obtaining the index of the current control in the parent control node according to the current control name; Step S5: Generate a new control node based on the obtained parent control node index, and insert the new control node under the parent control node; The step S5 is further specifically as follows: after obtaining the index of the current control in the parent control node, a new control is regenerated at the index according to the name, control type, area position and size of the backed-up current control, the control type of the new control is set to the control type to be replaced, the name, area position and size of the new control are set to be consistent with the current control, and the control node corresponding to the new control is inserted under the parent control node of the current control; Step S6, move all control child nodes of the current control to the new control node, and then delete the current control node; Step S7: reset the properties of the new control node to the previously backed-up control properties, thereby completing the control type replacement.
2. A method for replacing a control type according to claim 1, characterized in that: The step S1 is further specified as follows: when editing the interface, each interface has a corresponding control hierarchy tree, which is a multi-branch tree structure. The multi-branch tree structure includes all controls on the current interface and the corresponding control hierarchy. Each control in the interface scene has its own corresponding control tree node on the control hierarchy tree. Select an interface control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control.
3. A method for replacing a control type according to claim 1, characterized in that: The step S2 is further specified as follows: traverse the properties of the current control to obtain the name, control type, area position and size of the current control, which are the basic properties for generating the interface control; then save the basic properties and other properties except these basic properties in a property container as a backup.
4. A method for replacing a control type according to claim 2, characterized in that: The step S4 is further specified as follows: the control hierarchy tree is a multi-branch tree structure, each control node has a corresponding control index, and according to the current control name, all child controls of its parent control are traversed to obtain the index of the current control in its parent control node. Through the node index of the control, the specific position and hierarchical relationship of the control in its parent control can be obtained.
5. A method for replacing a control type according to claim 3, characterized in that: The step S7 is further specifically as follows: according to the control type of the new control, all properties of the corresponding control type are obtained and saved in a new property container; the property container of the control that was originally backed up is used as the old property container; then, the new property container and the old property container are traversed at the same time to obtain the property names of the same properties, and these same properties are placed in an identical property container; finally, the identical property container is traversed, and according to the property names of the same properties, the identical property values corresponding to the identical property names in the old property container are set for the new control, so that the properties of the new control after resetting are the control properties that were originally backed up.
6. A system for replacing a control type, characterized in that: The system includes a control acquisition module, a backup attribute module, a control subnode acquisition module, an index acquisition module, a new control generation module, a node movement module, and a replacement module; The control acquisition module selects a control whose control type needs to be replaced and acquires a control tree node corresponding to the current control; The backup attribute module traverses the attributes of the current control and backs up all the attributes of the current control, including the name, control type, area location and size; The control subnode acquisition module recursively traverses the control subnodes of the current control to acquire information of all control subnodes; The index acquisition module acquires the index of the current control in the parent control node according to the name of the current control; The new control generation module generates a new control node based on the obtained parent control node index, and inserts the new control node under the parent control node; The implementation method of the new control generation module is further specifically as follows: after obtaining the index of the current control in the parent control node, a new control is regenerated at the index according to the name, control type, area position and size of the backed-up current control, the control type of the new control is set to the control type to be replaced, the name, area position and size of the new control are set to be consistent with the current control, and the control node corresponding to the new control is inserted under the parent control node of the current control; The node moving module moves all control child nodes of the current control to the new control node, and then deletes the current control node; The replacement module resets the properties of the new control node to the previously backed-up control properties, thereby completing the control type replacement.
7. A system for replacing a control type according to claim 6, characterized in that: The implementation method of obtaining the control module is further specified as follows: when editing the interface, each interface has a corresponding control hierarchy tree, which is a multi-branch tree structure. The multi-branch tree structure contains all the controls on the current interface and the corresponding control hierarchy. Each control in the interface scene has its own corresponding control tree node on the control hierarchy tree. Select an interface control whose control type needs to be replaced, and obtain the control tree node corresponding to the current control.
8. A system for replacing a control type according to claim 6, characterized in that: The implementation method of the backup attribute module is further specifically as follows: traverse the attributes of the current control to obtain the name, control type, area position and size of the current control, which are the basic attributes for generating interface controls; then save the basic attributes and other attributes except these basic attributes in an attribute container as a backup.
9. A system for replacing a control type according to claim 7, characterized in that: The implementation method of the index acquisition module is further specified as follows: the control hierarchy tree is a multi-branch tree structure, each control node has a corresponding control index, and according to the current control name, all child controls of its parent control are traversed to obtain the index of the current control in its parent control node. Through the node index of the control, the specific position and hierarchical relationship of the control in its parent control can be obtained.
10. A system for replacing a control type according to claim 8, characterized in that: The implementation method of the replacement module is further specifically as follows: according to the control type of the new control, all properties of the corresponding control type are obtained and saved in a new property container; the property container of the control that was originally backed up is used as the old property container; then, the new property container and the old property container are traversed at the same time to obtain the property names of the same properties, and these same properties are placed in an identical property container; finally, the identical property container is traversed, and according to the property names of the same properties, the identical property values corresponding to the identical property names in the old property container are set for the new control, so that the properties of the new control after resetting are the control properties that were originally backed up.
Citation Information
Patent Citations
Method and device for realizing control replacement during transcoding
CN103226475A
Method for rendering and incrementally updating webpages
CN105630902A
Componentization-based code generation method and device
CN113835701A