CN108255486B - View conversion method and device for form design and electronic equipment - Google Patents
View conversion method and device for form design and electronic equipment Download PDFInfo
- Publication number
- CN108255486B CN108255486B CN201711378618.1A CN201711378618A CN108255486B CN 108255486 B CN108255486 B CN 108255486B CN 201711378618 A CN201711378618 A CN 201711378618A CN 108255486 B CN108255486 B CN 108255486B
- Authority
- CN
- China
- Prior art keywords
- hash value
- node
- source code
- view
- control tree
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
- G06F8/4432—Reducing the energy consumption
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Storage Device Security (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The disclosure relates to a view conversion method, a device and electronic equipment for form design, relating to the technical field of information, wherein the method comprises the following steps: when switching from the source code view of the first form to the design view, acquiring a first hash value of a current source code in the source code view, comparing the first hash value with a second hash value of a historical source code, wherein the historical source code is the source code in the source code view when switching from the source code view to the design view last time, and when the first hash value and the second hash value are the same, displaying the design view rendered last time. The consumption of hardware resources caused by frequent rendering in the view conversion process can be reduced, and the view conversion speed is improved.
Description
Technical Field
The present disclosure relates to the field of information technology, and in particular, to a view conversion method and apparatus for form design, and an electronic device.
Background
With the rapid development of information technologies such as the internet, form services applied to the fields of industry, government affairs, management, and the like have started to use electronic forms. The electronic form can collect a large amount of data information and can be stored in a local or cloud database, so that the data can be analyzed, retrieved and counted conveniently. Existing electronic form designers are generally divided into two views: the method comprises the steps of designing a view and a source code view, wherein the design view shows a rendered form, the form can be directly edited in modes of dragging, inputting and the like, the source code view shows source codes corresponding to the form, and more various editing ways are provided for form design.
In the existing electronic form designer, in each conversion process from a source code view to a design view, no matter whether the source code in the source code view is changed or not, the source code needs to be compiled again, and a form is rendered again to generate the design view, so that hardware resources and time are consumed.
Disclosure of Invention
The invention aims to provide a view conversion method, a view conversion device and electronic equipment for form design, which are used for solving the problem of consumption of time and hardware resources in the conversion process from a source code view to a design view.
In order to achieve the above object, according to a first aspect of embodiments of the present disclosure, there is provided a view conversion method for form design, the method including:
when switching from a source code view of a first form to a design view, acquiring a first hash value of a current source code in the source code view;
comparing the first hash value with a second hash value of historical source codes, wherein the historical source codes are source codes in the source code view when the source code view is switched to the design view last time;
when the first hash value and the second hash value are the same, displaying the design view rendered last time.
Optionally, the obtaining a first hash value of a current source code in the source code view includes:
removing a blank space and an empty line in the current source code by carrying out format processing on the current source code;
and performing hash calculation on the current source code after format processing to obtain the first hash value.
Optionally, the method further includes:
and when the first hash value and the second hash value are not the same, re-rendering the design view.
Optionally, when the first hash value and the second hash value are not the same, re-rendering the design view includes:
when the first hash value is different from the second hash value, acquiring a first form control tree corresponding to the current source code according to the current source code, wherein each node of the first form control tree corresponds to one control in the first form;
acquiring a hash value of each node of the first form control tree according to the attribute of the control corresponding to each node of the first form control tree;
and determining the control needing to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in a second form control tree, wherein the second form control tree is the form control tree obtained according to the historical source code.
Optionally, the determining a control that needs to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in the second form control tree includes:
determining whether the hash value of each node in the first form control tree has a change by comparing the hash value of each node in the first form control tree with the hash value of the corresponding node in the second form control tree;
acquiring nodes with changed hash values in the first form control tree as target nodes;
and determining the target node as the control needing to be re-rendered.
Optionally, the determining a control that needs to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in the second form control tree further includes:
and when all child nodes of the first node belong to the target node, taking the first node as the target node, wherein the first node is any node in the first form control tree.
According to a second aspect of the embodiments of the present disclosure, there is provided a view conversion apparatus for form design, the apparatus including:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a first hash value of a current source code in a source code view when the source code view of a first form is switched to a design view;
a comparison module, configured to compare the first hash value with a second hash value of a historical source code, where the historical source code is a source code in the source code view when the source code view is switched to the design view last time;
and the judging module is used for displaying the design view rendered last time when the first hash value and the second hash value are the same.
Optionally, the obtaining module includes:
the processing submodule is used for removing the blank spaces and the empty lines in the current source code by carrying out format processing on the current source code;
and the calculation submodule is used for carrying out hash calculation on the current source code after format processing to obtain the first hash value.
Optionally, the determining module is further configured to:
and when the first hash value and the second hash value are not the same, re-rendering the design view.
Optionally, the determining module includes:
a control tree obtaining sub-module, configured to, when the first hash value is different from the second hash value, obtain, according to the current source code, a first form control tree corresponding to the current source code, where each node of the first form control tree corresponds to one control in the first form;
the hash value acquisition submodule is used for acquiring the hash value of each node of the first form control tree according to the attribute of the control corresponding to each node of the first form control tree;
and the judging submodule is used for determining the control needing to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in the second form control tree, and the second form control tree is the form control tree obtained according to the historical source code.
Optionally, the determining submodule is configured to:
determining whether the hash value of each node in the first form control tree has a change by comparing the hash value of each node in the first form control tree with the hash value of the corresponding node in the second form control tree;
acquiring nodes with changed hash values in the first form control tree as target nodes;
and determining the target node as the control needing to be re-rendered.
Optionally, the determining sub-module is further configured to:
and when all child nodes of the first node belong to the target node, taking the first node as the target node, wherein the first node is any node in the first form control tree.
According to a third aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium on which a computer program is stored, which, when being executed by a processor, implements the steps of the view transformation method for form design provided by the first aspect.
According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: the computer-readable storage medium provided by the third aspect; and one or more processors to execute the computer program in the computer-readable storage medium.
According to the technical scheme, in the process of switching from the source code view to the design view, the hash value corresponding to the current source code in the source code view is obtained, the obtained hash value is compared with the hash value obtained in the process of switching from the source code view to the design view last time, when the comparison result is consistent, the source code in the source code view is determined not to be changed, the form does not need to be re-rendered, and the design view before being switched to the source code view can be reserved. The consumption of hardware resources caused by frequent rendering in the view conversion process can be reduced, and the view conversion speed is improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
FIG. 1 is a flow diagram illustrating a method for view transformation of a form design in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating another method of view transformation for form design in accordance with an illustrative embodiment;
FIG. 3 is a flow diagram illustrating another method for view transformation of a form design in accordance with an illustrative embodiment;
FIG. 4 is a flow diagram illustrating another method of view transformation for form design in accordance with an illustrative embodiment;
FIG. 5 is a block diagram illustrating a view transformation apparatus for form design in accordance with an exemplary embodiment;
FIG. 6 is a block diagram illustrating another view translation apparatus for form design in accordance with an illustrative embodiment;
FIG. 7 is a block diagram illustrating another view translation device for form design in accordance with an illustrative embodiment;
FIG. 8 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Before introducing the view conversion method, the view conversion apparatus, and the electronic device for form design provided by the present disclosure, an application scenario related to various embodiments of the present disclosure is first introduced. The application scene is an electronic form designer and comprises a design view and a source code view. A user can design a form by dragging, inputting and the like in a source code view, can also switch to the source code view, operates different controls in the form by writing source codes, and switches the source code view to a design view after the operation is completed, so that the form corresponding to the source codes can be viewed in the design view.
FIG. 1 is a flow diagram illustrating a method for view transformation of a form design, as shown in FIG. 1, in accordance with an exemplary embodiment, the method comprising:
For example, a user designs a first form through an electronic form designer, which can be divided into two scenarios: a user designs different controls in a first form through a design view, then switches the first form from the design view to a source code view, and further edits a source code corresponding to the first form, for example, the properties (background color, calculation formula, order, data format, and the like) of a certain control in the first form may be edited. Another scenario may be that the user writes source code directly in the source code view, and sets the attributes of different controls in the first form. After the user finishes writing the source code in the source code view, the source code view of the first form needs to be switched to the design view so as to view the showing state of the first form in the design view. In the process of switching from the source code view to the design view, the hash calculation is carried out on the current source code in the source code view to obtain a first hash value.
And 102, comparing the first hash value with a second hash value of the historical source code, wherein the historical source code is the source code in the source code view when the source code view is switched to the design view last time.
For example, in the last switching process from the source code view to the design view, the hash value corresponding to the last historical source code in the source code view is obtained and stored as the second hash value. Since the hash value of a piece of data is unique, if the piece of data is changed by one byte or a plurality of bytes, the hash value corresponding to the changed data is also changed, so that whether the current source code in the source code view is changed relative to the previous historical source code can be judged by comparing the first hash value with the second hash value.
And 103, when the first hash value and the second hash value are the same, displaying the design view rendered last time.
For example, when the first hash value and the second hash value are the same, it can be determined that the current source code and the historical source code in the source code view are completely consistent, and no change is generated, so that the corresponding design view does not change, and therefore, the form does not need to be re-rendered, and the design view rendered last time can be displayed, that is, the display state corresponding to the design view before switching to the current source code view is retained, where the design view rendered last time is rendered according to the source code modified last time (which may be understood as the source code modified last time before the current time and closest to the current time). Therefore, the last modified source code may be the historical source code or the source code before the historical source code. That is, no matter how many times the source code view and the design view are switched, as long as the first hash value and the second hash value are the same when switching to the design view, the source code is unchanged, and the design view does not need to be re-rendered until the first hash value and the second hash value are different, and the design view is re-rendered.
In summary, in the process of switching from the source code view to the design view, the hash value corresponding to the current source code in the source code view is obtained, and the obtained hash value is compared with the hash value obtained in the process of switching from the source code view to the design view last time. The consumption of hardware resources caused by frequent rendering in the view conversion process can be reduced, and the view conversion speed is improved.
FIG. 2 is a flow diagram illustrating another method for view transformation of a form design, according to an example embodiment, as shown in FIG. 2, step 101 includes:
in step 1011, the space and the empty line in the current source code are removed by performing format processing on the current source code.
For example, when the user switches the first form from the design view to the source view, only format modifications are made to the source code in the source view, and no substantial modifications are made to the properties of the first form, such as: the method comprises the steps of deleting a blank space and an empty line, or adding a blank space and an empty line, and then or on the premise of not changing the meaning of the original sentence, performing line changing and other processing on the long sentence, wherein only the format of a source code is modified, the first form is not actually influenced, and a design view does not need to be rendered again correspondingly, so that the waste of hardware resources and time caused by re-rendering the first form due to the modification of the format of the source code is avoided.
FIG. 3 is a flow diagram illustrating another method for view transformation of a form design, according to an example embodiment, as shown in FIG. 3, the method further comprising:
and 104, re-rendering the design view when the first hash value is different from the second hash value.
For example, when the first hash value and the second hash value are not the same, it can be determined that the current source code is not consistent with the historical source code, that is, the current source code is changed compared with the historical source code, and therefore the form needs to be re-rendered.
FIG. 4 is a flowchart illustrating another method for view transformation of a form design, according to an example embodiment, as shown in FIG. 4, step 104 includes:
For example, a corresponding first form control tree is obtained according to the current source code, where each node in the first form control tree represents a control of the first form, for example, a root node may be represented as the first form itself (which may be regarded as the topmost control in the first form), and a control corresponding to any child node in the first form control tree belongs to a control corresponding to a parent node of the node.
Illustratively, each control of the first form has a corresponding attribute, and the hash value of each node is obtained according to the control corresponding to each node in the control tree of the first form and the corresponding attribute value of each control of the first form in the current source code. For example, the first node is any node in a control tree of the first form, the first node is determined to correspond to the first control of the first form, hash calculation is performed on the attribute value corresponding to the first control in the current source code, and the obtained hash value is used as the hash value of the first node.
And 1043, determining the control needing to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in the second form control tree, wherein the second form control tree is the form control tree obtained according to the historical source code.
For example, in the last switching process from the source code view to the design view, the hash values of each node in the second form control tree and the second form control tree are obtained according to the historical source codes and stored, after the hash value of each node in the first form control tree is obtained, the hash value of each node in the first form control tree is compared with the hash value of each node in the second form control tree, and the control corresponding to the node with the changed hash value in the first form control tree is determined as the control to be re-rendered.
Illustratively, step 1043 may be implemented by:
firstly, comparing the hash value of each node in the first form control tree with the hash value of the corresponding node in the second form control tree to determine whether the hash value of each node in the first form control tree is changed. And secondly, acquiring nodes with changed hash values in the first form control tree as target nodes. And finally, determining the target node as a control needing to be re-rendered.
For example, taking a first node in a first form control tree and a second form control tree (it can be understood that there is a control corresponding to the first node in both a current source code edited this time and a historical source code edited last time) as an example, comparing a hash value of the first node in the first form control tree with a hash value of the first node in the second form control tree, when the hash value of the first node in the first form control tree is different from the hash value of the first node in the second form control tree, determining that the hash value of the first node changes, and taking the first node as a target node. Further, a corresponding control is determined according to the target node, and the corresponding control is used as the control needing to be re-rendered. It should be noted that the target node may be a set, which includes one or more nodes and records the position or sequence number of the target node in the first form control tree, or may identify the position or sequence number of the target node in the first form control tree by marking on the target node.
The method includes the steps that a form control tree is generated and stored according to source codes edited at this time before switching to a design view, so that hash values of all nodes of the form control tree are recorded, when switching to the design view next time, the last stored form control tree and the hash values of all nodes are used for judging which node hash values are changed, and therefore when switching to the design view, the control corresponding to the node with the changed hash values is re-rendered.
In addition, in another implementation manner, the form control tree may not be saved every time the design view is switched, and only the hash value of each node is calculated and saved, so that when the design view is switched next time, the hash value of each node saved last time is used to determine which node hash values are changed. Taking the first node as an example, when switching to the design view last time, the hash value of each node in the second form control tree generated last time may be recorded in one hash value table. Therefore, when switching to the design view this time, the current hash value of the first node may be compared with the hash value of the first node recorded in the hash value table, and when the current hash value of the first node is different from the hash value of the first node in the hash value table, it is determined that the hash value of the first node changes, and the first node is used as a target node, and similarly, it may be determined whether the hash value of each node changes.
Further, step 1043 further comprises:
and when all the child nodes of the first node belong to the target node, taking the first node as the target node, wherein the first node is any node in the first form control tree.
For example, if a control includes multiple controls, the control corresponds to a control tree of a first form, that is, a node includes multiple child nodes, taking the first node as an example, when all child nodes of the first node belong to a target node, it indicates that the controls corresponding to all child nodes under the first node need to be re-rendered, that is, the controls corresponding to the first node need to be re-rendered, so that the first node can be directly used as the target node. Further, after the first node is taken as the target node, all child nodes of the first node may be deleted from the target node. For example, when the target node is a set, all child nodes of the first node in the set are deleted, and when the target node is identified by means of the label, the labels of all child nodes of the first node are removed.
In summary, in the process of switching from the source code view to the design view, the hash value corresponding to the current source code in the source code view is obtained, and the obtained hash value is compared with the hash value obtained in the process of switching from the source code view to the design view last time. The consumption of hardware resources caused by frequent rendering in the view conversion process can be reduced, and the view conversion speed is improved.
Fig. 5 is a block diagram illustrating a view transformation apparatus for form design according to an exemplary embodiment, and as shown in fig. 5, the apparatus 200 includes:
the obtaining module 201 is configured to obtain a first hash value of a current source code in a source code view when switching from the source code view of the first form to the design view.
A comparing module 202, configured to compare the first hash value with a second hash value of a historical source code, where the historical source code is a source code in a source code view when the source code view is switched to the design view last time.
And the judging module 203 is configured to display the design view rendered last time when the first hash value and the second hash value are the same.
Fig. 6 is a block diagram illustrating another view conversion apparatus for form design according to an exemplary embodiment, and as shown in fig. 6, the obtaining module 201 includes:
the processing sub-module 2011 is configured to perform format processing on the current source code to remove a space and an empty line in the current source code.
The calculating submodule 2012 is configured to perform hash calculation on the format-processed current source code to obtain a first hash value.
Optionally, the determining module 203 is further configured to:
and when the first hash value and the second hash value are not the same, re-rendering the design view.
Fig. 7 is a block diagram illustrating another view conversion apparatus for form design according to an exemplary embodiment, and as shown in fig. 7, the determining module 203 includes:
the control tree obtaining sub-module 2031 is configured to, when the first hash value is different from the second hash value, obtain, according to the current source code, a first form control tree corresponding to the current source code, where each node of the first form control tree corresponds to one control in the first form.
The hash value obtaining submodule 2032 is configured to obtain, according to the attribute of the control corresponding to each node of the first form control tree, a hash value of each node of the first form control tree.
The determining submodule 2033 is configured to determine a control that needs to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in the second form control tree, where the second form control tree is a form control tree obtained according to the historical source code.
Optionally, the determining sub-module 2033 is configured to:
and comparing the hash value of each node in the first form control tree with the hash value of the corresponding node in the second form control tree to determine whether the hash value of each node in the first form control tree is changed.
And acquiring the node with the changed hash value in the first form control tree as a target node.
And determining the target node as a control needing re-rendering.
Further, the determining sub-module 2033 is further configured to:
and when all the child nodes of the first node belong to the target node, taking the first node as the target node, wherein the first node is any node in the first form control tree.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In summary, in the process of switching from the source code view to the design view, the hash value corresponding to the current source code in the source code view is obtained, and the obtained hash value is compared with the hash value obtained in the process of switching from the source code view to the design view last time. The consumption of hardware resources caused by frequent rendering in the view conversion process can be reduced, and the view conversion speed is improved.
Fig. 8 is a block diagram illustrating an electronic device 800 in accordance with an example embodiment. As shown in fig. 8, the electronic device 800 may include: a processor 801, a memory 802, a multimedia component 803, an input/output (I/O) interface 804, and a communications component 805.
The processor 801 is configured to control the overall operation of the electronic device 800, so as to complete all or part of the steps in the above-described view transformation method for form design. The memory 802 is used to store various types of data to support operation at the electronic device 800, such as instructions for any application or method operating on the electronic device 800 and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and so forth. The Memory 802 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia components 803 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 802 or transmitted through the communication component 805. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 804 provides an interface between the processor 801 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them, so that the corresponding Communication component 805 may include: Wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the electronic Device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described view transformation method for form design.
In another exemplary embodiment, a computer readable storage medium comprising program instructions, such as the memory 802 comprising program instructions, executable by the processor 801 of the electronic device 800 to perform the above-described view transformation method for form design is also provided.
In summary, in the process of switching from the source code view to the design view, the hash value corresponding to the current source code in the source code view is obtained, and the obtained hash value is compared with the hash value obtained in the process of switching from the source code view to the design view last time. The consumption of hardware resources caused by frequent rendering in the view conversion process can be reduced, and the view conversion speed is improved.
Preferred embodiments of the present disclosure are described in detail above with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and other embodiments of the present disclosure may be easily conceived by those skilled in the art within the technical spirit of the present disclosure after considering the description and practicing the present disclosure, and all fall within the protection scope of the present disclosure.
It should be noted that the various features described in the above embodiments may be combined in any suitable manner without departing from the scope of the invention. Meanwhile, any combination can be made between various different embodiments of the disclosure, and the disclosure should be regarded as the disclosure of the disclosure as long as the combination does not depart from the idea of the disclosure. The present disclosure is not limited to the precise structures that have been described above, and the scope of the present disclosure is limited only by the appended claims.
Claims (4)
1. A method for view transformation of a form design, the method comprising:
when switching from a source code view of a first form to a design view, acquiring a first hash value of a current source code in the source code view;
comparing the first hash value with a second hash value of historical source codes, wherein the historical source codes are source codes in the source code view when the source code view is switched to the design view last time;
displaying the design view rendered last time when the first hash value and the second hash value are the same;
when the first hash value and the second hash value are not the same, re-rendering the design view;
the obtaining a first hash value of a current source code in the source code view includes:
removing a blank space and an empty line in the current source code by carrying out format processing on the current source code;
performing hash calculation on the current source code after format processing to obtain the first hash value;
when the first hash value and the second hash value are not the same, re-rendering the design view includes:
when the first hash value is different from the second hash value, acquiring a first form control tree corresponding to the current source code according to the current source code, wherein each node of the first form control tree corresponds to one control in the first form, and the control corresponding to each node of the first form control tree belongs to the control corresponding to the father node of the node;
obtaining a hash value of each node of the first form control tree according to the attribute of the control corresponding to each node of the first form control tree, wherein the attribute comprises: at least one of background color, calculation formula, sequence and data format;
determining a control needing to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in a second form control tree, wherein the second form control tree is a form control tree obtained according to the historical source code;
determining the control needing to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in the second form control tree, wherein the determining comprises the following steps:
determining whether the hash value of each node in the first form control tree has a change by comparing the hash value of each node in the first form control tree with the hash value of the corresponding node in the second form control tree;
acquiring nodes with changed hash values in the first form control tree as target nodes;
when all child nodes of a first node belong to the target node, taking the first node as the target node, wherein the first node is any node in the first form control tree;
and determining the control needing to be re-rendered according to the position or the sequence number of the target node.
2. A view transformation apparatus for form design, the apparatus comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring a first hash value of a current source code in a source code view when the source code view of a first form is switched to a design view;
a comparison module, configured to compare the first hash value with a second hash value of a historical source code, where the historical source code is a source code in the source code view when the source code view is switched to the design view last time;
the judging module is used for displaying the design view rendered last time when the first hash value and the second hash value are the same; when the first hash value and the second hash value are not the same, re-rendering the design view;
the acquisition module includes:
the processing submodule is used for removing the blank spaces and the empty lines in the current source code by carrying out format processing on the current source code;
the calculation submodule is used for carrying out hash calculation on the current source code after format processing to obtain the first hash value;
the judging module comprises:
a control tree obtaining sub-module, configured to, when the first hash value is different from the second hash value, obtain, according to the current source code, a first form control tree corresponding to the current source code, where each node of the first form control tree corresponds to one control in the first form, and a control corresponding to each node of the first form control tree belongs to a control corresponding to a parent node of the node;
a hash value obtaining sub-module, configured to obtain, according to an attribute of a control corresponding to each node of the first form control tree, a hash value of each node of the first form control tree, where the attribute includes: at least one of background color, calculation formula, sequence and data format;
the judging submodule is used for determining a control needing to be re-rendered according to the hash value of each node in the first form control tree and the hash value of each node in a second form control tree, and the second form control tree is a form control tree obtained according to the historical source code;
the judgment submodule is used for:
determining whether the hash value of each node in the first form control tree has a change by comparing the hash value of each node in the first form control tree with the hash value of the corresponding node in the second form control tree;
acquiring nodes with changed hash values in the first form control tree as target nodes;
when all child nodes of a first node belong to the target node, taking the first node as the target node, wherein the first node is any node in the first form control tree;
and determining the control needing to be re-rendered according to the position or the sequence number of the target node.
3. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method as claimed in claim 1.
4. An electronic device, comprising:
the computer-readable storage medium recited in claim 3; and
one or more processors to execute the program in the computer-readable storage medium.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201711378618.1A CN108255486B (en) | 2017-12-19 | 2017-12-19 | View conversion method and device for form design and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201711378618.1A CN108255486B (en) | 2017-12-19 | 2017-12-19 | View conversion method and device for form design and electronic equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN108255486A CN108255486A (en) | 2018-07-06 |
| CN108255486B true CN108255486B (en) | 2021-12-10 |
Family
ID=62722483
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201711378618.1A Active CN108255486B (en) | 2017-12-19 | 2017-12-19 | View conversion method and device for form design and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN108255486B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110333860B (en) * | 2019-05-08 | 2022-12-09 | 武汉瓯越网视有限公司 | Method and related device for moving out view object |
| CN113448832B (en) * | 2020-06-18 | 2024-03-12 | 北京新氧科技有限公司 | Control exposure detection method and application program operation monitoring system |
| CN114282137A (en) * | 2021-12-28 | 2022-04-05 | 沈阳东软智能医疗科技研究院有限公司 | User operation data storage method, device, device and storage medium |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105511962A (en) * | 2015-11-27 | 2016-04-20 | 华为技术有限公司 | Rendering method and device |
| CN106598574A (en) * | 2016-11-25 | 2017-04-26 | 腾讯科技(深圳)有限公司 | Method and device for page rendering |
| CN107256151A (en) * | 2017-05-27 | 2017-10-17 | 北京小米移动软件有限公司 | Processing method, device and the terminal of page rendering |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160062954A1 (en) * | 2012-09-15 | 2016-03-03 | Numbergun Llc | Flexible high-speed generation and formatting of application-specified strings |
-
2017
- 2017-12-19 CN CN201711378618.1A patent/CN108255486B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105511962A (en) * | 2015-11-27 | 2016-04-20 | 华为技术有限公司 | Rendering method and device |
| CN106598574A (en) * | 2016-11-25 | 2017-04-26 | 腾讯科技(深圳)有限公司 | Method and device for page rendering |
| CN107256151A (en) * | 2017-05-27 | 2017-10-17 | 北京小米移动软件有限公司 | Processing method, device and the terminal of page rendering |
Also Published As
| Publication number | Publication date |
|---|---|
| CN108255486A (en) | 2018-07-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109634598B (en) | Page display method, device, equipment and storage medium | |
| CN112650766A (en) | Database data operation method, system and server | |
| US12307228B2 (en) | Software code change method and apparatus | |
| CN111831815B (en) | Control method and device for questionnaire display, storage medium and electronic equipment | |
| US10101727B2 (en) | Common parameter interface generation program and parameter reading program | |
| CN110070593B (en) | Method, device, equipment and medium for displaying picture preview information | |
| CN106027785A (en) | Voice processing method and terminal | |
| CN110413367B (en) | Task creation method and device, storage medium and electronic equipment | |
| US20160283447A1 (en) | Providing interactive preview of content within communication | |
| CN114579561B (en) | Data processing method and device, and storage medium | |
| CN108255486B (en) | View conversion method and device for form design and electronic equipment | |
| CN108984623B (en) | Data query condition generation method and device, storage medium and electronic equipment | |
| CN114997117A (en) | Document editing method, device, terminal and non-transitory storage medium | |
| CN115857905A (en) | Graphical programming code conversion method, device, electronic equipment and storage medium | |
| CN119294491A (en) | Urban knowledge graph construction method, device, medium, product and equipment | |
| CN113742332A (en) | Data storage method, device, equipment and storage medium | |
| CN111258434A (en) | Method, device, equipment and storage medium for inserting pictures into chat interface | |
| CN115951993A (en) | Data processing method, data processing apparatus, electronic device, storage medium, and program product | |
| CN110704742B (en) | Feature extraction method and device | |
| CN109948251B (en) | CAD-based data processing method, device, equipment and storage medium | |
| CN111858158A (en) | Data processing method and device and electronic equipment | |
| CN110874444B (en) | URL conversion model building method and device and electronic equipment | |
| CN111078338A (en) | Method and device for internationalized processing of software, storage medium and electronic device | |
| CN111177279A (en) | Form saving method and device, storage medium and electronic equipment | |
| CN103593532A (en) | Data processing method and device for charting |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |