An apparatus and method for application development based on an atomized package command

CN115469864BActive Publication Date: 2026-10-27PERA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211011963.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-23
Publication Date
2026-10-27
Estimated Expiration
2042-08-23

AI Technical Summary

Technical Problem

[0005]鉴于上述的分析,本发明实施例旨在提供一种基于原子化封装命令的应用开发装置和方法,用以解决现有应用开发前后端耦合度高且扩展性和维护性差的问题

Benefits of technology

[0024]与现有技术相比,本发明至少可实现如下有益效果之一:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115469864B_ABST
    Figure CN115469864B_ABST
Patent Text Reader

Abstract

The application relates to an application development device and method based on an atomization encapsulation command and belongs to the technical field of development frameworks, and solves the problems of high coupling degree, poor expansibility and poor maintainability of front and rear ends before and after application development. The device comprises the following steps: a command definition base class in a command framework module is used to define the display form of an interface end control; a command implementation framework base class is used to define the basic processing method of a command object; a command database is used to register the command object; a command implementation interaction base class in a command extension module inherits the command implementation framework base class and is used to create components for interaction with a user in the command object, including a view component, a right-click menu component and a property page component; a command implementation module comprises command objects corresponding to each function; the command object comprises a command identifier, a command creation method and a command definition creation method; and the command object is bound with the interface end control through the command identifier. High cohesion and low coupling of application development are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of development framework technology, and in particular to an application development apparatus and method based on atomic encapsulation commands. Background Technology

[0002] With the development of computer development technology, how to quickly develop and iterate application software in order to rapidly transform user needs into operable functions and release application software on schedule has always been a concern.

[0003] In traditional monolithic software development, a single function involves front-end interface logic development, back-end business function development, and front-end / back-end interaction development, resulting in strong code coupling. Developers need to understand both the interface logic and business logic to implement a complete function, leading to poor code scalability and reusability. Furthermore, it is difficult to intuitively locate problems when exceptions occur, and modifications to the function may require changes to multiple files, making it difficult to assess the scope of impact and increasing the difficulty of later maintenance.

[0004] The Command pattern in design patterns can solve the problem of strong coupling, but this pattern is more suitable for client-server architecture. Using it in monolithic software still presents some problems: Complete isolation between interface and functionality: The button names, icons, and prompts displayed on the interface are actually part of the functionality provided. For example, when developing a video playback function, the icons and prompts displayed on the interface should also be part of the functionality. However, the existing Command pattern requires these to be implemented on the interface side, resulting in the separation of some functions; High personnel requirements: Developers must have a very good understanding of the Command pattern, otherwise it is easy to revert to implementing functionality in the interface; Difficulty in function customization: Each command in the Command pattern is often independent, making it impossible to customize existing functions. For example, in a video playback function, customizing view operations or right-click menus is needed during video playback. The common practice is to add a state control to the general logic of the interface, thus adding the video playback requirement to the general logic of the interface without customizing the video playback command. Summary of the Invention

[0005] Based on the above analysis, the embodiments of the present invention aim to provide an application development apparatus and method based on atomic encapsulation commands to solve the problems of high front-end and back-end coupling, poor scalability and maintainability in existing application development.

[0006] On one hand, embodiments of the present invention provide an application development apparatus based on atomic encapsulation commands, comprising:

[0007] The command framework module includes a command definition base class, a command implementation framework base class, and a command database. The command definition base class is used to define the appearance of UI controls; the command implementation framework base class is used to define the basic processing methods of command objects; and the command database is used to register command objects.

[0008] The command extension module includes a command implementation interaction base class, which inherits from the command implementation framework base class and is used to create components that interact with the user in the command object;

[0009] The command implementation module includes a command object corresponding to each function; the command object includes a command identifier, a command creation method, and a command definition creation method; the command creation method is used to create the command object, and the command definition creation method is used to obtain the command definition object; the command object is bound to the interface control through the command identifier.

