Node processing method, apparatus, computer-readable storage medium, and computer equipment
By setting up a node pool in the instant messaging application, reclaiming and reusing nodes, the memory consumption problem caused by the increase in the number of nodes is solved, and the system operating efficiency is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-06-09
- Publication Date
- 2026-05-26
AI Technical Summary
In instant messaging applications, as the number of contacts and nodes increases, the terminal memory usage becomes excessive, reducing the terminal's operating efficiency.
By setting up a node pool, nodes corresponding to child controls can be recycled and reused, generating only the necessary nodes in the display area, reducing the number of controls and lowering memory consumption.
This effectively reduced the number of nodes, lowered memory consumption, and improved system operating efficiency.
Smart Images

Figure CN115525196B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to a node processing method, apparatus, computer-readable storage medium, and computer device. Background Technology
[0002] Instant Messaging (IM) is currently the most popular communication method in the Internet age, and various instant messaging software has emerged in an endless stream; service providers have also provided increasingly rich communication service functions.
[0003] In the contact list display interface of instant messaging applications, contacts are often displayed in the form of tree control or list control. This makes the contact structure clear and makes it easier for users to find the target contact as soon as possible.
[0004] Currently, instant messaging applications typically create a node for each contact when displaying data using tree or list controls. As the number of contacts increases, the number of nodes also increases. This increasing number of nodes leads to a greater consumption of terminal memory, thus reducing the terminal's operating efficiency. Summary of the Invention
[0005] This application provides a node processing method, apparatus, computer-readable storage medium, and computer device. The method achieves the recycling and reuse of nodes corresponding to child controls by setting a node pool. Thus, only the nodes corresponding to the child controls in the display area and the nodes in the node pool need to be generated, eliminating the need to generate corresponding nodes for each child control. This method can significantly reduce the number of nodes required for controls, thereby reducing memory consumption.
[0006] The first aspect of this application provides a node processing method, including:
[0007] Obtain the display area of the target control, wherein the target control includes at least one tree control or list control;
[0008] Determine the first set of sub-controls contained in the display area;
[0009] In response to an adjustment operation on the displayed content in the display area, a second set of sub-controls indicated by the adjustment operation in the display area is obtained;
[0010] Determine the intersection of the first set of sub-controls and the second set of sub-controls;
[0011] Store the nodes corresponding to the sub-controls in the first set of sub-controls that do not belong to the intersection into the node pool;
[0012] The nodes in the updated node pool are used to generate child controls in the second child control set that do not belong to the intersection.
[0013] Accordingly, a second aspect of this application provides a node processing apparatus, the apparatus comprising:
[0014] The first acquisition unit is used to acquire the display area of the target control, wherein the target control includes at least one tree control or list control;
[0015] The first determining unit is used to determine the first set of sub-controls contained in the display area;
[0016] The second acquisition unit is configured to acquire a set of second sub-controls indicated by the adjustment operation in the display area in response to an adjustment operation on the display content in the display area;
[0017] The second determining unit is used to determine the intersection of the first set of sub-controls and the second set of sub-controls;
[0018] A storage unit is used to store the nodes corresponding to the sub-controls in the first set of sub-controls that do not belong to the intersection into the node pool;
[0019] The generation unit is used to generate child controls in the second child control set that do not belong to the intersection using the nodes in the updated node pool.
[0020] In some embodiments, the second acquisition unit includes:
[0021] The first acquisition subunit is configured to, in response to a scrolling operation received in the display area, acquire the displacement of the target control relative to the display area caused by the scrolling operation;
[0022] The first determining sub-unit is used to determine, based on the displacement, the second set of sub-controls corresponding to the target control in the display area after the scrolling operation.
[0023] In some embodiments, the first determining subunit includes:
[0024] The first acquisition module is used to acquire the first label range of the sub-controls contained in the first sub-control set;
[0025] The second acquisition module is used to acquire the height information of all child controls of the target control in the current state.
[0026] The first determining module is used to determine the second label range of the sub-controls included in the display area after the scrolling operation based on the first label range, the displacement, and the height information of all sub-controls;
[0027] The second determining module is used to determine the second set of sub-controls based on the second label range.
[0028] In some embodiments, the second acquisition unit includes:
[0029] The second acquisition subunit is used to acquire information about the secondary sub-controls contained in the target sub-control in response to an expansion operation of the target sub-control in the display area.
[0030] The second determining sub-unit is used to determine, based on the secondary sub-control information, the second set of sub-controls corresponding to the target control and the display area after the expansion operation.
[0031] In some embodiments, the generating unit includes:
[0032] The third determining sub-unit is used to determine the set of sub-controls in the second set of sub-controls that does not belong to the intersection as the third set of sub-controls, and to determine the target number of elements contained in the third set of sub-controls;
[0033] The third acquisition subunit is used to acquire the target number of nodes from the updated node pool;
[0034] A sub-unit is generated to generate sub-controls in the third sub-control set based on the target number of nodes.
[0035] In some embodiments, the generating subunit includes:
[0036] An initialization module is used to initialize the target number of nodes to obtain the target number of initialized nodes;
[0037] The rendering module is used to render the target number of initialized nodes and generate the sub-controls in the third sub-control set.
[0038] In some embodiments, the third acquisition subunit includes:
[0039] The third determining module is used to determine the node type of each sub-control in the third sub-control set;
[0040] The third acquisition module is used to acquire nodes corresponding to the node type of each child control one by one from the updated node pool to obtain the target number of nodes.
[0041] In some embodiments, the third acquisition subunit includes:
[0042] The fourth acquisition module is used to acquire the target number of nodes from the updated node pool when it is detected that the number of nodes in the updated node pool is not less than the target number;
[0043] A creation module is configured to create new nodes in the updated node pool when the number of nodes in the updated node pool is less than the target number, until the number of nodes in the node pool reaches the target number, and to obtain the target number of nodes from the node pool.
[0044] A third aspect of this application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to perform the steps of the node processing method provided in the first or third aspect of this application.
[0045] A fourth aspect of this application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the node processing method provided in the first or third aspect of this application.
[0046] This application's fifth aspect provides a computer program product or computer program, the computer program product or computer program including computer instructions stored in a storage medium. A processor of a computer device reads the computer instructions from the storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps of the node processing method provided in the first aspect or the third aspect of this application.
[0047] The node processing method provided in this application involves: obtaining the display area of a target control, which includes at least one tree control or list control; determining a first set of child controls contained in the display area; obtaining a second set of child controls indicated by the adjustment operation in the display area in response to an adjustment operation on the content displayed in the display area; determining the intersection of the first set of child controls and the second set of child controls; storing the nodes corresponding to the child controls in the first set that do not belong to the intersection in a node pool; and generating child controls in the second set that do not belong to the intersection using the nodes in the updated node pool. In this way, by setting a node pool, nodes corresponding to child controls that do not need to be displayed in the display area due to adjustment operations are recycled to the node pool, and nodes are called from the node pool to generate child controls that need to be displayed in the display area after the adjustment operation is triggered. This requires maintaining only a limited number of nodes, greatly reducing the number of nodes needed, reducing memory consumption, and improving system operating efficiency. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1A This is a schematic diagram of a node processing scenario provided in this application;
[0050] Figure 1B This is another schematic diagram of node processing provided in this application;
[0051] Figure 2 This is a flowchart illustrating the node processing method provided in this application;
[0052] Figure 3A This is another schematic diagram of the node processing scenario provided in this application;
[0053] Figure 3B This is another schematic diagram of the node processing scenario provided in this application;
[0054] Figure 4 This is another flowchart illustrating the node processing method provided in this application;
[0055] Figure 5 This is a schematic diagram of the node processing device provided in this application;
[0056] Figure 6 This is a schematic diagram of the terminal provided in this application. Detailed Implementation
[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0058] This invention provides a node processing method, apparatus, computer-readable storage medium, and computer device. The node processing method can be used in a node processing apparatus. The node processing apparatus can be integrated into a computer device, which can be a terminal or a server. The terminal can be a mobile phone, tablet computer, laptop computer, smart TV, wearable smart device, personal computer (PC), etc. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
[0059] Please see Figure 1A This is a schematic diagram of the node processing scenario provided in this application. As shown in the figure, the target control 10 includes seven list controls: control 1, control 2, control 3, control 5, control 6, control 7, and control 8, and a tree control: control 4. Here, the target control can also be called the parent control, and controls 1 to 8 can be called child controls. The tree control (i.e., control 4) also includes seven child controls: control 41, control 42, control 43, control 44, control 45, control 46, and control 47. In this application, the child controls of control 4, such as control 41, are also called child controls.
[0060] In some implementations, since the size of the computer device's screen is fixed, the length of the target control 10 often cannot be fully displayed on that screen, such as... Figure 1A As shown, the display area 11 can be the display area of the computer device's screen. It can be seen that the target control 10 can only be displayed in part of the display area 11, while the other part is in the non-display area and is in a hidden state.
[0061] like Figure 1A As shown, the target control 10 includes the portion corresponding to the display area 11 and the portion corresponding to the non-display area outside the display area 11. The display area 11 in the figure includes 10 sub-controls: control 3, control 4, control 41, control 42, control 43, control 44, control 45, control 46, control 47, and control 5. That is, only these 10 sub-controls can be seen on the display terminal. Since other controls such as control 1, control 2, control 6, control 7, and control 8 are outside the display area, they cannot be seen on the terminal's display interface.
[0062] After obtaining the display area 10 of the target control, the first set of sub-controls contained in the display area 10 is determined, namely, the set consisting of 10 sub-controls: control 3, control 4, control 41, control 42, control 43, control 44, control 45, control 46, control 47, and control 5. Then, when the user adjusts the control on the display interface, for example, by scrolling the control using the scroll bar on the display interface, the second set of sub-controls indicated by the adjustment operation in the display area is obtained. Figure 1B The diagram shown illustrates another scenario of node processing provided in this application. Figure 1B In the display area, the second set of sub-controls indicated by the adjustment operation is a set of 10 sub-controls: control 41, control 42, control 43, control 44, control 45, control 46, control 47, control 5, control 6, and control 7. Figure 1B The example shown is just one example. The second set of sub-controls is a set of sub-controls calculated based on the sub-control information contained in the target control, the display area, and the adjustment operations.
[0063] Further, the intersection of the first and second sub-control sets is determined. Here, the intersection is the set consisting of controls 4, 41, 42, 43, 44, 45, 46, 47, and 5. Then, the nodes corresponding to the sub-controls in the first set that do not belong to the intersection are stored in the node pool; that is, the node corresponding to control 3 is stored in the node pool. Finally, a third sub-control set is generated from the nodes in the updated node pool, consisting of the sub-controls in the second set that do not belong to the intersection. This third sub-control set contains only control 5. In other words, control 5 is generated based on the nodes in the updated node pool.
[0064] In this scenario, when adjusting the content displayed in the display area, the nodes corresponding to the child controls are recycled and reused based on the changes in the child controls displayed in the display area before and after the adjustment. This eliminates the need to generate nodes for each child control, saving memory and improving system efficiency.
[0065] It should be noted that, Figure 1A and Figure 1B The schematic diagrams illustrating node processing scenarios are merely examples. The node processing scenarios described in the embodiments of this application are intended to more clearly illustrate the technical solutions of this application and do not constitute a limitation on the technical solutions provided in this application. Those skilled in the art will understand that, with the evolution of node processing and the emergence of new business scenarios, the technical solutions provided in this application are equally applicable to similar technical problems.
[0066] The implementation scenarios described above will be explained in detail below.
[0067] This application will describe embodiments from the perspective of a node processing device, which can be integrated into a computer device. The computer device can be a terminal or a server, such as... Figure 2 The diagram shown is a flowchart of the node processing method provided in this application. The method includes:
[0068] Step 101: Obtain the display area of the target control.
[0069] The target control includes at least one tree control or list control. A tree control is a view that can intuitively display hierarchical relationships, while a list control is a view that can display parallel relationships. Specifically, the left-hand menu of Windows Explorer (a Microsoft operating system) is a tree control, as is the contact interface of WeChat Work (an instant messaging application), where the message list is a list control. A list control can contain only one control or multiple parallel controls; while a tree control generally consists of a root control and multiple levels of child or grandchild controls. The target control includes at least one tree control or list control; that is, the target control can include only one tree control or only one list control, or it can include multiple tree controls and multiple list controls.
[0070] Currently, for list controls, the system creates a node for each list control; for tree controls, the system creates a node for each level of control. Specifically, the system creates a node for the root control, a node for each first-level child control under the root control, a node for each second-level child control under each first-level child control, and so on, until each level of child control in the tree control has its corresponding node. When displaying data using the above-mentioned list or tree controls, all nodes are loaded simultaneously. As the amount of data gradually increases, the number of nodes also increases rapidly, which greatly consumes system memory space, leading to a decrease in system processing efficiency. To solve the problem of excessive nodes consuming a large amount of memory space due to the increase in data volume, this application provides a node processing method, which is described in further detail below.
[0071] In this embodiment, the target control includes at least one tree control or list control; therefore, the target control can be called the parent control, and the tree controls or list controls contained within the target control are called child controls. Furthermore, in this solution, all child controls of the tree control, regardless of their level (e.g., first-level, second-level, etc.), are uniformly referred to as child controls of the target control. Please refer to further details. Figure 1A , Figure 1AControls 4 and 41 are both child controls of target control 10. Figure 1A It can also be seen that the number of child controls contained in the target control varies depending on its state. When the tree control, i.e., control 4, is in the expanded state, the target control contains 15 child controls; when control 4 is in the collapsed state, the target control contains 8 child controls. Figure 1A The target control 10 is merely illustrative. In actual use, only the child controls displayed in display area 11 are truly visible. The child controls in other areas can be calculated based on data, and their representation is simply related program data, not the image shown in the figure. In related technologies, when multiple controls (at least one tree control or list control) need to be displayed, they need to be encapsulated in a list. However, in this embodiment, multiple controls can exist independently without being encapsulated in a list. Multiple controls can constitute a parent control, and each display unit in the multiple controls is a child control of the parent control. When the user scrolls to display other undisplayed child controls, the entire parent control scrolls together.
[0072] As the amount of data increases, the number of child controls contained in the target control also increases. However, the display area on a terminal screen is generally limited. Therefore, only a portion of the child controls of the target control are usually displayed on the terminal screen, while the others are hidden. When a user needs to use a hidden child control, they can scroll the target control to reveal it in the display area. In other words, the display area of the target control is a fixed-size area. Please continue reading... Figure 1A ,like Figure 1A As shown, display area 11 is a rectangular area with a fixed width and a height equal to the sum of the heights of 10 controls. The display area of the target control also corresponds to the area on the terminal where the target control is displayed. When the user scrolls the scroll bar, the rectangle corresponding to the display area does not change, but the child controls displayed in the display area will change.
[0073] Step 102: Determine the first set of child controls contained in the display area.
[0074] Here, the first set of child controls within the display area is defined as the set of child controls displayed in the display area in the current state of the target control. As mentioned earlier, when the tree control contained in the target control is expanded or collapsed, the target control is in different states; correspondingly, when any level of child controls within the tree control is expanded or collapsed, the target control is also in different states. At a specific moment, the state of the target control can be obtained. For example, at a certain moment t, any level of child controls within the tree control contained in the target control will only be in one of two determined states: expanded or collapsed. That is, the state of the target control is also determined at this time. For details, please refer to [further details]. Figure 1A This illustrates the state of the target control at a specific moment. At this time, the display area 11 of the target control contains 10 sub-controls: control 4, control 41, control 42, control 43, control 44, control 45, control 46, control 47, control 5, and control 6. That is, the first set of sub-controls contains the above 10 sub-controls. If in another state, such as a tree control, where control 4 is in the collapsed state, then the sub-controls contained in the display area become 5 controls: control 4, control 5, control 6, control 7, and control 8.
[0075] In this embodiment, it is necessary to create corresponding nodes for sub-controls displayed in the display area. The system displays the sub-controls in the terminal's display area by loading their corresponding nodes. For sub-controls not displayed in the display area, it is neither necessary to create nodes for them nor to load them.
[0076] Step 103: In response to an adjustment operation on the display content in the display area, obtain the second set of sub-controls indicated by the adjustment operation in the display area.
[0077] As mentioned earlier, the child controls displayed in the display area of the target control are not fixed. Users can change the child controls displayed in the display area by performing adjustment operations in order to browse or search for other child controls.
[0078] When an adjustment operation is received from the user in the display area, the display change of the display area caused by the adjustment operation is calculated, and the second set of sub-controls indicated by the adjustment operation in the display area is obtained. That is, the set of sub-controls that should be displayed in the display area after the adjustment operation is calculated.
[0079] In some embodiments, in response to an adjustment operation on the displayed content in the display area, a second set of sub-controls indicated by the adjustment operation in the display area is obtained, including:
[0080] 1. In response to a scrolling operation received in the display area, obtain the displacement of the target control relative to the display area caused by the scrolling operation;
[0081] 2. Determine the set of second child controls corresponding to the target control in the display area after the scrolling operation based on the displacement.
[0082] In this embodiment, the content displayed in the display area can be adjusted by scrolling. Specifically, the content can be scrolled by dragging a scroll bar, by swiping up or down the screen, or by detecting on-screen gestures. Specifically, the on-screen gesture detection method can collect user gesture information from the terminal, determine an up or down scrolling command based on the gesture information, and then scroll the content displayed in the display area according to the command.
[0083] Detailed information about the scrolling operation can be determined by obtaining the displacement data of the scrolling operation. Specifically, the displacement of the target control relative to the display area caused by the scrolling operation can be obtained, where the displacement includes distance and direction information. For example, when the scrolling operation is downward, the target control will move upward relative to the display area. The distance moved can then be determined based on the scrolling distance, and further, the number of child controls that should be hidden above and displayed below can be determined based on the distance moved. That is, the information of the child controls that should be displayed in the display area after the scrolling operation can be calculated, and the information of the child controls that should be displayed in the display area after the scrolling operation constitutes the second set of child controls.
[0084] In some embodiments, determining the set of second sub-controls corresponding to the target control in the display area after a scrolling operation based on displacement includes:
[0085] 2.1. Obtain the range of the first label of the child controls contained in the first child control set;
[0086] 2.2 Obtain the height information of all child controls in the current state of the target control;
[0087] 2.3. Determine the range of the second label of the child controls contained in the display area after the scrolling operation based on the range of the first label, the displacement, and the height information of all child controls;
[0088] 2.4 Determine the set of second child controls based on the range of the second label.
[0089] In this embodiment of the application, under a defined state, a label can be created for each sub-control of the target control. For example, please refer to [link to previous document]. Figure 1AWe can create label 001 for label 1, label 002 for control 2, label 003 for control 3, label 004 for control 4, label 005 for control 41, label 006 for control 42, label 007 for control 43, label 008 for control 44, label 009 for control 45, label 010 for control 46, label 011 for control 47, label 012 for control 5, label 013 for control 6, label 014 for control 7, and label 015 for control 8. In this way, we can determine that the range of the first label for the sub-controls in the first set of sub-controls in the display area before the scrolling operation is 003 to 012.
[0090] Then, you can further obtain the height information of all child controls of the target control in its current state. All child controls can have the same height, for example, all of them can be one unit height, which can be 0.5cm, 1cm, or a height set by the user. Figure 1A As shown, all child controls have the same height. Child controls can also have different heights, such as... Figure 3A The diagram shown illustrates another scenario of the node processing method provided in this application. As shown, controls A, B, and E have a height of two units, while controls B1, B2, and others have a height of one unit. It is understandable that... Figure 3A This is just an example; users can set the height of different controls according to their own needs. For example, they can set it to 1.5 units or 3 units.
[0091] Once the displacement is determined to be a distance of two units upwards, the range of the second label corresponding to the child controls within the display area after the scrolling operation can be further calculated based on the displacement, the height information of all child controls, and the range of the first label. (Continuing with...) Figure 1A Taking the scenario shown as an example, since the displacement is an upward movement of 2 units of height, and the height of each child control is 1 unit of height, the label range should be shifted forward by 2 units, meaning the second label range should be 005 to 014. Finally, based on the second label range, the child controls corresponding to the labels within that range are determined, resulting in the second set of child controls.
[0092] In some embodiments, in response to an adjustment operation on the displayed content in the display area, a second set of sub-controls indicated by the adjustment operation in the display area is obtained, including:
[0093] A. In response to an expansion operation on a target sub-control in the display area, obtain information about the sub-controls contained in the target sub-control;
[0094] B. Determine the set of second child controls corresponding to the target control and the display area after the expansion operation based on the information of the secondary child controls.
[0095] In this embodiment, the content displayed in the display area can be adjusted by clicking on the unexpanded tree control. Specifically, as shown... Figure 3B The diagram illustrates another scenario of the node processing method provided in this application. As shown, the tree control B's child control B1 includes its next-level child controls: controls B11 and B12. When the user clicks on the child control B1 displayed in the display area, it triggers the expansion of the next-level child controls of B1. In response to the expansion operation of this child control, the information of the sub-child controls contained in this child control can be obtained first. Here, the sub-child control information refers to the information of the next-level child controls of this child control. For example, if the next-level child controls of B1 are controls B11 and B12, in the expanded state, controls B11 and B12 are also child controls of the target control. The sub-child control information here includes the number of sub-child controls and the height information of each sub-child control.
[0096] Then, after determining the number of sub-controls and the height of each sub-control, the distance that other sub-controls below it need to move can be calculated. Then, based on this moving distance, the set of second sub-controls that should be included in the display area after the expand operation can be determined.
[0097] In some embodiments, the content displayed in the display area can also be adjusted in response to a collapse operation on the target sub-control. Similar to the expand operation, in response to the trigger command of the collapse operation, it is also necessary to obtain information about the secondary sub-controls contained in the sub-control, and then redetermine the second set of sub-controls that the display interface should include after the collapse operation based on the number and height information of the secondary sub-controls.
[0098] Step 104: Determine the intersection of the first set of child controls and the second set of child controls.
[0099] As mentioned earlier, the first set of sub-controls is the set of sub-controls contained in the display area before the adjustment operation, and the second set of sub-controls is the set of sub-controls contained in the display area after the adjustment operation. In this application, nodes are only created and loaded for sub-controls displayed in the display area; for sub-controls not displayed in the display area, no nodes are created or loaded. Therefore, for sub-controls that change from displayed to hidden due to the adjustment operation, their corresponding nodes need to be recycled; while for sub-controls that change from hidden to displayed due to the adjustment operation, their nodes need to be created and loaded for display.
[0100] In this application, the intersection of the first set of sub-controls and the second set of sub-controls is first determined, and then the sub-controls that are changed from being displayed to being hidden due to the adjustment operation and the sub-controls that are changed from being hidden to being displayed due to the adjustment operation are determined based on the intersection.
[0101] In some cases, such as when the adjustment operation is a scrolling operation, when the scrolling distance is large, the above intersection may be an empty set, that is, all the child controls displayed in the display area before scrolling are hidden due to the scrolling operation.
[0102] Step 105: Store the nodes corresponding to the child controls in the first child control set that do not belong to the intersection into the node pool.
[0103] Since the child controls in the intersection are those that remain displayed in the display area after the adjustment operation, the child controls in the first set that do not belong to the intersection are those that changed from being displayed to being hidden after the adjustment operation. In this embodiment, to further improve the creation efficiency of nodes corresponding to child controls newly displayed in the display area after the adjustment operation, a node pool can be set up for node recycling and reuse. Specifically, the node pool can be a storage space set in the cache of a computer device, and the nodes corresponding to child controls that changed from being displayed to being hidden after the adjustment operation can be stored in the node pool to recycle these nodes. In this way, when it is necessary to create new nodes for other controls, the recycled nodes can be reused, thus improving the generation efficiency of new nodes.
[0104] Step 106: Generate child controls that do not belong to the intersection of the second child control set using the nodes in the updated node pool.
[0105] The second set of sub-controls refers to the set of sub-controls that should be displayed in the display area after the adjustment operation. Sub-controls in the second set that do not overlap are those that changed from hidden to displayed after the adjustment operation. In this embodiment, it is not necessary to create new nodes; nodes can be called from the node pool, and then the nodes corresponding to the newly displayed sub-controls in the display area are generated based on the nodes called from the node pool. Here, the node pool is the updated node pool obtained after recycling the nodes corresponding to the sub-controls that changed from displayed to hidden after the aforementioned adjustment operation. That is, the node pool is updated every time a node is recycled to the node pool, a node is reused, or a new node is generated.
[0106] In some embodiments, generating child controls that do not belong to the intersection of the second child control set using nodes from the updated node pool includes:
[0107] 1. Determine the set of child controls in the second child control set that do not belong to the intersection as the third child control set, and determine the target number of elements contained in the third child control set;
[0108] 2. Obtain the target number of nodes from the updated node pool;
[0109] 3. Generate child controls in the third child control set based on the target number of nodes.
[0110] After storing the nodes corresponding to the child controls in the first child control set that do not belong to the intersection into the node pool, we can first calculate the number of child controls in the second child control set that do not belong to the intersection; that is, first determine the number of child controls that need to be changed from hidden to visible due to the adjustment operation. For example, in... Figure 1A In the scenario shown, when the scrolling operation is to scroll down 3 units of height, 3 controls—control 6, control 7, and control 8—will change from a hidden state to a displayed state in the display area. This indicates that the target number of elements in the third child control set is 3.
[0111] At this point, a certain number of nodes can be retrieved from the updated node pool, and then child controls in the third child control set can be generated based on these nodes. For example, three nodes can be retrieved from the updated node pool, and three child controls can be generated based on these three nodes: control 6, control 7, and control 8.
[0112] In some embodiments, generating child controls in a third child control set based on a target number of nodes includes:
[0113] 3.1. Initialize the target number of nodes to obtain the target number of initialized nodes;
[0114] 3.2 Render the target number of initialized nodes to generate child controls in the third child control set.
[0115] Since the nodes recycled to the node pool contain information related to the atomic controls, when reusing the updated nodes in the node pool to generate nodes corresponding to new child controls, it is necessary to first initialize the nodes retrieved from the node pool. The initialization operation retains the node's framework-related data, including the node's shape, size, and color, while deleting information related to the original control, such as the control name, resulting in multiple initialized nodes, which can also be called template nodes.
[0116] Then, the template nodes obtained after initialization are rendered according to the information of the child controls to be displayed, so as to obtain multiple nodes corresponding to the child controls to be displayed.
[0117] In some embodiments, obtaining a target number of nodes from the updated node pool includes:
[0118] A. Determine the node type of each child control in the third child control set;
[0119] B. Retrieve the nodes corresponding to the node type of each child control from the updated node pool one by one to obtain the target number of nodes.
[0120] In this embodiment, there may be cases where different controls correspond to nodes of different types. For example, in Figure 3A In the scenario shown, the node types corresponding to the nodes of control B and control B1 are different; specifically, the heights of control B and control B1 are different. Therefore, if the node of control B is recycled to the recycling pool, reusing that node will not generate the corresponding node for control B1. Furthermore, in some cases, there may be child controls with different colors, and the node types corresponding to child controls of different colors are also different. In practical applications, only nodes of the same type can be reused.
[0121] Thus, after determining the third set of child controls, the node type of each child control in the third set of child controls is obtained to obtain the node type corresponding to each child control. Then, nodes corresponding to the node type are extracted from the node pool one by one for reuse.
[0122] In some embodiments, obtaining a target number of nodes from the updated node pool includes:
[0123] a. When it is detected that the number of nodes in the updated node pool is not less than the target number, obtain the target number of nodes from the updated node pool;
[0124] b. When it is detected that the number of nodes in the updated node pool is less than the target number, create new nodes in the updated node pool until the number of nodes in the node pool reaches the target number, and then retrieve the target number of nodes from the node pool.
[0125] In this embodiment, there may be a situation where the number of nodes in the node pool is insufficient for reuse. For example, if the number of reclaimed nodes is less than the number of nodes that need to be generated, the aforementioned situation of insufficient node reuse will occur. Specifically, for example, after reclaiming one type A node and two type B nodes, where the height of the type A node is twice the height of the type B node, four type B nodes need to be regenerated. In this case, the number of type B nodes will be insufficient. Therefore, two more type B nodes need to be regenerated to ensure that the corresponding number of new nodes can be generated.
[0126] In some embodiments, when setting up the node pool, all possible scenarios for the display area of the target control can be predicted first, and then the node pool can be set based on the prediction results. For example, assuming there are three types of nodes: A, B, and C, if the display area displays all child controls corresponding to node A, the required number of type A nodes, 'a', can be calculated; if the display area displays all child controls corresponding to node B, the required number of type B nodes, 'b', and if the display area displays all child controls corresponding to node C, the required number of type C nodes, 'c', can be calculated. Thus, 'a' type A nodes, 'b' type B nodes, and 'c' type C nodes can be set in the node pool. This avoids the situation where there are not enough reusable nodes, as regenerating nodes when there are not enough reusable nodes consumes time. Therefore, setting up the node pool in advance using the aforementioned method can improve node reuse efficiency. Since the display area controls are limited, the values of the aforementioned numbers 'a', 'b', and 'c' will not be too large, thus avoiding excessive memory consumption caused by generating nodes for all child controls and improving system operating efficiency.
[0127] As described above, the node processing method provided in this application involves: obtaining the display area of a target control, which includes at least one tree control or list control; determining a first set of child controls contained in the display area; in response to an adjustment operation on the content displayed in the display area, obtaining a second set of child controls indicated by the adjustment operation in the display area; determining the intersection of the first set of child controls and the second set of child controls; storing the nodes corresponding to the child controls in the first set that do not belong to the intersection in a node pool; and generating child controls in the second set that do not belong to the intersection using the nodes in the updated node pool. In this way, by setting a node pool, nodes corresponding to child controls that do not need to be displayed in the display area due to adjustment operations are recycled to the node pool, and nodes are called from the node pool to generate child controls that need to be displayed in the display area after the adjustment operation is triggered. This requires maintaining only a limited number of nodes, greatly reducing the number of nodes needed, reducing memory consumption, and improving system operating efficiency.
[0128] Accordingly, this application will further describe the node processing method provided in this application from the perspective of a computer device, wherein the computer device can be a terminal. For example... Figure 4 The diagram shown is another flowchart illustrating the node processing method provided in this application. The method includes:
[0129] Step 201: The computer device obtains the display area of the target control.
[0130] The target control includes at least one tree control or list control. Specifically, the target control can be a control used in a file management scenario, or a control in an instant messaging client that displays the address book or call list. In this embodiment, a detailed description will be given using a control in an instant messaging client that displays the address book as the target control. Here, the instant messaging client can be the WeChat Work client.
[0131] The instant messaging client's address book interface displays the current client's address book data as a target control. Due to the limited space in the instant messaging client's address book interface, only a portion of the address book data can be displayed. The remaining data is hidden, and users can scroll to reveal the hidden data.
[0132] Currently, when displaying the address book, a node is created for each contact control or contact group control, and all nodes are loaded. As the number of contacts increases, the memory consumed by creating and recording nodes increases significantly, leading to a decrease in the operating efficiency of the instant messaging client when memory usage is excessive. To address this issue, this application proposes a node processing method that creates and loads nodes only for controls displayed on the instant messaging client's interface, while not creating nodes for controls not displayed on the interface. This reduces memory consumption and improves the operating efficiency of the instant messaging client.
[0133] Specifically, in this embodiment, the terminal first acquires the display area to further determine the sub-controls displayed in the display area. Furthermore, during the user's browsing or searching of the address book, the terminal continuously determines the changes in the sub-controls displayed in the display area caused by the browsing or searching operation.
[0134] The terminal acquires the display area, specifically by obtaining the positional relationship between the current display area and each child node in the target control. Specifically, before the target control is displayed in the instant messaging client's address book interface, the terminal can already create a corresponding label for each control using address book data. Please refer to the example below. Figure 3BYou can assign labels 000 to control A, 001 to control B, 0010 to control B11, 00100 to control B12, 00101 to control B2, 0011 to control B3, 0012 to control B4, 0013 to control B5, 0014 to control B6, 0015 to control B7, 0016 to control C, 002 to control D, and 004 to control E. To obtain the display area of the target control, you can retrieve the labels of the first and last controls in the current display area of the target control. Figure 3B In display area 11, the first control is labeled 001, and the last control is labeled 0015. Figure 3B This is just an example. In actual applications, the number of child controls in the target control is far greater than the number in the example. However, you can still create labels and obtain the display area in the same way as the example.
[0135] Step 202: The computer device determines the first set of sub-controls contained in the display area.
[0136] In this process, after labeling all controls in the target control according to the method in step 201 and determining the current state of the target control, the first set of sub-controls contained in the display area can be determined based on the sub-control label information contained in the display area.
[0137] The state of the target control is defined by the expanded or collapsed state of the tree controls contained within it. The state of the target control differs depending on the expanded or collapsed state of the tree control and its child controls at any level. However, at any given moment, the state of the target control is uniquely determined. In this determined state, the terminal can determine the information of the child controls contained within the display area based on their position, thus obtaining the first set of child controls.
[0138] Step 203: In response to a scrolling operation on the content displayed in the display area, the computer device calculates the second set of sub-controls that should be displayed in the display area after the scrolling operation.
[0139] In step 202, the first set of sub-controls obtained is a set of sub-controls contained in the display area before the scrolling operation. The change in the sub-controls displayed in the display area caused by the scrolling operation can be calculated based on the displacement of the target control relative to the display area caused by the scrolling operation and the size information of each sub-control.
[0140] Specifically, first, the direction and distance of movement of the target control relative to the display area caused by the scrolling operation are obtained. Then, the number of moved child controls is calculated based on the movement distance and the height of each child control. Finally, based on the label information of each child control established above, the label information corresponding to each child control in the display area after the scrolling operation is determined, thereby determining the second set of child controls that should be displayed in the display area after the scrolling operation.
[0141] Step 204: The computer device determines the intersection of the first set of sub-controls and the second set of sub-controls.
[0142] After determining the first set of child controls contained in the display area before the scrolling operation and the second set of child controls that should be displayed in the display area after the scrolling operation, the terminal further determines the intersection of the first and second child control sets. The elements in this intersection are the child controls that are in the display area both before and after scrolling. Of course, this intersection may also be an empty set.
[0143] Step 205: The computer device stores the nodes corresponding to the child controls in the first set of child controls that do not belong to the intersection into the node pool.
[0144] Once the intersection of the first set of child controls and the second set of child controls is determined, the child controls in the first set that do not belong to the intersection can be identified as those hidden due to scrolling. These child controls are then recycled back into a pre-defined node pool by the computer device.
[0145] Step 206: The computer device determines the third set of sub-controls that do not belong to the intersection of the second set of sub-controls.
[0146] After determining the intersection of the first and second child control sets, it can be identified that the child controls in the second child control set that do not belong to the intersection are those that need to be changed from a hidden state to a visible state. These child controls constitute the third child control set. Here, "hidden state" does not mean that the child control is obscured; it simply indicates that the child control was originally invisible and should be displayed in the display area after scrolling. Then, the target number of elements in the third child control set can be further determined.
[0147] Step 207: The computer device extracts the target number of nodes from the node pool to generate child controls in the third child control set.
[0148] Once the target number of child controls to be added to the display area is determined, the target number of nodes can be extracted from the node pool, these nodes can be initialized, and then further rendered to obtain the target number of child controls to be added.
[0149] Step 208: The computer device displays the sub-controls from the third set of sub-controls in the display area.
[0150] After identifying the sub-controls that should be changed from a visible to a hidden state and the sub-controls that should be changed from a hidden to a visible state, the computer device scrolls the sub-controls displayed in the address book display interface of the instant messaging client according to the above scrolling operation. Sub-controls that should be changed from a visible to a hidden state are deleted, and new sub-controls that should be changed from a hidden to a visible state are added. When the scrolling operation is downward, the newly displayed sub-controls should appear below the display area; when the scrolling operation is upward, the newly displayed sub-controls should appear above the display area. The display order of the sub-controls can follow the order in which the labels were created.
[0151] As described above, the node processing method provided in this application involves: obtaining the display area of a target control, which includes at least one tree control or list control; determining a first set of child controls contained in the display area; in response to an adjustment operation on the content displayed in the display area, obtaining a second set of child controls indicated by the adjustment operation in the display area; determining the intersection of the first set of child controls and the second set of child controls; storing the nodes corresponding to the child controls in the first set that do not belong to the intersection in a node pool; and generating child controls in the second set that do not belong to the intersection using the nodes in the updated node pool. In this way, by setting a node pool, nodes corresponding to child controls that do not need to be displayed in the display area due to adjustment operations are recycled to the node pool, and nodes are called from the node pool to generate child controls that need to be displayed in the display area after the adjustment operation is triggered. This requires maintaining only a limited number of nodes, greatly reducing the number of nodes needed, reducing memory consumption, and improving system operating efficiency.
[0152] To better implement the above methods, embodiments of the present invention also provide a node processing device that can be integrated into a server.
[0153] For example, such as Figure 5 The diagram shown is a schematic representation of the node processing device provided in an embodiment of this application. The node processing device may include a first acquisition unit 301, a first determination unit 302, a second acquisition unit 303, a second determination unit 304, a storage unit 305, and a generation unit 306, as follows:
[0154] The first acquisition unit 301 is used to acquire the display area of the target control, which includes at least one tree control or list control.
[0155] The first determining unit 302 is used to determine the first set of sub-controls contained in the display area;
[0156] The second acquisition unit 303 is used to acquire a set of second sub-controls indicated by the adjustment operation in the display area in response to the adjustment operation of the display content in the display area;
[0157] The second determining unit 304 is used to determine the intersection of the first set of sub-controls and the second set of sub-controls;
[0158] Storage unit 305 is used to store the nodes corresponding to the child controls that do not belong to the intersection in the first child control set into the node pool;
[0159] The generation unit 306 is used to generate a third set of sub-controls that do not belong to the intersection of the second set of sub-controls by using the nodes in the updated node pool.
[0160] In some embodiments, the second acquisition unit includes:
[0161] The first acquisition subunit is used to respond to a scrolling operation received in the display area and acquire the displacement of the target control relative to the display area caused by the scrolling operation;
[0162] The first determining sub-unit is used to determine the set of second sub-controls corresponding to the target control in the display area after the scrolling operation, based on the displacement.
[0163] In some embodiments, the first determining subunit includes:
[0164] The first acquisition module is used to acquire the first label range of the child controls in the first child control set;
[0165] The second acquisition module is used to acquire the height information of all child controls of the target control in its current state.
[0166] The first determining module is used to determine the second label range of the sub-controls contained in the display area after the scrolling operation based on the first label range, displacement, and height information of all sub-controls;
[0167] The second determining module is used to determine the second set of sub-controls based on the range of the second label.
[0168] In some embodiments, the second acquisition unit includes:
[0169] The second acquisition sub-unit is used to acquire information about the secondary sub-controls contained in the target sub-control in response to an expansion operation of the target sub-control in the display area.
[0170] The second determining sub-unit is used to determine the set of second sub-controls corresponding to the display area after the expansion operation, based on the information of the secondary sub-controls.
[0171] In some embodiments, the generating unit includes:
[0172] The third determining sub-unit is used to determine the set of sub-controls in the second sub-control set that do not belong to the intersection as the third sub-control set, and to determine the target number of elements contained in the third sub-control set;
[0173] The third acquisition subunit is used to acquire the target number of nodes from the updated node pool;
[0174] Generate sub-units, used to generate a third set of sub-controls based on the target number of nodes.
[0175] In some embodiments, generating a subunit includes:
[0176] The initialization module is used to initialize the target number of nodes, resulting in the target number of initialized nodes;
[0177] The rendering module is used to render the target number of initialized nodes and generate a third set of child controls.
[0178] In some embodiments, the third acquisition subunit includes:
[0179] The third determination module is used to determine the node type of each sub-control in the third sub-control set;
[0180] The third acquisition module is used to retrieve nodes corresponding to the node type of each child control from the updated node pool one by one, to obtain the target number of nodes.
[0181] In some embodiments, the third acquisition subunit includes:
[0182] The fourth acquisition module is used to acquire the target number of nodes from the updated node pool when the number of nodes in the updated node pool is not less than the target number.
[0183] The module is used to create new nodes in the updated node pool when the number of nodes in the updated node pool is less than the target number, until the number of nodes in the node pool reaches the target number, and to retrieve the target number of nodes from the node pool.
[0184] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0185] As described above, the node processing method provided in this application involves: a first acquisition unit 301 acquiring the display area of a target control, the target control including at least one tree control or list control; a first determination unit 302 determining a first set of sub-controls contained in the display area; in response to an adjustment operation on the display content in the display area, a second acquisition unit 303 acquiring a second set of sub-controls indicated by the adjustment operation in the display area; a second determination unit 304 determining the intersection of the first set of sub-controls and the second set of sub-controls; a storage unit 305 storing the nodes corresponding to the sub-controls in the first set that do not belong to the intersection into a node pool; and a generation unit 306 generating sub-controls in the second set that do not belong to the intersection using the nodes in the updated node pool. Thus, by setting a node pool, nodes corresponding to sub-controls that do not need to be displayed in the display area due to adjustment operations are recycled to the node pool, and nodes are called from the node pool to generate sub-controls that need to be displayed in the display area triggered by the adjustment operation. This requires maintaining only a limited number of nodes, greatly reducing the number of required nodes, reducing memory consumption, and improving system operating efficiency.
[0186] This application also provides a computer device, which can be a terminal, such as... Figure 6 As shown, the terminal may include a radio frequency (RF) circuit 401, a memory 402 including one or more computer-readable storage media, an input unit 403, a display unit 404, a sensor 405, an audio circuit 406, a wireless Fidelity (WiFi) module 407, a processor 408 including one or more processing cores, and a power supply 409, among other components. Those skilled in the art will understand that... Figure 6 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0187] RF circuit 401 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 408 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 401 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 401 can also communicate wirelessly with networks and other devices. Wireless communication can use any communication standard or protocol, including but not limited to GSM, GPRS, CDMA, WCDMA, LTE, email, and SMS.
[0188] The memory 402 can be used to store software programs and modules. The processor 408 executes various functional applications and information interactions by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal (such as audio data, phone book, etc.). In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide access to the memory 402 for the processor 408 and the input unit 403.
[0189] Input unit 403 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, in one embodiment, input unit 403 may include a touch-sensitive surface and other input devices. A touch-sensitive surface, also known as a touch display or touchpad, can collect user touch operations on or near it (e.g., user operations using fingers, styluses, or any suitable object or accessory on or near the touch-sensitive surface) and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. The touch detection device detects the user's touch orientation and the signal generated by the touch operation, transmitting the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 408, and can receive and execute commands from the processor 408. Furthermore, various types of touch-sensitive surfaces, such as resistive, capacitive, infrared, and surface acoustic wave, can be used. In addition to the touch-sensitive surface, input unit 403 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0190] Display unit 404 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the terminal. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 404 may include a display panel, optionally configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Furthermore, a touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it transmits the information to processor 408 to determine the type of touch event. Subsequently, processor 408 provides corresponding visual output on the display panel according to the type of touch event. Although in Figure 6 In this context, the touch-sensitive surface and the display panel are two separate components for implementing input and output functions. However, in some embodiments, the touch-sensitive surface and the display panel can be integrated to achieve both input and output functions.
[0191] The terminal may also include at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel according to the ambient light level, and the proximity sensor can turn off the display panel and / or backlight when the terminal is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that the terminal may also be equipped with, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0192] Audio circuitry 406, a speaker, and a microphone provide an audio interface between the user and the terminal. Audio circuitry 406 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 406, converted back into audio data, and processed by processor 408. The processed data is then transmitted via RF circuitry 401 to, for example, another terminal, or output to memory 402 for further processing. Audio circuitry 406 may also include an earphone jack to facilitate communication between a peripheral headset and the terminal.
[0193] WiFi is a short-range wireless transmission technology. Terminals using the WiFi module 407 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6 WiFi module 407 is shown, but it is understood that it is not a necessary component of the terminal and can be omitted as needed without changing the essence of the invention.
[0194] The processor 408 is the control center of the terminal, connecting various parts of the phone via various interfaces and lines. It executes software programs and / or modules stored in the memory 402, and calls data stored in the memory 402 to perform various functions and process data, thereby performing overall detection of the phone. Optionally, the processor 408 may include one or more processing cores; preferably, the processor 408 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 408.
[0195] The terminal also includes a power supply 409 (such as a battery) to power various components. Preferably, the power supply can be logically connected to the processor 408 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 409 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0196] Although not shown, the terminal may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 408 in the terminal will load the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 408 will run the applications stored in the memory 402 to realize various functions:
[0197] Obtain the display area of the target control, which includes at least one tree control or list control; determine the first set of child controls contained in the display area; in response to an adjustment operation on the display content in the display area, obtain the second set of child controls indicated by the adjustment operation in the display area; determine the intersection of the first set of child controls and the second set of child controls; store the nodes corresponding to the child controls in the first set that do not belong to the intersection into a node pool; generate the child controls in the second set that do not belong to the intersection using the nodes in the updated node pool.
[0198] It should be noted that the computer device provided in this application embodiment and the method in the above embodiment belong to the same concept. The specific implementation of each of the above operations can be found in the previous embodiments, and will not be repeated here.
[0199] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0200] Therefore, embodiments of the present invention provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:
[0201] Obtain the display area of the target control, which includes at least one tree control or list control; determine the first set of child controls contained in the display area; in response to an adjustment operation on the display content in the display area, obtain the second set of child controls indicated by the adjustment operation in the display area; determine the intersection of the first set of child controls and the second set of child controls; store the nodes corresponding to the child controls in the first set that do not belong to the intersection into a node pool; generate the child controls in the second set that do not belong to the intersection using the nodes in the updated node pool.
[0202] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0203] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0204] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the methods provided in the embodiments of the present invention, the beneficial effects that any of the methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0205] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a storage medium. A processor of a computer device reads the computer instructions from the storage medium and executes the computer instructions, causing the computer device to perform the aforementioned actions. Figure 2 or Figure 4 The methods provided in various optional implementations.
[0206] The present invention has provided a detailed description of a node processing method, apparatus, computer-readable storage medium, and computer device. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A node processing method, characterized in that, The method includes: Obtain the display area of the target control, wherein the target control includes at least one tree control or list control; Determine the first set of sub-controls contained in the display area; In response to an adjustment operation on the displayed content in the display area, a second set of sub-controls indicated by the adjustment operation in the display area is obtained; Determine the intersection of the first set of sub-controls and the second set of sub-controls; Store the nodes corresponding to the sub-controls in the first set of sub-controls that do not belong to the intersection into the node pool; Generating child controls that do not belong to the intersection of the second child control set by using nodes in the updated node pool includes: determining the set of child controls that do not belong to the intersection of the second child control set as a third child control set, and determining the target number of elements contained in the third child control set; obtaining the target number of nodes from the updated node pool; and generating child controls in the third child control set based on the target number of nodes.
2. The method according to claim 1, characterized in that, The step of obtaining a set of second sub-controls indicated by the adjustment operation in the display area in response to an adjustment operation on the display content in the display area includes: In response to a scrolling operation received in the display area, the displacement of the target control relative to the display area caused by the scrolling operation is obtained; The second set of sub-controls corresponding to the display area after the scrolling operation is determined based on the displacement.
3. The method according to claim 2, characterized in that, The step of determining the second set of sub-controls corresponding to the display area after the scrolling operation based on the displacement includes: Get the first label range of the child controls contained in the first child control set; Obtain the height information of all child controls in the current state of the target control; The second label range of the sub-controls included in the display area after the scrolling operation is determined based on the first label range, the displacement, and the height information of all sub-controls; The second set of sub-controls is determined based on the range of the second label.
4. The method according to claim 1, characterized in that, The step of obtaining a set of second sub-controls indicated by the adjustment operation in the display area in response to an adjustment operation on the display content in the display area includes: In response to an expansion operation on a target sub-control in the display area, information about the secondary sub-controls contained in the target sub-control is obtained; Based on the secondary sub-control information, determine the second set of sub-controls corresponding to the target control and the display area after the expansion operation.
5. The method according to claim 1, characterized in that, The step of generating the sub-controls in the third sub-control set based on the target number of nodes includes: Initialize the target number of nodes to obtain the target number of initialized nodes; Render the target number of initialized nodes to generate the child controls in the third child control set.
6. The method according to claim 1, characterized in that, Obtaining the target number of nodes from the updated node pool includes: Determine the node type of each sub-control in the third sub-control set; The target number of nodes is obtained by retrieving the nodes corresponding to the node type of each child control one by one from the updated node pool.
7. The method according to claim 1, characterized in that, Obtaining the target number of nodes from the updated node pool includes: When it is detected that the number of nodes in the updated node pool is not less than the target number, the target number of nodes are obtained from the updated node pool; When it is detected that the number of nodes in the updated node pool is less than the target number, new nodes are created in the updated node pool until the number of nodes in the node pool reaches the target number, and the target number of nodes are obtained from the node pool.
8. A node processing device, characterized in that, The device includes: The first acquisition unit is used to acquire the display area of the target control, wherein the target control includes at least one tree control or list control; The first determining unit is used to determine the first set of sub-controls contained in the display area; The second acquisition unit is configured to acquire a set of second sub-controls indicated by the adjustment operation in the display area in response to an adjustment operation on the display content in the display area; The second determining unit is used to determine the intersection of the first set of sub-controls and the second set of sub-controls; A storage unit is used to store the nodes corresponding to the sub-controls in the first set of sub-controls that do not belong to the intersection into the node pool; A generation unit is used to generate sub-controls in the second set of sub-controls that do not belong to the intersection using nodes in the updated node pool; The generation unit includes: The third determining sub-unit is used to determine the set of sub-controls in the second set of sub-controls that does not belong to the intersection as the third set of sub-controls, and to determine the target number of elements contained in the third set of sub-controls; The third acquisition subunit is used to acquire the target number of nodes from the updated node pool; A sub-unit is generated to generate sub-controls in the third sub-control set based on the target number of nodes.
9. The apparatus according to claim 8, characterized in that, The second acquisition unit includes: The first acquisition subunit is configured to, in response to a scrolling operation received in the display area, acquire the displacement of the target control relative to the display area caused by the scrolling operation; The first determining sub-unit is used to determine, based on the displacement, the second set of sub-controls corresponding to the display area after the target control has undergone the scrolling operation.
10. The apparatus according to claim 9, characterized in that, The first determining subunit includes: The first acquisition module is used to acquire the first label range of the sub-controls contained in the first sub-control set; The second acquisition module is used to acquire the height information of all child controls of the target control in the current state. The first determining module is used to determine the second label range of the sub-controls included in the display area after the scrolling operation based on the first label range, the displacement, and the height information of all sub-controls; The second determining module is used to determine the second set of sub-controls based on the second label range.
11. The apparatus according to claim 8, characterized in that, The second acquisition unit includes: The second acquisition subunit is used to acquire information about the secondary sub-controls contained in the target sub-control in response to an expansion operation of the target sub-control in the display area. The second determining sub-unit is used to determine, based on the secondary sub-control information, the second set of sub-controls corresponding to the target control and the display area after the expansion operation.
12. The apparatus according to claim 8, characterized in that, The generating subunit includes: An initialization module is used to initialize the target number of nodes to obtain the target number of initialized nodes; The rendering module is used to render the target number of initialized nodes and generate the sub-controls in the third sub-control set.
13. The apparatus according to claim 8, characterized in that, The third acquisition subunit includes: The third determining module is used to determine the node type of each sub-control in the third sub-control set; The third acquisition module is used to acquire nodes corresponding to the node type of each sub-control one by one from the updated node pool to obtain the target number of nodes.
14. The apparatus according to claim 8, characterized in that, The third acquisition subunit includes: The fourth acquisition module is used to acquire the target number of nodes from the updated node pool when it is detected that the number of nodes in the updated node pool is not less than the target number; A creation module is configured to create new nodes in the updated node pool when the number of nodes in the updated node pool is less than the target number, until the number of nodes in the node pool reaches the target number, and to obtain the target number of nodes from the node pool.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the node processing method according to any one of claims 1 to 7.
16. A computer device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the node processing method according to any one of claims 1 to 7.
17. A computer program, characterized in that, The computer program includes computer instructions stored in a storage medium. A processor of a computer device reads the computer instructions from the storage medium and executes the computer instructions, causing the computer device to perform the steps of the node processing method according to any one of claims 1 to 7.
18. A computer program product, characterized in that, The computer program product includes computer instructions stored in a storage medium; the processor of the computer device reads the computer instructions from the storage medium and executes the computer instructions, causing the computer device to perform the steps of the node processing method according to any one of claims 1 to 7.