Method and device for front-end control layer to access display layer control, and medium
By defining the control accessor interface and the control access manager interface, the front-end control layer and the display layer are decoupled, and the control layer adjustment problem caused by changes in the display layer is solved, the system maintainability and scalability is improved, and maintenance complexity is reduced. sex.
Patent Information
- Application Number
- CN202410959303.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-17
AI Technical Summary
In the prior art, the tight coupling between the front-end control layer and the display layer causes frequent adjustment of the control layer code when the display layer changes, which increases maintenance complexity and workload, and the system's rapid interface style and control technology during the life cycle. Changes increase development and maintenance pressure.
Define the control accessor interface and the control access manager interface, through which decouple between the control layer and the presentation layer, allowing the control layer to operate the controls in the presentation layer through the interface, reduce the degree of code coupling, and only when the presentation layer changes The control accessor needs to be modified without affecting the control layer code.
The control layer and the presentation layer are decoupled, which improves the maintainability and scalability of the code, reduces duplicate encoding, improves the flexibility and maintainability of the system, and makes the system more easily coping with business needs and changes. .
Smart Images

Figure CN118963741A_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 display layer control. Background Art
[0002] In today's rapidly changing front-end technology, in order to improve the maintainability and scalability of the code, the front-end code is usually divided into a control layer and a presentation layer. The control layer is mainly responsible for the implementation of 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 the actual development process, the control layer often needs to interact with the presentation layer, such as obtaining control event information, modifying control property values, or calling control methods. This cross-layer interaction leads to a tight coupling relationship between the control layer and the presentation layer. When the presentation layer changes, such as upgrading or replacing controls, the control layer code often needs to be adjusted accordingly, which undoubtedly increases the complexity and workload of maintenance.
[0004] More importantly, in the life cycle of a large system, the business logic of the control layer is usually relatively stable, while the presentation layer changes frequently due to changes in interface style and technology updates. The life cycle of a system may be as long as 5-10 years, but the interface style and control implementation technology often change significantly within 2-3 years. This means that in order to adapt to new presentation styles and new technologies, controls need to be constantly redeveloped.
[0005] However, each upgrade or replacement of a control may have an impact on the control layer, causing instability in the control layer, and even requiring a large amount of control layer code to be modified to adapt to changes in the presentation layer. This not only increases the workload of development, but may 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 display layer controls, so as to solve the technical problem that the existing control layer and the display layer are tightly coupled, resulting in that changes in the display layer often require a large number of adjustments to the control layer, increasing the complexity and workload of maintenance.
[0007] On the one hand, 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, the definition of the 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, the definition of the 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, the definition of the 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, the definition of the control access manager interface specifically includes:
[0022] When defining the control accessor registration method, determine the unique identifier of the control instance and determine the corresponding control accessor instance;
[0023] When defining a control accessor acquisition method, a 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 a target control in the presentation layer, and obtain a 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, the applying to the 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 an 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 executable 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, which, when executed, implements the above-mentioned method of a front-end control layer accessing a presentation layer control.
[0038] The present application provides a method, device and medium for a front-end control layer to access a presentation layer control, including at least the following beneficial effects:
[0039] By defining the control accessor interface and the control access manager interface, the control layer and the presentation layer are decoupled. The control layer does not need to directly rely on the specific control implementation, but only needs to operate through the interface, which reduces the coupling of the code and improves the maintainability of the code. When the control in the presentation layer needs to be upgraded or replaced, only the implementation of the control accessor needs to be modified without modifying the code of the control layer. In this way, the new control can be easily integrated into the existing system, improving the scalability of the system. The definition of the control accessor interface and the control access manager interface is independent of the type of specific control, which allows them to be shared and reused between different controls. The reusability of the code is improved and the workload of repeated coding is reduced. Through the definition and implementation of the interface, the control layer can flexibly access and operate the controls in the presentation layer without worrying about the specific implementation details of the controls. This makes the system more flexible and able to cope with different business needs and changes. Due to the decoupling between the control layer and the presentation layer, it is easier to test and maintain the system. The code of the control layer and the presentation layer can be tested separately without worrying about the mutual influence between them. At the same time, when the system fails, it can also be easier to locate the problem, improving the maintainability of the system. 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 a presentation layer control provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0044] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0045] Figure 1 A flowchart of a method for a front-end control layer to access a presentation layer control 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 the convenience of understanding and description, the following embodiments are described in detail by taking a server as an example.
[0047] It should be noted that the server may be a single device or a system consisting of multiple devices, that is, a distributed server, and this application does not make any specific limitation on this.
[0048] like Figure 1 As shown, a method for a front-end control layer to access a presentation layer control provided in an embodiment of the present application includes:
[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 monitoring 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, in a Web application, there is a custom button control. When the user clicks this button, some specific operations need to be performed. In order to implement this function, a control event monitoring method is defined, which can map the incoming event name to the actual event name of the control and register an event handler for the event. When an event occurs, the information returned by the event is processed and passed to the event handler.
[0057] First, define a mapping table to map the incoming event name to the actual event name of the control. For example, map "userClick" to the "click" event of the control. When calling the event listening 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 according to the mapping table. The method registers the event handler function for the corresponding event of the control.
[0058] When a control event occurs, the browser generates an event object, which contains detailed information about the event. The event handler function receives this event object as a parameter. Inside the event handler function, the event object is processed to extract the required information. After the processing is completed, 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 "The button was clicked".
[0060] First, the event listening method is called, and the event name "userClick" and the event handler function are passed in. Then, the method maps "userClick" to the "click" event of the button control. After that, the method registers the event handler function for the "click" event of the button control. 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 information of the click event. After the processing is completed, the event handler function pops up a prompt box showing "The button was 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, in a Web application, there is a custom control that contains multiple properties, such as color, size, border, etc. In order to flexibly modify these property values, a method is designed that can receive the incoming property name and property value, map the property name to the actual property name of the control, perform necessary processing on the property value, and assign values to the control properties.
[0067] First, define a mapping table to map the passed in attribute name to the actual attribute name of the control. For example, map "txtColor" to the "color" attribute of the control. When calling the modification method, pass in the attribute name and attribute value. The method converts the passed in attribute name to the actual attribute name of the control according to the mapping table. At the same time, the method processes the passed in attribute value. For example, if the attribute value is color, it can be ensured that it is a legal CSS color value; if the attribute value is size, it can be ensured that it is a legal pixel value. After the processing is completed, the method uses the processed attribute name and attribute value to assign the corresponding attribute of the control.
[0068] Suppose we have a custom button control, which has a "color" attribute for setting the button's color. Call the modification method and pass in the attribute name "txtColor" and the attribute value "#FF0000". The method maps "txtColor" to the "color" attribute of the button control, and processes the attribute value "#FF0000" to confirm that it is a legal CSS color value. After that, the "color" attribute of the button control is assigned "#FF0000", and the color of the button changes 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 inside 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 value.
[0074] In one embodiment, in a graphical user interface (GUI) application, different methods of a control need to be called according to the user's operation. In order to increase flexibility, a middle layer is designed, which 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 the incoming method name to the actual method name of the control. For example, map "setText" to the "setText" method of the control. At the same time, define another mapping table to map the incoming method parameters to the parameter type and order required by the control method. When calling the method of the middle layer, pass in the method name and method parameters. The middle layer converts the incoming method name to the actual method name of the control according to the mapping table. At the same time, the middle layer processes the incoming method parameters according to another mapping table to ensure that they meet the parameter type and order required by the control method. After the processing is completed, the middle layer uses the processed method name and parameter value to call the corresponding method of the control.
[0076] Suppose there is a text box control and the user wants to set its text content. The user passes the method name "setText" and the parameter "Hello, World!" through the middle layer. The middle layer maps "setText" to the "setText" method of the text box control and processes the parameter "Hello, World!" into a string type. The middle layer calls the "setText" method of the text box control and passes the processed parameter value "Hello, World!". The text content of the text box control is set to "Hello, World!".
[0077] In one embodiment, as shown in Table 1 below, the property names and corresponding property descriptions of the defined control accessor interface are:
[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 acquire 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, in a graphical user interface (GUI) application, it is necessary to access and operate controls. In order to manage controls more flexibly, the concept of control accessor is introduced. A control accessor is an object associated with a control instance, which provides methods for accessing and operating controls. It is necessary to implement registration and acquisition methods of control accessors.
[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 unique identifier of the control instance is associated with the control accessor instance, and it is 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 unique identifier of the control instance as the key, the corresponding control accessor instance is searched from the accessor registry. Once the corresponding control accessor instance is found, the methods provided by it 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 the accessor later to operate the text box.
[0088] Create a text box control instance and generate a unique identifier "uuid-1234" for it. Create a control accessor instance corresponding to the text box control instance, associate it with "uuid-1234", and then register it in the accessor registry. At some point later, the text box control needs to be operated. Use "uuid-1234" as the key to get the corresponding control accessor instance from the accessor registry. Once the control accessor instance is obtained, you can use the methods it provides to set the text content of the text box, get 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:
[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 the interface is defined, the corresponding control accessor is implemented for the control according to the constraints of the interface, and the control is operated through the control accessor in the control layer code. When the control needs to be upgraded or replaced, there is no need to modify the control layer code, and only the control accessor layer needs to be adapted.
[0094] In one embodiment, in order to demonstrate the process, a Vue-based front-end application example is used for illustration. In this example, there is a city selection control 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, and 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, the $refs attribute can be used to obtain it. A control accessor instance of the city selection control is created in the presentation layer.
[0101] In one embodiment, in a web application developed using the React framework, a specific control needs to be operated. To achieve 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 an instance of the control 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 there is a React component that contains an input box, and you want to operate the input box in the component. Add a ref attribute to the input box in the component and assign it inputRef as the identifier. When the component is initialized, use inputRef.current to get the DOM element instance of the input box. Create a control accessor instance and pass the DOM element instance of the input box to it. Now, you can operate the input box through the control accessor instance, such as setting its value, getting its value, etc.
[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, in a complex Web application, a common layer is designed to centrally manage the access of various controls. In order to enhance the scalability and maintainability of the program, a control access manager is introduced in the common layer and integrated into the global context. In the presentation layer, that is, the component part of the user interface, a registration application is submitted to the control access manager to include specific control accessors in management.
[0106] In the common layer, a control access manager is built, which is responsible for centrally managing and scheduling accessors of all controls. This control access manager instance is added to the global context to ensure that it can be easily accessed and used throughout the application. When creating a new control accessor in the presentation layer, a registration application needs to be submitted to the control access manager in the global context. The registration application contains relevant information about the control accessor, such as the control type, unique identifier, etc., so that the control access manager can accurately manage and schedule it. After receiving the registration application, the control access manager will verify whether the information in the application is complete and valid. After the verification is passed, the control access manager will add the control accessor to its internal management list for subsequent unified management and scheduling.
[0107] Suppose you are developing a web form application that contains multiple input boxes. In the public 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 box and a registration application is submitted to the control access manager in the global context. The control access manager verifies the information in the registration application and adds each control accessor to its management list. Now, the control accessors of all input boxes can be uniformly managed and scheduled through the control access manager, thereby realizing 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 realize the front-end control layer access to the display layer control.
[0111] In one embodiment, in a Web application using the MVC (Model-View-Controller) architecture, it is necessary to obtain the data input by the user through the interface control in the control layer. To achieve this function, the control access manager created previously is used to obtain the control accessor corresponding to the target control, and the control value change event is monitored through the accessor to obtain the data input by the user.
[0112] When the user enters data through the 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 the value change event 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 verification, storage, etc.
[0113] Suppose you are developing a user registration page that contains 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 through the control access manager. The control layer uses the control accessor to register an event listener to listen for value change events in the username input box. When the user enters a username, the event listener is triggered and obtains the username entered by the user. The control layer passes the username to the model layer for verification and processing.
[0114] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, the embodiment of this application 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 The internal structure diagram of a device for accessing the display layer control by the front-end control layer provided in the embodiment of the present application is as follows. Figure 2 As shown, the device 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 at least one processor to enable the at least one processor to:
[0119] 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, and a control calling 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 register the control accessor with the control access manager;
[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 a control accessor interface; wherein the control accessor interface includes: a control instance, a control event monitoring method, a control property value modification method, and a control calling 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 register the control accessor with the control access manager;
[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] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0129] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some 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 as the 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 may be provided as methods, systems, or computer program products. Therefore, the present application may 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 may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include 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 generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. 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 capable of directing a computer or other programmable data processing device to operate 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 A 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 operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions 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 (CPU), input / output interfaces, network interfaces, and memory.
[0136] The 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. The memory is an example of a computer-readable medium.
[0137] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape 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 temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0138] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0139] The above is only 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 modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for the front-end control layer to access the display layer controls. It is 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 display layer control according to claim 1, It is 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. A method for a front-end control layer to access a display layer control according to claim 1, It is 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. A method for a front-end control layer to access a display layer control according to claim 1, It is 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. A method for a front-end control layer to access a display layer control according to claim 1, It is 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 determine the corresponding control accessor instance; When defining a control accessor acquisition method, a unique identifier of the control instance is determined to acquire the control accessor based on the unique identifier.
6. A method for a front-end control layer to access a display layer control according to claim 1, It is 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 a target control in the presentation layer, and obtain a control instance corresponding to the target control; A control accessor instance corresponding to the target control is created in the presentation layer.
7. A method for a front-end control layer to access a display layer control according to claim 1, It is 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. A method for a front-end control layer to access a display layer control according to claim 1, It is 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 the front-end control layer to access the display layer controls, It is 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 executable 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 a method for a front-end control layer to access a presentation layer control as described in any one of claims 1-8.
10. A non-volatile computer storage medium storing computer executable instructions, It is characterized in that When the computer executable instructions are executed, a method for a front-end control layer to access a presentation layer control as described in 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
Web control generation method, system and equipment and storage medium
CN116126329A
Method and device for calling native function component, electronic equipment and storage medium
CN117591106A
A computing cloud for monitoring physical environments
IN201847019265A