[0010] Based on the further improvement of the above device, the command implementation interaction base class implements the event handling method of the command implementation framework base class, wherein the event handling methods of each component are extended according to the obtained event type, and a custom method is provided in the event handling method of each component;

[0011] Command objects allow for customized handling of event methods for each component by overriding custom methods.

[0012] Based on further improvements to the above-mentioned device, the command database is used to register command objects, including: using macros or interface methods in the command database, according to the input command object and command identifier, writing the command identifier and command creation method of the command object, and the command definition creation method of the command object into two global variables, which are used to automatically load the command object and its command definition object when the program starts.

[0013] Based on further improvements to the above-mentioned device, the command object inherits from the command implementation framework base class or the command implementation interaction base class, including: when the function corresponding to the command object does not require user interaction, the command object inherits from the command implementation framework base class and passes the command identifier in the constructor of the command implementation framework base class; otherwise, the command object inherits from the command implementation interaction base class and passes the command identifier, filter enumeration value and right-click menu identification value in the constructor of the command implementation interaction base class.

[0014] Based on further improvements to the above device, components that interact with the user, including view components, are created in the command object. When a view component is created in the command object, the constructor of the interaction base class is inherited, and a filter enumeration value is passed in. The view objects in the current window are then filtered according to the filter enumeration value.

[0015] Based on further improvements to the above device, components that interact with the user are created in the command object, including a right-click menu component. When the right-click menu component is created in the command object, the command object implements the constructor of the interaction base class through inheritance, passes in the right-click menu identification value of true, and automatically calls the right-click menu component creation method in the interaction base class to obtain a default right-click menu list, including the command identifier and menu item name corresponding to the menu item.

[0016] Based on further improvements to the above-mentioned device, components for user interaction, including property page components, are created in the command object. When a property page component is created in the command object, the property page component creation method of the command implementation interaction base class is called, and the input parameters include: property page name, property page configuration file path, property page initialization parameters, and initialization prompt information. The property page configuration file is obtained and parsed according to the property page configuration file path, and the property page is displayed.

[0017] Based on further improvements to the above-mentioned device, the property page configuration file is an XML format file, which includes control tags corresponding to the interface controls. The unique identifier in the control tag is used to obtain the control and set the value of the control.

[0018] Based on further improvements to the above-mentioned device, the command framework module also includes a command component base class, which is used to define general methods for components. The activation method calls the activation method in the command implementation framework base class, the deactivation method calls the deactivation method in the command implementation framework base class, and the send component event method sends the event to the owner of the command object and calls the event handling method of the owner of the command object.

[0019] On the other hand, embodiments of the present invention provide an application development method based on atomic encapsulation commands, comprising the following steps:

[0020] Based on the appearance of the UI controls, create a base class for command definitions; based on the basic processing methods of command objects, create a base class for command implementation frameworks.

[0021] Create a command implementation base class that inherits from the command implementation framework base class, and add methods for creating components that interact with the user;

[0022] Create a command object corresponding to each function. The command object includes a command identifier, a command creation method, and a command definition creation method. The command creation method is used to obtain the instantiated command object, and the command definition creation method is used to obtain the instantiated command definition object.

[0023] Register the command object to the command database and bind it to the interface control through the command identifier.

[0024] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:

[0025] 1. Each command is responsible for implementing all the functions it needs (business logic, interface information). The interface, backend processing framework, and command objects are independent of each other, and their development does not affect each other. This achieves high cohesion and low coupling in application development, improves code readability, simplifies the location of problems when they occur, and makes the impact of modifications controllable, thus improving code maintainability.

[0026] 2. After the front-end interface layout is completed, the controls are bound to the command identifiers. The controls can automatically obtain the appearance from the command definition or call the command to execute business functions. The coupling between the command and the interface is low, which improves the readability and maintainability of the code.

[0027] 3. By using the command extension module in the backend, the interaction base class provides reusable methods. The command object only needs simple configuration or method overriding to achieve the desired function, reducing repetitive work and allowing developers to focus more on business needs, thus improving development efficiency.

