A menu display method, system, device, medium and product
By dynamically rendering the file directory tree and managing events, the file type identification and interface display logic are decoupled, enabling precise binding of menu content and improved scalability. This solves the problem of poor scalability in existing technologies and improves the interactive efficiency and system usability of menu display.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTH SURVEYING & MAPPING INSTR
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-26
AI Technical Summary
In existing technologies, the file type identification logic, menu content definition logic, and interface control display/triggering logic are highly coupled, resulting in poor scalability and high maintenance costs.
The interface management component responds to user operations, dynamically renders the file directory tree using a mapping table, and the event management component broadcasts operation event messages to the menu component. The menu component matches the file type identifier to display the menu, achieving precise binding between menu content and file type. The mapping and listener table are dynamically updated through file and listener registration interfaces, supporting the immediate inclusion of new file types.
It improves the smoothness and scalability of menu display interaction, reduces response latency and resource consumption, enhances the accuracy of context matching of menu content and the efficiency of interface updates, and supports adding or deleting file types without restarting the application.
Smart Images

Figure CN122285149A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer software technology, and in particular to a menu display method, system, device, medium, and product. Background Technology
[0002] In modern computer-aided design (CAD) and other complex software systems, differentiated right-click context menus can be provided for different types of data files (such as DWG drawings, point clouds, 3D models, images, etc.) to meet the key needs of improving data management efficiency and user experience.
[0003] Currently, tree controls (such as TreeView) are used in software interfaces to organize and manage file directories. This involves pre-creating corresponding tree node items for each file type and hard-coding a dedicated right-click menu for each item. When a user clicks on a tree node, the system determines the node type and invokes the associated menu for display.
[0004] However, this approach tightly couples file type identification, menu content definition, and menu display triggering logic into the implementation code of the interface controls, resulting in poor scalability and high maintenance costs. Summary of the Invention
[0005] This invention provides a menu display method, system, device, medium, and product that can solve the problem of poor scalability caused by the high coupling between file type identification logic, menu content definition logic, and interface control display / triggering logic.
[0006] This invention provides a menu display method applied to a menu display system, wherein the menu display system includes an interface management component, a file management component, an event management component, and multiple first menu components, and the menu display method includes: The interface management component responds to the user's operation instructions on the file directory tree and determines the target file type identifier corresponding to the operation instruction according to the mapping table in the file management component. The file directory tree is dynamically rendered according to the mapping table. The interface management component determines the operation event message based on the target file type identifier and sends the operation event message to the event management component. The event management component obtains the listening registry in the file management component, and broadcasts the operation event message to all the first menu components according to the listening registry. The listening registry is used to identify the first menu components that have registered for listening in the file management component. Each of the first menu components responds to the operation event message by matching the preset association type identifier with the target file type identifier. If a match is found, the menu information of the first menu component is sent to the interface management component. If no match is found, the operation event message is ignored. The interface management component renders the menu information as a context menu in the graphical user interface to achieve dynamic display of the menu.
[0007] This invention addresses user operation commands through an interface management component, enabling real-time capture of user interactions, low response latency, and improved interaction smoothness. It dynamically renders a file directory tree based on a mapping table, decoupling type definition from interface rendering. The directory structure automatically refreshes as data types expand, improving expansion efficiency when adding new file types and enhancing interface update efficiency. Operation event messages are determined based on the target file type identifier, with precise event semantic encoding, improving message routing accuracy. The event management component broadcasts the event to the first menu component in the listening registry, centralizing menu triggering logic and eliminating direct dependencies between interface and menu components, reducing coupling between components. Through matching associated type identifiers with the first menu component, menu content definitions are autonomously managed, increasing cohesion among menu components, improving code reusability, and precisely filtering menu trigger conditions, eliminating irrelevant menus and reducing resource consumption. Upon successful matching, menu information is sent, precisely binding menu content to file types and improving context matching accuracy. The interface management component renders the menu as a context menu, with the menu display position precisely aligned with the operation context, shortening the user operation path and improving interaction efficiency.
[0008] Furthermore, the menu display method also includes: adding the second correspondence of the second file type to the mapping table by calling the file registration interface of the file management component, so as to realize the dynamic updating of the mapping table.
[0009] By calling the file registration interface, the latency of the interface call is reduced, and the type registration takes effect in real time; the second correspondence is added to the mapping table, the capacity of the mapping table is dynamically expanded, and new file types are immediately included in the directory tree rendering data source; by dynamically updating the mapping table, adding or deleting file types at runtime does not require restarting the application, thus improving system availability.
[0010] Furthermore, the menu display method also includes: adding the second menu component and its association type identifier to the listening registry by calling the listening registration interface of the file management component, so as to realize the dynamic updating of the listening registry.
[0011] By calling the listener registration interface, the registration latency of menu components is reduced, and the listening relationship is established in real time. The second menu component and its associated type identifier are added to the listener registry, and the capacity of the listener registry is dynamically expanded. New menu components are immediately included in the event broadcast scope. By dynamically updating the listener registry, adding or deleting menu components at runtime does not require restarting the application, thus improving system availability.
[0012] Furthermore, the interface management component obtains the user's operation instructions on the file directory tree, specifically as follows: The interface management component obtains the mapping table in the file management component by calling the first acquisition interface of the file management component. The mapping table is used to represent the first correspondence between the type identifier and the type name of the first file type. The interface management component dynamically renders the file directory tree on the graphical user interface based on all type names in the mapping table.
[0013] By calling the first retrieval interface to obtain the mapping table, the data retrieval latency is reduced, and the data source for directory tree rendering is ready immediately. The mapping table is designed to represent the correspondence between type identifiers and type names, so the data relationship is clear and the rendering logic is accurate. The file directory tree is dynamically rendered based on all type names, and the directory tree nodes correspond one-to-one with the file types, which improves the rendering accuracy and ensures that the visual presentation is completely synchronized with the data structure.
[0014] Furthermore, the interface management component queries the mapping table to obtain the target file type identifier corresponding to the operation instruction, specifically: The interface management component determines the operation node corresponding to the operation instruction in the file directory tree; Obtain the target file type name corresponding to the operation node, and query the target file type identifier in the mapping table based on the target file type name.
[0015] By identifying the operation node corresponding to the operation instruction, the user operation is accurately located to the tree structure node, improving the positioning accuracy; by obtaining the target file type name corresponding to the operation node, the type name extraction efficiency is high and the semantic information is completely preserved; by querying the target file type identifier in the mapping table, the identifier query time complexity is reduced and the query efficiency is maximized.
[0016] Furthermore, the first menu component is an instance of a menu implementation class, and the menu implementation class inherits from a preset event response base class.
[0017] In this way, the first menu component is an instance of the menu implementation class, which is object-oriented encapsulation, improving code reusability and reducing maintenance costs; the menu implementation class inherits from the event response base class, the event response interface is standardized, the efficiency of polymorphic dispatch is improved, and the amount of code to write is reduced when extending new menu types.
[0018] Another embodiment of the present invention provides a menu display system, including: an interface management component, a file management component, an event management component, and a plurality of first menu components; The interface management component is used to respond to user operation instructions on the file directory tree, and determine the target file type identifier corresponding to the operation instruction according to the mapping table in the file management component, wherein the file directory tree is dynamically rendered according to the mapping table; The interface management component is further configured to determine the operation event message based on the target file type identifier, and send the operation event message to the event management component; The event management component is used to obtain the listening registry in the file management component and broadcast the operation event message to all the first menu components according to the listening registry, wherein the listening registry is used to identify the first menu components that have registered for listening in the file management component; Each of the first menu components is used to respond to the operation event message by matching a preset association type identifier with the target file type identifier. If a match is found, the menu information of the first menu component is sent to the interface management component. If no match is found, the operation event message is ignored. The interface management component is also used to render the menu information as a context menu in the graphical user interface to achieve dynamic display of the menu.
[0019] Another embodiment of the present invention provides a terminal device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the steps of the menu display method of the present invention.
[0020] Another embodiment of the present invention provides a computer-readable storage medium item, including: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to perform steps such as the menu display method of the present invention.
[0021] Another embodiment of the present invention also provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the menu display method as described in any one of the first aspects. Attached Figure Description
[0022] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating a menu display method provided in an embodiment of the present invention; Figure 2 This is a flowchart illustrating a menu display method combined with the menu display system provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a file directory tree provided in an embodiment of the present invention; Figure 4 This is a rendering diagram of a menu component instance provided in an embodiment of the present invention; Figure 5 This is a point cloud item right-click menu display page provided in an embodiment of the present invention; Figure 6 This is a model item right-click menu display page provided in an embodiment of the present invention; Figure 7 This is a right-click menu display page for image items provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the structure of a menu display system provided in an embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0026] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0027] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0028] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0029] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0030] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0031] See Figure 1 To address the problem of poor scalability caused by the high coupling between file type identification logic, menu content definition logic, and interface control display / triggering logic in existing technologies, an embodiment of the present invention provides a menu display method applied to a menu display system. The menu display system includes an interface management component, a file management component, an event management component, and multiple first menu components. The menu display method includes: Step S101: In response to the user's operation command on the file directory tree, the interface management component determines the target file type identifier corresponding to the operation command according to the mapping table in the file management component, wherein the file directory tree is dynamically rendered according to the mapping table.
[0032] In this embodiment, as Figure 2 The diagram shown is a flowchart illustrating the menu display method in conjunction with the menu display system. Figure 3 The diagram illustrates a file directory tree. The interface management component captures user interactions on the graphical user interface and identifies the specific element within the file directory structure affected by those interactions. By querying the type definition dataset maintained by the file management component, the specific element is mapped to a uniquely identified file type identifier within the system. The file directory structure is automatically constructed and generated by the interface management component at runtime based on the type information contained in the type definition dataset, rather than being a pre-coded static structure.
[0033] Specifically, the interface management component configures user interaction event listening logic for the file directory navigation structure. When a specific user operation (such as a single click, right-click, or double-click) is detected on the navigation structure, the interface management component performs the following processing: determining the operation context, which identifies the navigation node affected by the operation and obtains the file identification information associated with that node (such as the node's displayed text); querying the file type, which, based on the file identification information, obtains the corresponding internal system file type identifier by calling the type query interface provided by the file management service; and encapsulating and sending the event, which encapsulates the type of the operation (such as a right-click), the obtained file type identifier, and the relevant operation context information (such as file path and node level) into a structured event message. Subsequently, the event message is submitted to the event distribution service for unified distribution by calling the corresponding event sending interface provided by the event distribution service. Through the above process, the interface management component is only responsible for capturing the original interaction, collecting context information, and triggering event notifications, while the subsequent event distribution and specific functional response logic are completely handled by the event distribution service and the registered functional modules, thereby achieving decoupling between the user interface and the specific functional logic.
[0034] For example, an input device key identifier system can be defined, which uses discrete numerical identifiers to uniquely distinguish different key operations triggered by the user on the input device. The system includes at least the following key identifiers and their corresponding meanings: identifier 0 represents the left-click operation of the input device; identifier 1 represents the middle-click operation; and identifier 2 represents the right-click operation. Optionally, the input device can be a mouse, touchpad, or a pointing device with similar key functionality. The key identifier system can be implemented in the system using any of the following methods: enumeration type, constant definition table, or event parameter mapping table.
[0035] Step S102: The interface management component determines the operation event message based on the target file type identifier and sends the operation event message to the event management component.
[0036] In this embodiment, the interface management component constructs a structured notification message based on the determined file type identifier. This notification message encapsulates at least the file type identifier and the attribute information of the interaction action (such as click type). Subsequently, the interface management component transmits this notification message to the central component in the system responsible for coordinating event distribution.
[0037] For example, a file type identification system can be defined, which uses discrete numerical identifiers to uniquely distinguish different types of files. The system includes at least the following type identifiers and their corresponding meanings: Identifier-1 represents a file of unknown type; Identifier 0 represents engineering drawing files containing DWG and DXF formats; Identifier 1 represents TIFF format image files; Identifier 2 represents point cloud data files; Identifier 3 represents 3D model files; and Identifier 4 represents model files constructed based on TIFF images. Optionally, the file type identification system can be implemented in the system through any of the following methods: enumerating types, using a constant definition table, or a configuration mapping table.
[0038] Step S103: Obtain the listening registry in the file management component through the event management component, and broadcast the operation event message to all first menu components according to the listening registry, wherein the listening registry is used to identify the first menu components that have registered for listening in the file management component.
[0039] In this embodiment, after receiving the notification message, the event management component obtains a set of registration information for all menu components currently declared to the system from the file management component. Based on this set of registration information, the event management component concurrently sends the notification message in a uniform format to each menu component recorded in the set. For example, an event distribution service is defined, which provides unified sending and broadcasting functions for various file operation events. The service provides at least the following event sending interfaces: a file open event sending interface, used to broadcast the event and related context information, including the file type identifier and file path information, when a file open operation occurs; a file close event sending interface, used to broadcast the event and related context information, including the file type identifier and file path information, when a file close operation occurs; a file display status setting event sending interface, used to broadcast the event and related context information, including the file type identifier, file path information, and target display status identifier, when a file display status change operation occurs; a file click event sending interface, used to broadcast the event and related context information, including the key identifier that triggered the operation, the file type identifier, the file's hierarchy information in the directory structure, and the file path information, when a file is clicked; and a file double-click event sending interface, used to broadcast the event and related context information, including the key identifier that triggered the operation, the file type identifier, the file's hierarchy information in the directory structure, and the file path information, when a file is double-clicked. When any event sending interface of the service is invoked, the service sends or broadcasts the event and related context information in a uniform format to all registered menu components that conform to the event response interface specification. Optionally, the event distribution service is implemented in the system in any of the following forms: singleton pattern, message bus, event center, or publish-subscribe pattern.
[0040] Step S104: Each of the first menu components responds to the operation event message by matching the preset association type identifier with the target file type identifier. If a match is found, the menu information of the first menu component is sent to the interface management component. If no match is found, the operation event message is ignored.
[0041] In this embodiment, upon receiving the notification message, each registered menu component extracts the file type identifier. Each menu component has one or more preset file type identifiers it is interested in. The identifier in the message is compared with its preset identifiers: if a match is found, the menu component determines itself as the responder of the current interaction, generates corresponding interactive interface data, and returns it to the interface management component; if no match is found, the menu component ignores the message and does not respond.
[0042] Step S105: Render the menu information as a context menu in the graphical user interface through the interface management component to achieve dynamic display of the menu.
[0043] In this embodiment, as Figure 4 The diagram illustrates the rendering of a menu component instance. After receiving interactive interface data from the menu component, the interface management component parses the data to obtain the menu's constituent elements and layout information. Subsequently, based on the position coordinates of the interaction, the interface management component dynamically generates and presents a temporary user interface at the corresponding location in the graphical user interface. This interface provides a series of selectable menu items, the content and layout of which are dynamically determined by the interactive interface data, thus achieving a menu display that matches the current operating context and file type.
[0044] As an example of an embodiment of the present invention, the menu display method further includes: adding the second correspondence of the second file type to the mapping table by calling the file registration interface of the file management component, so as to realize the dynamic updating of the mapping table.
[0045] In this embodiment, a centralized service for managing file type definitions is provided. This service exposes a file registration interface. When software needs to support a new file format, it can call this interface to submit the identification information of the new file format and its logical type identifier in the system. Upon receiving the request, the centralized service stores the mapping relationship in an internally maintained mapping table that associates file formats with logical types. This process does not require modification of any execution code in the existing user interface, event handling, or menu components, thus enabling runtime dynamic expansion of the system's supported file type set. For example, to support "point cloud" type files, the user-visible name "point cloud" and internal type identifier "2" can be submitted; to support "model" type files, the user-visible name "model" and internal type identifier "3" can be submitted. The user-visible name will subsequently be used as a node label in the file navigation structure of the graphical user interface.
[0046] Furthermore, the file management service provides the following functional interfaces: a file registration interface, used to receive externally submitted file identification information and corresponding file type identifiers, and store this correspondence in an internally maintained mapping table; a file query interface, used to query and return the corresponding file type identifier from the mapping table based on the received file identification information; and a table access interface, used to provide access to the mapping table. The mapping table is used to persistently store the mapping relationship between file identification information and file type identifiers.
[0047] As an example of an embodiment of the present invention, the menu display method further includes: adding the second menu component and the association type identifier of the second menu component to the listening registry by calling the listening registration interface of the file management component, so as to realize the dynamic updating of the listening registry.
[0048] In this embodiment, a registration service for dynamic integration of menu components is provided. This service publicly exposes a module registration function interface. When a developer provides a dedicated interactive menu component for a new file type, they can submit an instance reference of the menu component and its associated file type identifier by calling this function interface. Upon receiving the request, the registration service records the association between the instance reference and the type identifier in an internally maintained registration information database used to manage all available menu components. This process allows new menu components to be instantly integrated into the system's response system without interrupting system operation or modifying core process code such as event dispatching and interface presentation, thus achieving runtime dynamic mounting and expansion of system menu components.
[0049] Furthermore, the file management service also provides the following functional interfaces: a listener registration interface, used to receive menu component instances conforming to the event response interface specification and record them in the internally maintained response module registration information set; and a listener deregistration interface, used to remove specified menu component instances from the response module registration information set. The response module registration information set records all menu components currently registered with the system for responding to file operation events. Optionally, the file management service is provided in the system in the form of a singleton, a global service object, or a dependency injection component.
[0050] As an example of an embodiment of the present invention, the interface management component obtains the user's operation instructions for the file directory tree by: the interface management component obtaining the mapping table in the file management component by calling the first acquisition interface of the file management component, the mapping table being used to represent the first correspondence between the type identifier and the type name of the first file type; the interface management component dynamically rendering the file directory tree on the graphical user interface according to all the type names in the mapping table.
[0051] In this embodiment, when the interface management component initializes or needs to update its display, it retrieves all currently stored file type information in the mapping table by calling the table access interface provided by the file management service, particularly the user-visible names corresponding to each file type. Subsequently, based on the retrieved user-visible names, the interface management component dynamically constructs a file directory navigation structure in the graphical user interface. The node composition and label content of this navigation structure are synchronized with the information recorded in the mapping table. When the mapping table in the file management service is updated due to the registration of new file types, the interface management component can retrieve the updated file type information by calling the storage structure access interface again during the next initialization or refresh, and reconstruct the file directory navigation structure accordingly, thereby achieving automatic synchronization and updating of the interface display content with the system's supported file type list.
[0052] As an example of an embodiment of the present invention, the interface management component obtains the target file type identifier corresponding to the operation instruction by querying the mapping table. Specifically, the interface management component determines the operation node corresponding to the operation instruction in the file directory tree; obtains the target file type name corresponding to the operation node; and obtains the target file type identifier by querying the mapping table based on the target file type name.
[0053] In this embodiment, the interface component responds to user interactions on the file navigation structure view, determining the specific view element affected by the interaction. The interface component extracts the user-visible identifier text associated with that view element and uses this text as a query condition to initiate a lookup request to the central data source maintaining file type definitions within the system. The central data source, based on its stored list of type definitions, matches the query condition and returns the corresponding internal type code. The interface component thus obtains the system's internal file type identifier directly associated with the current user operation, providing a basis for subsequent event transmission and function matching. This process achieves an accurate conversion from user interface interaction to the system's internal logical type.
[0054] As an example of an embodiment of the present invention, the first menu component is an instance of a menu implementation class, and the menu implementation class inherits from a preset event response base class.
[0055] In this embodiment, as Figure 5-7These are the menu display pages for right-clicking point cloud, model, and image items in the directory tree. To implement customized menu functionality for specific file types, a dedicated menu function implementation class can be created in a functional module independent of the system's core components. This class follows a unified event response specification base class. This class stipulates that the menu component declares its standard ability to receive and process file operation events by inheriting from the system's predefined event response base class (or implementing the corresponding event response interface). This base class defines the standard callback interfaces for various file operation events (such as single-click and double-click) supported by the system. Within this class, the inherited event response interface methods are implemented. The implementation of these methods encapsulates the context menu generation logic and business operation logic associated with specific file types. This means that for different types of files (e.g., point cloud files, 3D model files, and image files), different menu function implementation classes can be created, each implementing different menu content and function responses. An instance of the menu function implementation class is created, and the instance and its associated file type identifier are registered with the system by calling the response module registration interface provided by the file management service. After registration, the instance becomes a listener in the system event distribution system.
[0056] Specifically, this embodiment provides a menu component implementation for a specific file type. This component acquires the ability to respond to file operation events by conforming to the event response interface specification (i.e., inheriting from the event response base class or implementing the corresponding interface protocol). The component internally implements at least one event response method defined in the specification, such as a method for responding to file click events. The implementation logic of this method encapsulates context menu generation and processing logic associated with a specific file type. This logic includes at least: a menu creation sub-logic for dynamically constructing a menu structure containing one or more functional options; a menu display sub-logic for presenting the constructed menu structure at the user interaction location; and a menu item processing sub-logic for responding to user selections of menu items and executing the corresponding file operation function. The menu component internally maintains data representing the menu structure. Optionally, this module can exist in the system as a singleton, a static instance, or an instance created on demand.
[0057] For example, an event response interface specification is defined to define the standard form for menu components to respond to various file operation events. This specification defines a set of standard event response methods, each corresponding to a specific type of file operation event, and specifies the set of parameters related to the operation context that must be passed when calling the method. The standard event response methods include at least: a first response method for responding to a file open event, which requires the file type identifier and file path information to be passed when called; a second response method for responding to a file close event, which requires the file type identifier and file path information to be passed when called; a third response method for responding to a file display status setting event, which requires the file type identifier, file path information, and target display status identifier to be passed when called; a fourth response method for responding to a file click event, which requires the triggering button identifier, the file type identifier, the file's hierarchy information in the directory structure, and the file path information to be passed when called; and a fifth response method for responding to a file double-click event, which requires the triggering button identifier, the file type identifier, the file's hierarchy information in the directory structure, and the file path information to be passed when called. Optionally, the event response interface specification is implemented in the system in the form of an abstract base class, an interface protocol, or a callback function contract. The menu component declares its response logic to specific file operation events by implementing all or some of the event response methods defined in the specification.
[0058] In this way, the menu processing logic for each file type (or business logic) is encapsulated in an independent class that follows a unified specification and is registered with the system as an independent component. When a file operation event occurs, the event distribution service will uniformly notify all registered components of this type. Each component then decides whether and how to respond (i.e., what menu to display and what operation to perform) based on its associated type. This achieves componentization and modularization of menu processing logic, supports "plug-and-play" expansion of menu support for new file types, and allows the menu content of different components to be flexibly customized according to business needs without affecting each other.
[0059] It should be noted that the menu function implementation class provides menu generation logic, which is called when needed to dynamically construct a context menu data structure. As a preferred implementation, the menu can be constructed by calling the menu creation interface provided by the operating system or graphical interface framework (e.g., on the Windows platform, APIs such as CreatePopupMenu and AppendMenu can be used). This construction process typically includes: initializing the menu structure to create an empty pop-up menu object; and populating the menu items to add one or more menu items to the menu object, each associated with at least display text (such as "Load Data") and an internal command identifier. It is understood that the above implementation based on a specific API is merely an example. Those skilled in the art will recognize that other functionally equivalent interfaces or methods exist for implementing the same dynamic menu construction function under different operating systems or graphical interface frameworks. The menu content created by the menu generation logic is closely related to the file type or business logic associated with the current function implementation class. For example, a menu class for point cloud files might generate a menu containing items such as "Load" and "Register," while a menu class for image files might generate a menu containing items such as "Overlay" and "Correct." The completed menu structure is stored inside the class for subsequent display logic to call.
[0060] like Figure 8 As shown, based on the above method embodiments, an embodiment of the present invention provides a menu display system 800, including: an interface management component 801, a file management component 802, an event management component 803, and a plurality of first menu components 804; The interface management component 801 is used to respond to the user's operation command on the file directory tree, and determine the target file type identifier corresponding to the operation command according to the mapping table in the file management component 802, wherein the file directory tree is dynamically rendered according to the mapping table; The interface management component 801 is further configured to determine the operation event message based on the target file type identifier and send the operation event message to the event management component 803; The event management component 803 is used to obtain the listening registry in the file management component 802 and broadcast the operation event message to all the first menu components 804 according to the listening registry. The listening registry is used to identify the first menu components 804 that have registered for listening in the file management component 802. Each of the first menu components 804 is used to respond to the operation event message by matching a preset association type identifier with the target file type identifier. If a match is found, the menu information of the first menu component 804 is sent to the interface management component 801. If no match is found, the operation event message is ignored. The interface management component 801 is also used to render the menu information as a context menu in the graphical user interface to achieve dynamic display of the menu.
[0061] It is understood that the above system item embodiments correspond to the method item embodiments of the present invention, and can implement the menu display method provided by any of the above method item embodiments of the present invention.
[0062] It should be noted that the system embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0063] For ease of description and brevity, the system embodiments of the present invention include all the implementation methods described in the above-described menu display method embodiments, and will not be repeated here.
[0064] Based on the above-described embodiments of the menu display method, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the menu display method of any embodiment of the present invention.
[0065] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.
[0066] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0067] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.
[0068] Based on the above-described method embodiments, another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the menu display method described in any of the above-described method embodiments of the present invention.
[0069] Based on the above-described method embodiments, this invention also provides a computer program / program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of any of the above-described method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0070] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0071] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A menu display method characterized by comprising: The menu display method is applied to a menu display system, wherein the menu display system comprises an interface management component, a file management component, an event management component and a plurality of first menu components, and the menu display method comprises the following steps: The interface management component determines a target file type identifier corresponding to an operation instruction of a user on a file directory tree according to a mapping table in the file management component in response to the operation instruction of the user on the file directory tree, wherein the file directory tree is dynamically rendered according to the mapping table; The interface management component determines an operation event message according to the target file type identifier and sends the operation event message to the event management component; The event management component acquires a listening registration table in the file management component and broadcasts the operation event message to all the first menu components according to the listening registration table, wherein the listening registration table is used to represent the first menu components that are registered for listening in the file management component; Each of the first menu components matches a preset association type identifier with the target file type identifier in response to the operation event message, and if the matching is successful, the menu information of the first menu component is sent to the interface management component, and if the matching is unsuccessful, the operation event message is ignored; The interface management component renders the menu information into a context menu in a graphical user interface to realize dynamic display of the menu.
2. The menu display method of claim 1, wherein, The menu display method further comprises the following steps: a second corresponding relationship of a second file type is added to the mapping table by calling a file registration interface of the file management component, so as to realize dynamic update of the mapping table.
3. The menu display method according to claim 1 or 2, wherein The menu display method further comprises the following steps: a second menu component and an association type identifier of the second menu component are added to the listening registration table by calling a listening registration interface of the file management component, so as to realize dynamic update of the listening registration table.
4. The menu display method of claim 1, wherein, The interface management component acquires an operation instruction of a user on a file directory tree, and specifically comprises the following steps: The interface management component acquires a mapping table in the file management component by calling a first acquisition interface of the file management component, and the mapping table is used to represent a first corresponding relationship of a type identifier of a first file type with a type name; The interface management component dynamically renders all type names in the mapping table on the graphical user interface to obtain the file directory tree.
5. The menu display method according to claim 1 or 4, wherein The interface management component queries the target file type identifier corresponding to the operation instruction according to the mapping table, and specifically comprises the following steps: The interface management component determines an operation node corresponding to the operation instruction in the file directory tree; The target file type identifier is obtained by querying the target file type name in the mapping table.
6. The menu display method of claim 1, wherein, The first menu component is an instance of a menu implementation class, and the menu implementation class inherits from a preset event response base class.
7. A menu display system characterized by comprising: The menu display system comprises the following components: An interface management component, a file management component, an event management component and a plurality of first menu components. The interface management component is used to respond to user operation instructions on the file directory tree, and determine the target file type identifier corresponding to the operation instruction according to the mapping table in the file management component, wherein the file directory tree is dynamically rendered according to the mapping table; The interface management component is further configured to determine the operation event message based on the target file type identifier, and send the operation event message to the event management component; The event management component is used to obtain the listening registry in the file management component and broadcast the operation event message to all the first menu components according to the listening registry, wherein the listening registry is used to identify the first menu components that have registered for listening in the file management component; Each of the first menu components is used to respond to the operation event message by matching a preset association type identifier with the target file type identifier. If a match is found, the menu information of the first menu component is sent to the interface management component. If no match is found, the operation event message is ignored. The interface management component is also used to render the menu information as a context menu in the graphical user interface to achieve dynamic display of the menu.
8. A terminal device, comprising: It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the menu display method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, include: A stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the menu display method as described in any one of claims 1-6.
10. A computer program product, characterised in that, include: Computer instructions, when executed by a processor, implement the steps in the menu display method as described in any one of claims 1 to 6.