Method, device and medium for front-end control layer accessing presentation layer controls
By defining the control accessor interface and the manager interface, the control layer and the display layer are decoupled, which solves the problem that the control layer needs to be adjusted due to changes in the display layer, and improves the maintainability and scalability of the system.
Patent Information
- Application Number
- CN202410959303.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-07-17
AI Technical Summary
The existing control layer is closely coupled to the display layer, resulting in a large amount of adjustments to the control layer when the display layer changes, which increases maintenance complexity and workload.
Define the control accessor interface and the control access manager interface, through these interfaces, obtain control instances in the display layer and register the accessor, and operate the controls in the control layer through the accessor to achieve decoupling between the control layer and the display layer.
It reduces the coupling between the control layer and the presentation layer, improves the maintainability and scalability of the code, reduces the workload of repeated encoding, and simplifies system testing and maintenance.
Smart Images

Figure CN118963741B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, and medium for a front-end control layer to access a presentation layer control. Background Art
[0002] With the rapid advancement of front-end technology, front-end code is often divided into a control layer and a presentation layer to improve code maintainability and scalability. The control layer primarily implements business logic, while the presentation layer focuses on drawing the user interface through controls. This layered design makes the front-end architecture clearer and easier to develop and manage.
[0003] However, in actual development, the control layer often needs to interact with the presentation layer, for example, to obtain control event information, modify control property values, or call control methods. This cross-layer interaction creates a tight coupling between the control and presentation layers. When the presentation layer changes, such as when a control is upgraded or replaced, the control layer code often needs to be adjusted accordingly, which undoubtedly increases maintenance complexity and workload.
[0004] More critically, during the lifecycle of a large system, the business logic of the control layer is typically relatively stable, while the presentation layer undergoes frequent changes due to changes in interface styles and technological advancements. A system's lifecycle may last 5-10 years, but the interface style and control implementation technologies often undergo significant changes within 2-3 years. This means that controls need to be constantly redeveloped to adapt to new presentation styles and technologies.
[0005] However, every upgrade or replacement of a control can impact the control layer, causing instability and even requiring extensive code modifications to adapt to changes in the presentation layer. This not only increases development workload but can also introduce new errors and risks. Summary of the Invention
[0006] The embodiments of the present application provide a method, device, and medium for a front-end control layer to access presentation layer controls, to address the technical problem that the existing control layer and presentation layer are tightly coupled, resulting in changes in the presentation layer often requiring extensive adjustments to the control layer, increasing the complexity and workload of maintenance.
[0007] In one aspect, an embodiment of the present application provides a method for a front-end control layer to access a presentation layer control, including:
[0008] Define a control accessor interface; wherein the control accessor interface includes: a control instance, a control event monitoring method, a control property value modification method, a control property value modification method, and a control method calling method;
[0009] Define a control access manager interface; wherein the control access manager interface includes: a control accessor registration method and a control accessor acquisition method;
[0010] Obtaining a control instance in the presentation layer, creating a control accessor for the control instance, and applying to a control access manager to register the control accessor;
[0011] The control accessor is obtained through the control access manager in the control layer, and the control instance is operated through the control accessor.
[0012] In one implementation of the present application, defining a control accessor interface specifically includes:
[0013] When defining the control event monitoring method, map the incoming event name to the event name of the control event and register the event handler for the control event;
[0014] The information returned by the control event is processed, and the processed return information is passed to the event processor.
[0015] In one implementation of the present application, defining a control accessor interface specifically includes:
[0016] When defining the control attribute value modification method, the passed attribute name is mapped to the attribute name of the control attribute, and the attribute value of the corresponding control is returned to process the returned attribute value;
[0017] Determine the attribute value obtained after processing, and assign a value to the control attribute according to the attribute value after processing.
[0018] In one implementation of the present application, defining a control accessor interface specifically includes:
[0019] When defining the control method call method, map the incoming method name to the method name of the control method, and map the incoming method parameters to the control method parameters;
[0020] The control method calling method is called, and the parameter values of the processed control method parameters are passed.
[0021] In one implementation of the present application, defining a control access manager interface specifically includes:
[0022] When defining the control accessor registration method, determine the unique identifier of the control instance and the corresponding control accessor instance;
[0023] When defining a control accessor acquisition method, the unique identifier of the control instance is determined to acquire the control accessor based on the unique identifier.
[0024] In one implementation of the present application, obtaining a control instance in the presentation layer to create a control accessor for the control instance specifically includes:
[0025] Determine the target control in the presentation layer and obtain the control instance corresponding to the target control;
[0026] A control accessor instance corresponding to the target control is created in the presentation layer.
[0027] In one implementation of the present application, applying to a control access manager to register the control accessor specifically includes:
[0028] Creating a control access manager in a common layer and adding the control access manager to a global context;
[0029] In the presentation layer, a registration application for the control accessor is initiated to the control access manager to register the control accessor.
[0030] In one implementation of the present application, obtaining the control accessor through the control access manager in the control layer and operating the control instance through the control accessor specifically includes:
[0031] In the control layer, the control access manager is used to obtain the control accessor corresponding to the target control;
[0032] The value change event is monitored through the control accessor to obtain the data corresponding to the target control.
[0033] On the other hand, an embodiment of the present application further provides a device for a front-end control layer to access a presentation layer control, the device comprising:
[0034] at least one processor;
[0035] and, a memory communicatively coupled to the at least one processor;
[0036] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method of the front-end control layer accessing the presentation layer control.
[0037] On the other hand, an embodiment of the present application further provides a non-volatile computer storage medium storing computer-executable instructions. When the computer-executable instructions are executed, a method for a front-end control layer to access a presentation layer control as described above is implemented.
[0038] The present invention provides a method, device, and medium for a front-end control layer to access a presentation layer control, which at least provide the following benefits:
[0039] By defining the control accessor interface and the control access manager interface, the control layer and presentation layer are decoupled. The control layer no longer directly depends on specific control implementations; it operates solely through the interface, reducing code coupling and improving code maintainability. When upgrading or replacing controls in the presentation layer, only the control accessor implementation needs to be modified, without modifying the control layer code. This allows new controls to be easily integrated into the existing system, improving system scalability. The definition of the control accessor interface and the control access manager interface is independent of the specific control type, allowing them to be shared and reused across different controls. This improves code reusability and reduces repetitive coding. By defining and implementing the interfaces, the control layer can flexibly access and operate controls in the presentation layer without having to worry about their specific implementation details. This makes the system more flexible and adaptable to changing business needs and changes. The decoupling of the control and presentation layers makes system testing and maintenance easier. The control and presentation layer code can be tested separately without worrying about mutual impact. Furthermore, when system failures occur, the problem is more easily located, improving system maintainability. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0041] Figure 1 A flowchart of a method for a front-end control layer to access a presentation layer control provided in an embodiment of the present application;
[0042] Figure 2 A schematic diagram of the internal structure of a device for a front-end control layer to access presentation layer controls provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0044] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.
[0045] Figure 1 A flowchart of a method for a front-end control layer to access presentation layer controls is provided in an embodiment of the present application.
[0046] The analysis method involved in the embodiments of the present application can be implemented by a terminal device or a server, and the present application does not impose any special restrictions on this. For ease of understanding and description, the following embodiments are described in detail using a server as an example.
[0047] It should be noted that the server can be a single device or a system composed of multiple devices, that is, a distributed server, and this application does not make any specific restrictions on this.
[0048] like Figure 1 As shown, an embodiment of the present application provides a method for a front-end control layer to access a presentation layer control, including:
[0049] 101. Define a control accessor interface. It should be noted that the control accessor interface in the embodiment of the present application includes: a control instance, a control event monitoring method, a control property value acquisition method, a control property value modification method, and a control method calling method.
[0050] Specifically, in one embodiment of the present application, when defining a control event listening method, the server maps the incoming event name to the event name of the control event and registers an event handler for the control event; processes the information returned by the control event and passes the processed return information to the event handler.
[0051] In one embodiment, in order to access a control, an abstract accessor interface needs to be defined for the control to describe the operation of the control. The instance of this interface needs to hold a control instance and implement the following methods:
[0052] The control layer listens to control events through this method. The following logic needs to be implemented within this method:
[0053] Map the incoming event name to the control event name;
[0054] Register event handlers for control events;
[0055] The information returned by the control event is processed and passed to the event handler.
[0056] In one embodiment, a web application contains a custom button control. When a user clicks this button, a specific action is performed. To implement this functionality, a control event listener method is defined. This method maps the incoming event name to the actual event name of the control and registers an event handler for the event. When the event occurs, the returned information is processed and passed to the event handler.
[0057] First, define a mapping table to map incoming event names to the actual event names of the control. For example, map "userClick" to the control's "click" event. When calling an event listener method, pass in the event name and event handler function. The method converts the incoming event name to the actual event name of the control based on the mapping table. The method then registers the event handler function for the corresponding event of the control.
[0058] When a control event occurs, the browser generates an event object containing detailed information about the event. The event handler function receives this event object as a parameter. Within the event handler function, the event object is processed to extract the required information. Once processed, the processed information is passed to other parts of the event handler function for subsequent operations.
[0059] Suppose there is a custom button control. When the user clicks this button, a prompt box needs to pop up to display "Button was clicked".
[0060] First, the event listener method is called, passing in the event name "userClick" and the event handler function. The method then maps "userClick" to the "click" event of the button control. Finally, the method registers an event handler function for the button control's "click" event. When the user clicks the button, the browser generates a click event object and passes it to the event handler function. The event handler function processes the event object and extracts the click event information. After processing, the event handler function displays a prompt indicating "Button Clicked."
[0061] In one embodiment of the present application, when defining a control attribute value modification method, the server maps the passed-in attribute name to the attribute name of the control attribute, and returns the attribute value of the corresponding control to process the returned attribute value; determines the attribute value obtained after processing, and assigns a value to the control attribute based on the processed attribute value.
[0062] In one embodiment, the control layer modifies the properties of the control through this method, and the following logic needs to be implemented within this method:
[0063] Map the passed in property name to the property name of the control;
[0064] Process the incoming attribute values;
[0065] Use the processed attribute values to assign values to control attributes.
[0066] In one embodiment, a web application contains a custom control that includes multiple properties, such as color, size, and border. To flexibly modify these property values, a method is designed that receives an incoming property name and value, maps the property name to the actual property name of the control, performs necessary processing on the property value, and assigns the value to the control property.
[0067] First, define a mapping table to map the passed-in property name to the actual property name of the control. For example, map "txtColor" to the control's "color" property. When calling the modification method, pass in the property name and value. The method converts the passed-in property name to the control's actual property name based on the mapping table. At the same time, the method processes the passed-in property value. For example, if the property value is a color, it ensures it is a valid CSS color value; if the property value is a size, it ensures it is a valid pixel value. After processing, the method uses the processed property name and value to assign the corresponding property of the control.
[0068] Suppose we have a custom button control with a "color" property for setting the button's color. Call the modify method, passing in the property name "txtColor" and the value "#FF0000." The method maps "txtColor" to the button's "color" property and processes the value "#FF0000" to confirm it's a valid CSS color value. Then, it assigns "#FF0000" to the button's "color" property, changing the button's color to red.
[0069] In one embodiment of the present application, when defining a control method calling method, the server maps the incoming method name to the method name of the control method, and maps the incoming method parameters to the control method parameters; calls the control method calling method, and passes the parameter values of the processed control method parameters.
[0070] In one embodiment, the control layer calls the control method through this method, and the following logic needs to be implemented within this method:
[0071] Map the passed method name to the control's method name;
[0072] Map the incoming method parameters to the control's method parameters;
[0073] Call the control's method and pass the processed parameter values.
[0074] In one embodiment, in a graphical user interface (GUI) application, different methods of a control need to be called according to user operations. To increase flexibility, a middle layer is designed that can map the incoming method name to the actual method name of the control and map the incoming method parameters to the parameters required by the control method.
[0075] First, define a mapping table to map incoming method names to the actual method names of the control. For example, map "setText" to the control's "setText" method. Also, define another mapping table to map incoming method parameters to the parameter types and order required by the control method. When calling a method in the middle layer, pass in the method name and method parameters. The middle layer converts the incoming method name into the actual method name of the control based on the mapping table. Furthermore, the middle layer processes the incoming method parameters based on another mapping table, ensuring that they conform to the parameter types and order required by the control method. After processing, the middle layer calls the corresponding method of the control using the processed method name and parameter values.
[0076] Suppose there's a text box control, and the user wants to set its contents. The user passes the method name "setText" and the parameter "Hello, World!" through the middleware. The middleware maps "setText" to the text box control's "setText" method and converts the parameter "Hello, World!" into a string. The middleware then calls the text box control's "setText" method, passing the converted parameter value "Hello, World!". The text box control's contents are then set to "Hello, World!".
[0077] In one embodiment, the following Table 1 shows the property names and corresponding property descriptions of the defined control accessor interface:
[0078] Table 1
[0079]
[0080] 102. Define a control access manager interface. It should be noted that the control access manager interface in the embodiment of the present application includes: a control accessor registration method and a control accessor acquisition method.
[0081] Specifically, in one embodiment of the present application, when defining a control accessor registration method, the server determines the unique identifier of the control instance and determines the corresponding control accessor instance; when defining a control accessor acquisition method, the server determines the unique identifier of the control instance to obtain the control accessor based on the unique identifier.
[0082] In one embodiment, in order to access the control accessor in the control layer, a control accessor management interface needs to be implemented to complete the registration and acquisition of the control accessor. The instance of this interface needs to implement the following methods:
[0083] Register the control accessor through this method in the presentation layer;
[0084] This method is used to obtain the control accessor at the control layer.
[0085] In one embodiment, a graphical user interface (GUI) application requires accessing and manipulating controls. To manage controls more flexibly, the concept of a control accessor is introduced. A control accessor is an object associated with a control instance that provides methods for accessing and manipulating the control. The registration and retrieval methods for the control accessor must be implemented.
[0086] When a control instance is created, a unique identifier (such as a UUID) is generated for it. A control accessor instance corresponding to the control instance is created. The control instance's unique identifier is associated with the control accessor instance and registered in a global or local accessor registry. When a control needs to be accessed and operated, the unique identifier of the control instance is first determined. Using the control instance's unique identifier as the key, the corresponding control accessor instance is searched from the accessor registry. Once the corresponding control accessor instance is found, the methods it provides can be used to access and operate the control.
[0087] Suppose we have a text box control and we want to register a control accessor for it and get that accessor later to manipulate the text box.
[0088] Create a text box control instance and generate a unique identifier for it, "uuid-1234." Create a control accessor instance corresponding to the text box control instance, associate it with "uuid-1234," and then register it with the accessor registry. At some point later, you need to operate the text box control. Using "uuid-1234" as the key, retrieve the corresponding control accessor instance from the accessor registry. Once you have the control accessor instance, you can use the methods it provides to set the text box's text content, retrieve the text content, or perform other operations.
[0089] In one embodiment, as shown in Table 2 below, the property names and corresponding property descriptions of the defined control access manager interface are as follows:
[0090] Table 2
[0091]
[0092] 103. Obtain the control instance in the presentation layer, create a control accessor for the control instance, and apply to the control access manager to register the control accessor.
[0093] After defining the interface, implement corresponding control accessors for the control based on the interface constraints. Controls are then manipulated through these accessors in the control layer code. When upgrading or replacing a control, there's no need to modify the control layer code; only the control accessors need to be adapted.
[0094] In one embodiment, to demonstrate this process, a Vue-based front-end application example is used. In this example, a city selection control is present on the page for selecting a departure city. The following functions need to be implemented through the control accessor of the city selection control:
[0095] Monitor the value changes of the city selection control, obtain the value of the selected city and process it;
[0096] Modify the city data source of the city selection control;
[0097] Call the Close method of the city selection control.
[0098] Specifically, the server determines the target control in the presentation layer, obtains the control instance corresponding to the target control, and creates a control accessor instance corresponding to the target control in the presentation layer.
[0099] In one embodiment, the Vue framework adds a ref identifier to the target control and obtains the control instance of the target control based on the ref tag after the presentation layer is initialized.
[0100] In one embodiment, in the Vue framework, a ref tag is added to the city selection control in the presentation layer to obtain its control instance. After the presentation layer is initialized, the control instance of the city selection control is obtained. In the Vue application, this can be obtained using the $refs property. A control accessor instance for the city selection control is created in the presentation layer.
[0101] In one embodiment, in a web application developed using the React framework, it is necessary to operate on a specific control. To implement this function, it is decided to add a ref identifier to the target control in the presentation layer (i.e., the React component) so that the control instance can be obtained after the component is initialized and a control accessor instance is created for it.
[0102] In the React component, identify the target control that needs to be operated, such as an input box. Add a ref attribute to the input box and give it a unique identifier, such as inputRef. When the React component is initialized, you can use the ref object created by the React.createRef() method to access the corresponding DOM element (that is, the input box control instance). Get the DOM element instance of the input box through inputRef.current. Define a control accessor class that encapsulates methods for operating the input box, such as setting values, getting values, etc. Use the DOM element instance of the input box to create a control accessor instance, so that the instance is closely associated with the input box control.
[0103] Suppose you have a React component that contains an input field, and you want to manipulate the input field within the component. Add a ref attribute to the input field and assign it inputRef as its identifier. After the component is initialized, use inputRef.current to retrieve the DOM element instance of the input field. Create a control accessor instance and pass it the DOM element instance of the input field. Now, you can use the control accessor instance to manipulate the input field, such as setting and getting its value.
[0104] In one embodiment of the present application, a control access manager is created in the public layer and added to the global context; in the presentation layer, a registration application for the control accessor is initiated to the control access manager to register the control accessor.
[0105] In one embodiment, a common layer was designed within a complex web application to centrally manage access to various controls. To enhance the application's scalability and maintainability, a control access manager was introduced into the common layer and integrated into the global context. In the presentation layer, i.e., the user interface components, registration applications were submitted to the control access manager to manage specific control accessors.
[0106] In the common layer, a control access manager is built to centrally manage and dispatch accessors for all controls. This control access manager instance is added to the global context to ensure convenient access and use throughout the application. When creating a new control accessor in the presentation layer, a registration request must be submitted to the control access manager in the global context. This registration request contains relevant information about the control accessor, such as the control type and unique identifier, enabling the control access manager to accurately manage and dispatch it. Upon receiving the registration request, the control access manager verifies the completeness and validity of the information. If successful, the control access manager adds the control accessor to its internal management list for subsequent unified management and dispatch.
[0107] Suppose you are developing a web form application that contains multiple input fields. In the common layer, a control access manager is created and added to the global context. In the presentation layer, a control accessor is created for each input field and a registration request is submitted to the control access manager in the global context. The control access manager verifies the information in the registration request and adds each control accessor to its management list. The control access manager can now centrally manage and dispatch control accessors for all input fields, achieving centralized management and operation of form controls.
[0108] 104. In the control layer, a control accessor is obtained through a control access manager, and the control instance is operated through the control accessor.
[0109] Specifically, in one embodiment of the present application, the server obtains a control accessor corresponding to a target control through a control access manager in the control layer; and monitors value change events through the control accessor to obtain data corresponding to the target control.
[0110] In one embodiment, the control accessor of the departure city is obtained in the control layer, the value accessor is used in the control layer to access the control, and finally, the close method of the city selection control is called to enable the front-end control layer to access the display layer control.
[0111] In one embodiment, in a Web application using the MVC (Model-View-Controller) architecture, it is necessary to obtain user input data through interface controls in the control layer. To achieve this, the control access manager created previously is used to obtain the control accessor corresponding to the target control. The control accessor then listens for control value change events to obtain the user input data.
[0112] When a user enters data through an interface control (such as an input box), the control layer needs to obtain this data for subsequent processing. The control layer obtains the corresponding control accessor instance based on the unique identifier of the target control through the control access manager in the global context. The control layer uses the obtained control accessor instance to register an event listener to listen for value change events of the target control. When the user changes the value of the control (such as entering text), the event listener is triggered and receives an event object containing the new value. When the event listener is triggered, it extracts the new value of the target control from the event object. The control layer passes the obtained data to the model layer for further processing, such as validation and storage.
[0113] Suppose you are developing a user registration page that includes a username input box. The user enters text in the username input box. The control layer obtains the control accessor corresponding to the username input box from the control access manager. The control layer uses the control accessor to register an event listener to listen for value changes in the username input box. When the user enters a username, the event listener is triggered and receives the username entered. The control layer passes the username to the model layer for validation and processing.
[0114] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, this application embodiment also provides a device for the front-end control layer to access the display layer control, and its structure is as follows: Figure 2 shown.
[0115] Figure 2 This is a schematic diagram of the internal structure of a device for accessing presentation layer controls from a front-end control layer provided in an embodiment of the present application. Figure 2 As shown, the equipment includes:
[0116] at least one processor;
[0117] and, a memory communicatively coupled to the at least one processor;
[0118] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:
[0119] Define the control accessor interface; the control accessor interface includes: control instance, control event monitoring method, control property value modification method and control call method;
[0120] Define a control access manager interface; wherein the control access manager interface includes: a control accessor registration method and a control accessor acquisition method;
[0121] Get the control instance in the presentation layer, create a control accessor for the control instance, and apply to the control access manager to register the control accessor;
[0122] In the control layer, the control accessor is obtained through the control access manager, and the control instance is operated through the control accessor.
[0123] The present application also provides a non-volatile computer storage medium storing computer-executable instructions. When the computer-executable instructions are executed, they can:
[0124] Define the control accessor interface; the control accessor interface includes: control instance, control event monitoring method, control property value modification method and control call method;
[0125] Define a control access manager interface; wherein the control access manager interface includes: a control accessor registration method and a control accessor acquisition method;
[0126] Get the control instance in the presentation layer, create a control accessor for the control instance, and apply to the control access manager to register the control accessor;
[0127] In the control layer, the control accessor is obtained through the control access manager, and the control instance is operated through the control accessor.
[0128] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device and medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant portions, refer to the descriptions of the method embodiments.
[0129] The foregoing description describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0130] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects to their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0131] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0132] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0133] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0135] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0136] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0137] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0138] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0139] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A method for a front-end control layer to access a display layer control, characterized in that: The method comprises: Define a control accessor interface; wherein the control accessor interface includes: a control instance, a control event monitoring method, a control property value acquisition method, a control property value modification method, and a control method calling method; Define a control access manager interface; wherein the control access manager interface includes: a control accessor registration method and a control accessor acquisition method; Obtaining a control instance in the presentation layer, creating a control accessor for the control instance, and applying to a control access manager to register the control accessor; The control accessor is obtained through the control access manager in the control layer, and the control instance is operated through the control accessor.
2. A method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The definition of the control accessor interface specifically includes: When defining the control event monitoring method, map the incoming event name to the event name of the control event and register the event handler for the control event; The information returned by the control event is processed, and the processed return information is passed to the event processor.
3. The method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The definition of the control accessor interface specifically includes: When defining the control attribute value modification method, the passed attribute name is mapped to the attribute name of the control attribute, and the attribute value of the corresponding control is returned to process the returned attribute value; Determine the attribute value obtained after processing, and assign a value to the control attribute according to the attribute value after processing.
4. The method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The definition of the control accessor interface specifically includes: When defining the control method call method, map the incoming method name to the method name of the control method, and map the incoming method parameters to the control method parameters; The control method calling method is called, and the parameter values of the processed control method parameters are passed.
5. The method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The definition of the control access manager interface specifically includes: When defining the control accessor registration method, determine the unique identifier of the control instance and the corresponding control accessor instance; When defining a control accessor acquisition method, the unique identifier of the control instance is determined to acquire the control accessor based on the unique identifier.
6. The method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The step of obtaining a control instance in the presentation layer to create a control accessor for the control instance specifically includes: Determine the target control in the presentation layer and obtain the control instance corresponding to the target control; A control accessor instance corresponding to the target control is created in the presentation layer.
7. The method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The applying to the control access manager to register the control accessor specifically includes: Creating a control access manager in a common layer and adding the control access manager to a global context; In the presentation layer, a registration application for the control accessor is initiated to the control access manager to register the control accessor.
8. The method for a front-end control layer to access a presentation layer control according to claim 1, characterized in that: The obtaining the control accessor through the control access manager in the control layer and operating the control instance through the control accessor specifically includes: In the control layer, the control access manager is used to obtain the control accessor corresponding to the target control; The value change event is monitored through the control accessor to obtain the data corresponding to the target control.
9. A device for a front-end control layer to access a display layer control, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method of the front-end control layer accessing the presentation layer control as described in any one of claims 1-8.
10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: When the computer-executable instructions are executed, a method for a front-end control layer to access a presentation layer control according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Front-end form control abstraction method and device, and medium
CN113986433A
Method, device and system for managing multi-manufacturer controls in online banking system
CN114185521A