[0028] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0029] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0030] Figure 1 This is a schematic diagram of an application development device based on atomic encapsulation commands in Embodiment 1 of the present invention. Detailed Implementation

[0031] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0032] Example 1

[0033] One specific embodiment of the present invention discloses an application development apparatus based on atomic encapsulation commands, suitable for the development of monolithic software, such as... Figure 1 As shown. Includes:

[0034] The command framework module includes a command definition base class, a command implementation framework base class, and a command database. The command definition base class is used to define the presentation of UI controls; the command implementation framework base class is used to define the basic processing methods of command objects; and the command database is used to register command objects.

[0035] The command extension module includes a command implementation interaction base class, which inherits from the command implementation framework base class and is used to create components that interact with the user in the command object;

[0036] The command implementation module includes a command object corresponding to each function; the command object includes a command identifier, a command creation method, and a command definition creation method; the command creation method is used to create the command object, and the command definition creation method is used to obtain the command definition object; the command object is bound to the interface control through the command identifier.

[0037] Next, each module will be explained in detail:

[0038] (1) The command framework module is the basic underlying module. The base class in it defines common attributes and method names, but generally does not have specific method implementations.

[0039] ① The command defines a base class, which is used to define the appearance of UI controls.

[0040] It should be noted that the interface controls include menus, buttons, and various commonly used controls, and their representation includes: control name title, control icon, and tooltips. Therefore, these are defined as basic properties of the command definition base class.

[0041] In existing technologies, the names and icons of controls on the front-end interface are generally defined directly in the interface code. The control state is determined and set by front-end script code after obtaining back-end data. This approach separates the functionality of controls from the front-end and back-end, requiring cooperation between the two during development. In this embodiment, the front-end and back-end functions of each control in the front-end interface are treated as a whole and bound to a command unique identifier (CUID). When displayed on the front-end, the command definition corresponding to the command object is found through the CUID, and the basic information and display state of the control are obtained based on the command definition. In this case, the interface only needs to build the process, such as the layout of menus and buttons, and binding with the command unique identifier CUID, without needing to perform other business logic processing. Therefore, the above method completely decouples commands from the interface, improving code readability and maintainability.

[0042] ② Command implementation framework base class, used to define the basic processing methods of command objects.

[0043] It should be noted that the parameter of the constructor of the command implementation framework base class is: the command identifier; the basic processing methods of the command implementation framework base class include: the activation method onActivate() for handling initialization operations before command execution, such as the initialization of property pages; the deactivation method onDeactivate() for restoring the state when the command is closed, such as releasing property page resources and restoring view controls; the execution method onExecute() for executing the business processing operations of the command; and the event handling method onHandleEvent(event) for performing business processing operations based on the acquired events.

[0044] It is worth noting that the basic processing methods in the command implementation framework base class are generally the method names, and the implementation of the methods is carried out by the subclasses that inherit from the base class.

[0045] ③ Command database, used to register command objects.

[0046] It should be noted that registering command objects in the command database includes: using macros or interface methods in the command database, based on the passed command object and command identifier, writing the command identifier and the command creation method of the command object, as well as the command definition creation method of the command object, into two global variables. These variables are used to automatically load the command object and its command definition object when the program starts. The global variables are automatically destroyed when the program closes.

[0047] Furthermore, registration via macros is an automatic registration method, which is simple and convenient to call during the development phase; while registration via interface methods is a dynamic registration method, which facilitates dynamic registration and deregistration commands during code execution, and has high extensibility.

[0048] It's worth noting that the method names of the command creation method `createObject()` and the command definition creation method `createDefinition()` are fixed. After registering the command object to the command database, when displaying controls on the interface, the command is found based on the CUID, and the command's `createDefinition()` method is called. If the `createDefinition()` method cannot be found or the obtained command definition is empty, the default command definition is used for display, without affecting the overall processing flow. When a control is clicked, the command is found based on the CUID, and the command's `createObject()` method is called to activate and execute the command. If the `createObject()` method cannot be found, no operation is performed.

[0049] Preferably, the command database contains commonly used command objects, such as: open file command, save file command, import file command, export file command, hide command, and show command, which are easy to reuse and improve development speed.

[0050] Furthermore, the command framework module also includes: ④ Command component base class, which is used to define common methods for components.

[0051] It's important to note that a component refers to a component that interacts with the user, including view components, right-click menu components, and property page components. The command component base class provides general methods for commands to interact with components, including: the `activate()` method to activate the component, the `deactivate()` method to deactivate the component, and the `sendEvent(event)` method to send component events. Specifically, the `activate()` method calls the `onActivate()` method from the command implementation framework base class; the `deactivate()` method calls the `onDeactivate()` method from the command implementation framework base class; and the `sendEvent(event)` method sends the event to the owner of the command object and calls the owner's event handling method, `onHandleEvent(event)`.

[0052] (2) Command extension module, which inherits the base class in the command framework module and implements general methods.

[0053] ① Command implementation interaction base class, inheriting from the command implementation framework base class, is used to create components that interact with the user in the command object.

[0054] It should be noted that the constructor parameters of the command interaction base class include: command identifier CUID, filter enumeration value, and right-click menu identification value; the command interaction base class includes: view component creation method, right-click menu component creation method, and property page component creation method. Through these methods, the corresponding components are created according to the parameters passed in by the command object.

[0055] Specifically, in the command-based interaction base class, the view component creation method `createSelection(filter)` is called by default, taking the filter enumeration value `filter` from the constructor as a parameter. Within the method, the view objects in the current window are filtered based on the filter enumeration value. The right-click menu identification value `needCommandContextMenu` in the constructor is checked; if it is true, the right-click menu component creation method `createContextMenu()` is called to obtain the default right-click menu list, including the command identifier and menu item name corresponding to each menu item. The property page component creation method `createPropertyPage(widgetTitle,widgetConfigFilePath,initializedParameters,initializedTooltips)` is called by the inherited command object. The parameters of this method include: property page name, property page configuration file path, property page initialization parameters, and initialization prompts. Within the method, the property page configuration file is retrieved and parsed based on the property page configuration file path, and the property page is displayed.

[0056] Furthermore, the property page configuration file is an XML file, including control tags corresponding to the UI controls. The unique identifier within each control tag is used to retrieve and set the control's value. Control tags include: text label controls, edit box controls, button controls, menu controls, dropdown list controls, checkbox controls, radio button controls, group controls, and sub-group controls. For example,<Item title="controls"var="controlString" / > In this context, Item represents an edit box control, var represents the control's unique identifier, and title represents the control's tooltip.

[0057] The property page configuration file is parsed into the actual property page file, such as a .cpp file, according to the mapping rules between control tags and interface controls. Preferably, attributes are added to the control tags to configure whether the input content of the control is required, whether it is valid, or whether the unit is automatically matched. When parsing the configuration file, the corresponding method calls and implementations are added to validate the content entered on the property page.

[0058] Property pages can be dynamically generated using a property page configuration file. As long as the control identifiers in the configuration file are not changed, other attribute values ​​in the control tags can be modified to achieve dynamic modification of the property pages. This does not require recompiling the program, thus improving development and expansion efficiency.

[0059] To enable personalized handling of each component, the command implementation interaction base class implements the event handling methods of the command implementation framework base class. Based on the obtained event type, the event handling methods of each component are extended, including: property page update event handling method, view change event handling method, mouse move event handling method, left mouse click event handling method, right mouse click event handling method, mouse wheel event handling method, and keyboard click event handling method, as well as right-click menu display event handling method and right-click menu click event handling method.

[0060] For example, in the `onHandleEvent(event)` method of the command implementation interaction base class, the type of the event is identified. If it is a property page update event (`PropertyPageEvent`), the `handlePropertyPageEvent(event)` method is called; if it is a right-click menu display event (`ContextMenuEvent`), the `handleContextMenuEvent` method is called. Each component's event handling method has default processing logic and also provides customization methods. After a command object inherits from the command implementation interaction base class, it can override the custom methods in the corresponding component's event handling methods according to actual business needs.

[0061] Preferably, ② based on the command definition base class of the command framework module, a command definition extension class is defined in the command extension module that inherits from the command definition base class, which is used to add display attributes and control the display state of the interface controls.

[0062] For example, a method for obtaining the control state can be added to the command definition extension class, and the behavior of the UI control can be controlled according to the obtained control state, such as visible, enabled, or checked.

[0063] It should be noted that the command extension module can be extended to include a command definition extension class, or a dedicated command definition extension class can be defined for each control. For example, a command definition extension class PreproCheckboxDefinition can be defined for checkboxes. Then, the front end can automatically call the corresponding command definition extension class for the control by recognizing the control type.

[0064] Preferably, ③ the command component base class based on the command framework module defines a view component base class, a right-click menu component base class, and a property page component base class for each component in the command extension module. All of these inherit from the command component base class and are used to extend the component activation method, component deactivation method, and component event sending method of each component.

[0065] (3) Command implementation module: Define different command objects. Each command object inherits from the command framework module or command extension module. It is bound to the interface control through the command identifier to implement the specific business logic of the interface control.

[0066] It should be noted that the command identifier (CUID) for each command object is globally unique and of type unsigned int. When the CUID is 0, the command identifier is invalid. Preferably, based on business requirements, different ranges of CUID values ​​are set, providing a method for command identification while managing commands in blocks.

[0067] The command object includes a command creation method and a command definition creation method. Both of these methods are static methods of the command object. The command creation method is used to create the command object, and the command definition creation method is used to obtain the command definition object.

[0068] For example, `static CommandSample* createObject(){return new CommandSample();}`, where `CommandSample` is the class name of the command object, and the command creation method returns an instantiated command object.

[0069] The command definition object obtained by the command definition creation method can be of the type of the command definition base class in the command framework module, or of the type of the command definition extension class in the command extension module. A single command object can have multiple command definition objects; for example, a command object bound to a menu control or a button control will have different appearances. Different command definition objects can be obtained based on the control type within the command definition creation method.

[0070] Command objects inherit from either the command implementation framework base class or the command implementation interaction base class. Specifically: if the function corresponding to the command object does not require user interaction, the command object inherits from the command implementation framework base class, passing the command identifier in the constructor of the command implementation framework base class; otherwise, the command object inherits from the command implementation interaction base class, passing the command identifier, filter enumeration values, and right-click menu identification values ​​in the constructor of the command implementation interaction base class. The component is then created based on the passed parameter values.

[0071] Specifically, when creating a view component in a command object, the constructor of the inherited command implementation base class is passed in with filter enumeration values. The view objects in the current window are then filtered based on these values. When there are multiple filter enumeration values, they are concatenated using the OR operator.

[0072] When a right-click menu component is created in a command object, the command object implements the constructor of the interaction base class through inheritance, passes in the right-click menu identification value of true, and automatically calls the right-click menu component creation method in the interaction base class to obtain a default right-click menu list, including the command identifier CUID and menu item name corresponding to the menu item.

[0073] The command object implements custom methods in the interaction base class by overriding commands, allowing for customized handling of event methods for each component, avoiding a lot of repetitive work and simplifying extension.

[0074] For example, the command object overrides the customContextMenuItems method in the handleContextMenuEvent event handling method of the interaction base class to add, modify, and delete items from the default right-click menu list; and overrides the onCustomItemsClicked method in the handleContextMenuClickEvent event handling method of the interaction base class to customize the click events of the right-click menu list.

[0075] When a property page component is created in the command object, the property page component creation method of the command implementation interaction base class is called. The parameters passed in include: property page name, property page configuration file path, property page initialization parameters and initialization prompt message. The property page configuration file is obtained and parsed according to the property page configuration file path, and the property page is displayed.

[0076] After each command object is created and registered in the command database, it can be bound to controls in the front-end interface via command identifiers (CUIDs). This embodiment does not restrict the binding method; the command identifiers (CUIDs) can be directly specified on the interface, or each control and its associated command identifier (CUID) can be configured in the configuration file. The page framework then parses the configuration file to obtain the command object corresponding to the control. Subsequent command-related errors, even those displayed on the interface, will be limited to the implementation code of the command object and will not involve other files, improving the efficiency of problem localization and modification and shortening the inspection time.

[0077] Compared with existing technologies, this embodiment provides an application development device based on atomically encapsulated commands. Each command is responsible for implementing all the functions it needs (business logic, interface information). The interface, backend processing framework, and command objects are independent of each other, and their development does not affect each other. This achieves high cohesion and low coupling in application development, improves code readability, simplifies the location of problems after functional issues arise, and controls the impact of modifications, thus improving code maintainability. After the frontend interface completes its layout, controls are bound to command identifiers. Controls can automatically obtain their representation from the command definition or call commands to execute business functions. The low coupling between commands and the interface improves code readability and maintainability. Reusable methods are provided by the command implementation interaction base class in the backend command extension module. Command objects only need simple configuration or method overriding to achieve the desired functions, reducing repetitive work and allowing developers to focus more on business requirements, thereby improving development efficiency.

[0078] Example 2

[0079] Another embodiment of the present invention discloses an application development method based on atomic encapsulation commands, thereby implementing the application development apparatus in Embodiment 1. The specific implementation of each step of the method is described in the corresponding description in Embodiment 1. The method includes the following steps:

[0080] Based on the appearance of the UI controls, create a base class for command definitions; based on the basic processing methods of command objects, create a base class for command implementation frameworks.

[0081] Create a command implementation base class that inherits from the command implementation framework base class, and add methods for creating components that interact with the user;

[0082] Create a command object corresponding to each function. The command object includes a command identifier, a command creation method, and a command definition creation method. The command creation method is used to obtain the instantiated command object, and the command definition creation method is used to obtain the instantiated command definition object.

[0083] Register the command object to the command database and bind it to the interface control through the command identifier.

[0084] Since the application development method based on atomic encapsulation commands in this embodiment and the aforementioned application development device based on atomic encapsulation commands can be mutually referenced, this description is redundant and will not be repeated here. Because this method embodiment shares the same principle as the aforementioned device embodiment, it also possesses the corresponding technical effects of the aforementioned device embodiment.

[0085] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0086] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. An application development apparatus based on atomic encapsulation commands, characterized in that, include: The command framework module includes a command definition base class, a command implementation framework base class, and a command database; The command definition base class is used to define the appearance of interface controls, including control name, control icon, and prompt information, which are defined as basic properties of the command definition base class; the command implementation framework base class is used to define the basic processing methods of command objects; the command database is used to register command objects. The command extension module includes a command implementation interaction base class, which inherits from the command implementation framework base class and is used to create components that interact with the user in the command object; The command implementation module includes a command object corresponding to each function; the command object includes a command identifier, a command creation method, and a command definition creation method; the command creation method is used to create the command object, and the command definition creation method is used to obtain the command definition object; the method names of the command creation method and the command definition creation method are fixed and are both static methods of the command object; the command object is bound to the interface control through the command identifier; The command database is used to register command objects, including: using macros or interface methods in the command database, based on the passed command object and command identifier, writing the command identifier and command creation method of the command object, and the command definition creation method of the command object into two global variables, which are used to automatically load the command object and its command definition object when the program starts. When a control is displayed on the interface, the command object is located based on the command identifier, and the command definition creation method of the command object is called. Different command definition objects are obtained according to the control type. When a control is clicked, the command object is located based on the command identifier, and the command creation method of the command object is called.

2. The application development apparatus based on atomized encapsulation commands according to claim 1, characterized in that, The command implementation interaction base class implements the event handling methods of the command implementation framework base class, wherein the event handling methods of each component are extended according to the obtained event type, and custom methods are provided in the event handling methods of each component; Command objects allow for customized handling of event methods for each component by overriding custom methods.

3. The application development apparatus based on atomized encapsulation commands according to claim 2, characterized in that, The command object inherits from the command implementation framework base class or the command implementation interaction base class, including: when the function corresponding to the command object does not require user interaction, the command object inherits from the command implementation framework base class and passes the command identifier in the constructor of the command implementation framework base class; otherwise, the command object inherits from the command implementation interaction base class and passes the command identifier, filter enumeration value and right-click menu identification value in the constructor of the command implementation interaction base class.

4. The application development apparatus based on atomized encapsulation commands according to claim 3, characterized in that, The process of creating user-interactive components in the command object includes view components. When creating a view component in the command object, the constructor of the inherited command implementation interaction base class is used to pass in filter enumeration values, and the view objects in the current window are filtered according to the filter enumeration values.

5. The application development apparatus based on atomized encapsulation commands according to claim 3, characterized in that, The process of creating user-interactive components in the command object includes a right-click menu component. When creating a right-click menu component in the command object, the command object implements the constructor of the interaction base class through inheritance, passes in the right-click menu identification value of true, and automatically calls the right-click menu component creation method in the interaction base class to obtain a default right-click menu list, including the command identifier and menu item name corresponding to the menu item.

6. The application development apparatus based on atomized encapsulation commands according to claim 3, characterized in that, The process of creating user-interactive components in the command object includes a property page component. When creating a property page component in the command object, the property page component creation method of the command implementation interaction base class is called, and the input parameters include: property page name, property page configuration file path, property page initialization parameters, and initialization prompt information. The property page configuration file is obtained and parsed according to the property page configuration file path, and the property page is displayed.

7. The application development apparatus based on atomic encapsulation commands according to claim 6, characterized in that, The property page configuration file is an XML file, which includes control tags corresponding to the interface controls. The unique identifier in the control tag is used to get the control and set the value of the control.

8. The application development apparatus based on atomized encapsulation commands according to claim 2, characterized in that, The command framework module also includes a command component base class, which is used to define general methods for components. The activation method calls the activation method in the command implementation framework base class, the deactivation method calls the deactivation method in the command implementation framework base class, and the send component event method sends the event to the owner of the command object and calls the event handling method of the owner of the command object.

9. An application development method based on atomic encapsulation commands, characterized in that, Includes the following steps: Based on the appearance of the UI controls, a base class for command definition is created. The appearance includes: control name, control icon, and prompt message, which are defined as the basic properties of the base class for command definition. Based on the basic processing methods of command objects, a base class for command implementation framework is created. Create a command implementation base class that inherits from the command implementation framework base class, and add methods for creating components that interact with the user; Create a command object corresponding to each function. The command object includes a command identifier, a command creation method, and a command definition creation method. The command creation method is used to obtain the instantiated command object, and the command definition creation method is used to obtain the instantiated command definition object. The method names of the command creation method and the command definition creation method are fixed and are both static methods of the command object. Registering the command object to the command database includes: using macros or interface methods in the command database, based on the passed command object and command identifier, writing the command creation method of the command identifier and the command definition creation method of the command object into two global variables, which are used to automatically load the command object and its command definition object when the program starts; binding it to the interface control through the command identifier; when the control is displayed on the interface, finding the command object based on the command identifier, calling the command definition creation method of the command object, and obtaining different command definition objects according to the control type; when the control is clicked, finding the command object based on the command identifier and calling the command creation method of the command object.

Citation Information

Patent Citations

  • Mechanism for providing extended functionality to command line instructions

    CN101073057A

  • Application of data-binding mechanism to perform command binding

    CN1684034A