Data processing method and device, electronic equipment and storage medium

文档序号:1378963 发布日期:2020-08-14 浏览:13次 中文

阅读说明:本技术 数据处理方法、装置、电子设备和存储介质 (Data processing method and device, electronic equipment and storage medium ) 是由 田凯 于 2019-02-02 设计创作,主要内容包括:本申请实施例提供了一种数据处理方法、装置、电子设备和存储介质,以提高复用性。所述方法包括:确定页面中节点,以及所述节点的上一级节点;将所述上一级节点的第一方向参数的参数值,确定为所述节点的第一方向参数的参数值;依据所述第一方向参数的参数值,确定所述节点的方向信息;若所述方向信息与所述节点对应视图的默认显示方向相反,则调整所述节点对应视图的显示方向。节点的第一方向参数可继承其上一级节点的第一方向参数,使得各节点可自动检测和调整方向,适用于各种页面的开发,具有较好的复用性,且能够提高页面的开发效率较高。(The embodiment of the application provides a data processing method and device, electronic equipment and a storage medium, so as to improve reusability. The method comprises the following steps: determining nodes in a page and nodes at the upper level of the nodes; determining the parameter value of the first direction parameter of the upper-level node as the parameter value of the first direction parameter of the node; determining direction information of the node according to the parameter value of the first direction parameter; and if the direction information is opposite to the default display direction of the view corresponding to the node, adjusting the display direction of the view corresponding to the node. The first direction parameter of the node can inherit the first direction parameter of the node at the upper level, so that each node can automatically detect and adjust the direction, the method is suitable for developing various pages, has better reusability, and can improve the development efficiency of the pages.)

1. A method of data processing, the method comprising:

determining nodes in a page and nodes at the upper level of the nodes;

determining the parameter value of the first direction parameter of the upper-level node as the parameter value of the first direction parameter of the node;

determining direction information of the node according to the parameter value of the first direction parameter;

and if the direction information is opposite to the default display direction of the view corresponding to the node, adjusting the display direction of the view corresponding to the node.

2. The method of claim 1, wherein the adjusting node corresponds to a display orientation of the view, and comprises:

setting the attribute of the view corresponding to the node according to the direction information; and/or

And adjusting the view corresponding to the node through affine transformation.

3. The method according to claim 2, wherein the adjusting the view corresponding to the node through affine transformation comprises:

and carrying out affine transformation on the container view corresponding to the node, and carrying out affine transformation on each sub-view corresponding to the container view.

4. The method according to claim 1, wherein said determining the direction information of the node according to the parameter value of the first direction parameter comprises:

determining a parameter value of a second direction parameter of the node, wherein the second direction parameter is used for determining the direction of the node corresponding to the streaming layout;

and determining the direction information of the node according to the parameter value of the second direction parameter and the parameter value of the first direction parameter.

5. The method according to any of claims 1-4, wherein the parameter values of the first direction parameter comprise left to right, and/or right to left; the direction information of the node comprises: the horizontal layout from right to left corresponding to the row direction, the horizontal layout from left to right corresponding to the row direction, the vertical layout from right to left corresponding to the column direction, and/or the vertical layout from left to right corresponding to the column direction.

6. The method of claim 5, wherein the parameter values of the second direction parameter comprise: a row forward parameter value, a row reverse parameter value, a column forward parameter value, and/or a column reverse parameter value.

7. The method of any of claims 1-6, further comprising:

determining a parameter value of a third direction parameter of the root node;

and taking the parameter value of the third direction parameter as the parameter value of the first direction parameter of the root node.

8. A data processing apparatus, characterized in that the apparatus comprises:

the node determining module is used for determining nodes in a page and nodes at the upper level of the nodes;

a parameter value determining module, configured to determine a parameter value of the first direction parameter of the previous-stage node as a parameter value of the first direction parameter of the node;

a direction determining module, configured to determine direction information of the node according to a parameter value of the first direction parameter;

and the direction adjusting module is used for adjusting the display direction of the view corresponding to the node if the direction information is opposite to the default display direction of the view corresponding to the node.

9. An electronic device, comprising:

a processor; and

memory having stored thereon executable code which, when executed, causes the processor to perform a data processing method as claimed in one or more of claims 1-8.

10. One or more machine readable media having executable code stored thereon that, when executed, causes a processor to perform a data processing method as recited in one or more of claims 1-8.

Technical Field

The present application relates to the field of computer technologies, and in particular, to a data processing method and apparatus, an electronic device, and a storage medium.

Background

Chinese, english, etc. are usually written and read from left to right, but different languages have different writing and reading habits, for example, arabic, hebrew, etc. are written and read from right to left, so the pages of an application need to be adjusted based on the habits of the language used.

At present, the adjustment of the page of the application program based on the language habit is usually performed on the front-end page based on the actual situation, and the content such as each element in the web page is modified step by step without reusability.

Disclosure of Invention

The embodiment of the application provides a data processing method for improving reusability.

Correspondingly, the embodiment of the application also provides a data processing device, an electronic device and a storage medium, which are used for ensuring the implementation and application of the method.

In order to solve the above problem, an embodiment of the present application discloses a data processing method, including: determining nodes in a page and nodes at the upper level of the nodes; determining the parameter value of the first direction parameter of the upper-level node as the parameter value of the first direction parameter of the node; determining direction information of the node according to the parameter value of the first direction parameter; and if the direction information is opposite to the default display direction of the view corresponding to the node, adjusting the display direction of the view corresponding to the node.

Optionally, the adjusting the display direction of the view corresponding to the node includes: setting the attribute of the view corresponding to the node according to the direction information; and/or adjusting the view corresponding to the node through affine transformation.

Optionally, the adjusting, by affine transformation, the view corresponding to the node includes: and carrying out affine transformation on the container view corresponding to the node, and carrying out affine transformation on each sub-view corresponding to the container view.

Optionally, the determining the direction information of the node according to the parameter value of the first direction parameter includes: determining a parameter value of a second direction parameter of the node, wherein the second direction parameter is used for determining the direction of the node corresponding to the streaming layout; and determining the direction information of the node according to the parameter value of the second direction parameter and the parameter value of the first direction parameter.

Optionally, the parameter values of the first direction parameter include left to right, and/or right to left; the direction information of the node comprises: the horizontal layout from right to left corresponding to the row direction, the horizontal layout from left to right corresponding to the row direction, the vertical layout from right to left corresponding to the column direction, and/or the vertical layout from left to right corresponding to the column direction.

Optionally, the parameter values of the second direction parameter include: a row forward parameter value, a row reverse parameter value, a column forward parameter value, and/or a column reverse parameter value.

Optionally, the method further includes: determining a parameter value of a third direction parameter of the root node; and taking the parameter value of the third direction parameter as the parameter value of the first direction parameter of the root node.

An embodiment of the present application further provides a data processing apparatus, where the apparatus includes: the node determining module is used for determining nodes in a page and nodes at the upper level of the nodes; a parameter value determining module, configured to determine a parameter value of the first direction parameter of the previous-stage node as a parameter value of the first direction parameter of the node; a direction determining module, configured to determine direction information of the node according to a parameter value of the first direction parameter; and the direction adjusting module is used for adjusting the display direction of the view corresponding to the node if the direction information is opposite to the default display direction of the view corresponding to the node.

An embodiment of the present application further provides an electronic device, including: a processor; and a memory having executable code stored thereon, which when executed, causes the processor to perform a data processing method as described in one or more of the embodiments of the present application.

Embodiments of the present application also provide one or more machine-readable media having executable code stored thereon that, when executed, cause a processor to perform a data processing method as described in one or more of the embodiments of the present application.

Compared with the prior art, the embodiment of the application has the following advantages:

in the embodiment of the application, the nodes in the page and the nodes at the upper level of the nodes are determined, then the parameter values of the first direction parameters of the nodes at the upper level are determined as the parameter values of the first direction parameters of the nodes, the first direction parameters of the nodes can inherit the first direction parameters of the nodes at the upper level, and the direction information of the nodes is determined according to the parameter values of the first direction parameters, so that the nodes can automatically detect and adjust the direction, the method and the device are suitable for development of various pages, have good reusability, and can improve the development efficiency of the pages.

Drawings

FIG. 1 is a diagram illustrating an example of page layout adjustment according to an embodiment of the present application;

FIG. 2 is a flow chart of the steps of an embodiment of a data processing method of the present application;

FIG. 3 is a flowchart illustrating exemplary steps for determining a direction parameter in an embodiment of the present application;

fig. 4 is a flowchart of steps of an example of determination of direction information in the embodiment of the present application;

FIG. 5 is a schematic diagram of another example of data processing adjustment in an embodiment of the present application;

FIG. 6 is a flow chart of steps in another data processing method embodiment of the present application;

FIG. 7 is a flow chart of steps in yet another data processing method embodiment of the present application;

FIG. 8 is a block diagram of an embodiment of a data processing apparatus according to the present application;

FIG. 9 is a block diagram of another data processing apparatus embodiment of the present application;

fig. 10 is a schematic structural diagram of an apparatus according to an embodiment of the present application.

Detailed Description

In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.

Different languages are used for writing and reading, for example, chinese, english, etc. are usually used for writing and reading from Left To Right (LTR), while arabic, hebrew, etc. are used for writing and reading from Right To Left (RTL), so the pages of the application need To be adjusted based on the habits of the language used.

Generally, when an application program is developed, a common english or chinese habit is used, and a default of a page is to perform layout (layout) from left to right. The embodiment of the application provides a data processing method, a node can inherit the direction parameters of a node at the upper level to determine direction information, so that the direction information of each node in a page can be automatically determined, the direction of content in the page can be conveniently set, the method is suitable for the development process of various pages, the reusability is high, and the development efficiency can be improved. The page layout refers to planning settings of the page display content, including setting directions of the display content in the page and the like. The pages in the embodiment of the application comprise front-end pages of various UI frames, such as Weex front-end pages.

Referring to fig. 1, a schematic diagram of page layout adjustment according to an embodiment of the present application is shown.

Referring to fig. 2, a flow chart of steps of an embodiment of a data processing method of the present application is shown.

Step 202, determining nodes in the page and nodes at the upper level of the nodes.

And 204, setting the parameter value of the first direction parameter of the previous-stage node as the parameter value of the first direction parameter of the node.

The page of the application program can be mapped into a file consisting of hierarchical nodes, so that the setting of the page layout can be realized by traversing the nodes of the page. Therefore, the direction information can be determined for each node by traversing the nodes in the node tree corresponding to the page, where the direction information refers to the direction in which the node displays the content on the page, for example, the direction in which the node corresponds to each view.

In this embodiment of the present application, the first direction parameter refers to a parameter used for calculating a direction of a node in a page, and the first direction parameter of a node in the page that inherits a previous node may be set, so that the previous node may be determined for the node in the page, and then a parameter value of the first direction parameter of the previous node is obtained, and the first direction parameter is used as a parameter value of the first direction parameter of the node.

In the embodiment of the application, a third direction parameter can be set for development of a developer, wherein the third direction parameter refers to a direction parameter set in a development process, and the third direction parameter can be provided for the developer to set. The third direction parameter is related to the first direction parameter and can be used for determining a parameter value of the first direction parameter. In an optional embodiment, a parameter value of a third direction parameter of the root node is determined; and taking the parameter value of the third direction parameter as the parameter value of the first direction parameter of the root node. The developer may set a parameter value of a third direction parameter of a root node in the page, so that for the root node, the parameter value of the third direction parameter is taken as the parameter value of the first direction parameter of the root node. Thereafter, the next-level node of the root node can use the parameter value of the first-direction parameter of the root node as the parameter value of the first-direction parameter of the next-level node, inheriting the parameter value of the first-direction parameter, developers do not need to set each node respectively, and setting efficiency can be improved.

In this embodiment, the parameter value of the first direction parameter includes left to right LTR, and/or right to left RTL; the parameter values of the third directional parameter include left to right LTR, and/or right to left RTL.

In one embodiment, the first direction parameter may be determined according to a third direction parameter (direction), so as to obtain a parameter value of the first direction parameter (resultDirection), as shown in an example shown in fig. 3:

step 302, determining the third direction parameters of the nodes in the page.

Step 304, determining whether the parameter value of the third direction parameter is inherited. If yes, go to step 308; if not, go to step 306. Whether inheritance is needed or not can be determined according to whether the third-direction parameter value is set or not, if the parameter value is set, inheritance is not needed, and if the parameter value is not set, inheritance is needed.

Step 306, using the parameter value of the third direction parameter of the node as the parameter value of the first direction parameter of the node. For example, the parameter value of the third direction parameter of the root node is used as the parameter value of the first direction parameter of the root node.

Step 308, determine whether the node has a previous node. If yes, the node has a previous node, go to step 310, otherwise, the node does not have a previous node, go to step 312.

Step 310, determining the parameter value of the first direction parameter of the node at the previous stage of the node as the parameter value of the first direction parameter of the node.

In step 312, the parameter value of the first direction parameter of the node is determined as a default value, such as from left to right LTR direction. If the parameter value of the third direction parameter of the root node is not set, the default value can be used as the parameter value of the first direction parameter.

In the embodiment of the present application, the parameter values of the first direction parameters of the nodes may be inherited, so that the parameter values of different first direction parameters may be determined by using CSS setting and Layout (Layout) depending on the reference of the node to the direction parameter of the node at the upper stage.

Step 206, determining the direction information of the node according to the parameter value of the first direction parameter.

After obtaining the parameter value of the first direction parameter of the node, the direction information of the node may be calculated according to the parameter value of the first direction parameter.

In this embodiment of the present application, the direction information of the node is further related to a second direction parameter, where the second direction parameter is used to determine a direction in which the node corresponds to the streaming layout. The stream layout refers to that the views of each node in the page are sequentially arranged in a certain direction, and when a certain set boundary or a set number is reached, another line is formed, and the original starting point is returned to restart to be sequentially arranged in the direction. For example, if the default direction is from left to right, then according to the layout mode of the streaming layout, the nodes in the page corresponding to the views are sequentially arranged from left to right in the adding order, and when the remaining width of the layout view does not accommodate the width of the new sub-view to be inserted next, another row is formed, and the new sub-view is arranged from left to right again.

In the page development process, the layout engine determines the direction information of the nodes according to the second direction parameter, and on the basis, the first direction parameter is provided in the embodiment of the application, and the parameter value of the first direction parameter can be inherited from the node of the previous level, so that each node is not required to be set respectively, and the development efficiency and the reusability can be improved.

In an optional embodiment, the determining the direction information of the node according to the parameter value of the first direction parameter includes: determining a parameter value of a second direction parameter of the node, wherein the second direction parameter is used for determining the direction of the node corresponding to the streaming layout; and determining the direction information of the node according to the parameter value of the second direction parameter and the parameter value of the first direction parameter. The parameter value of the second direction parameter corresponding to the node may be obtained, and the parameter value may be determined according to the direction of the streaming layout, such as a horizontal layout from right to left corresponding to the row direction, and then the direction information of the node is determined according to the parameter value of the second direction parameter and the parameter value of the first direction parameter.

In one example, the parameter values of the second direction parameter (FlexDirection) include: a row forward parameter value (row), a row reverse parameter value (row-reverse), a column forward parameter value (column), and a column reverse parameter value (column-reverse), wherein the row forward parameter value row is a default value, which means that a flexible item (such as node content) will be displayed horizontally just like a row; the row direction parameter value row-reverse is the same as row, but in the opposite order; column forward parameter value column means that flexible items (such as node contents) are to be displayed vertically, just like a column; column reverse parameter value column-reverse is the same as column, but in reverse order. The direction information of the node comprises at least one of the following: the horizontal layout from right to left corresponding to the row direction, the horizontal layout from left to right corresponding to the row direction, the vertical layout from right to left corresponding to the column direction and the vertical layout from left to right corresponding to the column direction.

In one example, as in the direction information determination example shown in fig. 4, the default is from left to right as an example:

step 402, judging whether the parameter value of the second direction parameter of the node is a row forward parameter value; if yes, go to step 404; if not, go to step 410.

Step 404, judging whether the parameter value of the first direction parameter of the node is from right to left; if yes, go to step 406; if not, go to step 408.

Step 406, determining the direction information of the node as a horizontal layout horizon layout (rtl) from right to left.

Step 408, determining the direction information of the node as horizontal layout horizonlayout (ltr) from left to right.

Step 410, judging whether the parameter value of the second direction parameter is a row reverse parameter value; if yes, go to step 412, otherwise go to step 414.

Step 412, judging whether the parameter value of the first direction parameter is from right to left; if yes, go to step 408; if not, go to step 406.

Step 414, determining whether the parameter value of the second direction parameter is a column parameter value; if so, go to step 416, otherwise go to step 422.

Step 416, judging whether the parameter value of the first direction parameter is from right to left; if yes, go to step 418; if not, go to step 420.

Step 418, determining the direction information of the node as vertical layout (rtl) from right to left.

Step 420, determining the direction information of the node as a vertical layout (ltr) from left to right.

In step 422, it is determined whether the parameter value of the second direction parameter is the column inversion parameter value, if so, step 424 is executed, and if not, the process is ended.

Step 424, determining whether the parameter value of the first direction parameter is from right to left; if yes, go to step 420; if not, go to step 418.

Thus, for each node, the third direction parameter direction of the page Cascading Style Sheets (CSS) and the first direction parameter resultDirection may be determined, and the second direction parameter FlexDirection of the layout engine corresponding to the streaming layout may determine the direction information.

Step 208, if the direction information is opposite to the default display direction of the view corresponding to the node, adjusting the display direction of the view corresponding to the node.

After the direction information of the node is determined, the view corresponding to the node can be set according to the direction information. And if the direction information set by the node is opposite to the default display direction of the view corresponding to the node, adjusting the display direction of the view corresponding to the node to be consistent with the direction information.

In an optional embodiment, the default display direction of the page is layout display from left to right, if the determined direction information is from left to right, the view corresponding to the node may be set according to the direction information, and if the determined direction is from right to left, that is, if the determined direction information is opposite to the default display direction of the view corresponding to the node, the view corresponding to the node may be adjusted. For example, by affine transformation, adjusting the attribute of the view, and the like, the display direction of the view corresponding to the node is adjusted, so as to implement right-to-left layout, and as shown in the page part area shown in fig. 1, the ABCD displayed from left to right in layout is adjusted to the ABCD displayed from right to left in layout. Optionally, the adjusting the display direction of the view corresponding to the node includes: setting the attribute of the view corresponding to the node according to the direction information; and/or adjusting the view corresponding to the node through affine transformation.

In an alternative example, the direction-dependent property of the view corresponding to the node may be adjusted, so as to realize a layout display from right to left. Taking an Android system as an example, the left attribute may be assigned to a MarginStart, the top may be assigned to a MarginTop, and the layout direction attribute layout of View is set to RTL (from right to left), so that the layout is adjusted as shown in fig. 1.

In another optional example, if the direction information is opposite to the default display direction of the view corresponding to the node, the view corresponding to the node is adjusted through affine transformation. The affine transformation of the embodiment of the present application includes a mirroring process of adjusting the direction of the view by mirroring the view. Wherein the radial transformation process may include two affine transformations: affine transformation is firstly carried out on the container view corresponding to the node, and then affine transformation is carried out on each sub-view corresponding to the container view, so that the direction of the view corresponding to the node is adjusted, for example, from right to left.

In the twice affine transformation process in the embodiment of the present application, taking the iOS system as an example, the node corresponding view includes a view of the container and a sub-view in the container view. The View of the container corresponding to the node can be subjected to affine transformation such as mirroring, wherein the View of the container is responsible for scrolling interaction, the sub-View corresponding to the container is the content being displayed, and therefore the mirroring processing on the container does not affect the displayed content, but the interaction and the sub-View are reversed, so that the sub-View can be subjected to affine transformation such as mirroring again, and therefore the content in the sub-View undergoes two times of mirroring and can be restored to the forward direction, namely the content displayed in the page is the forward direction, and the interaction and layout are reversed, so that the direction can be adjusted from left to right to left.

In the partial page example shown in fig. 5, the initial page is the first page example, where the solid line box is the horizontal scrolling container visible window and the dashed line box is the size of the node corresponding content (contentSize), where the content outside the visible window, i.e. the solid line box, can be displayed by scrolling. The first mirroring is performed on the container view, each content related to the container can be mirrored to obtain a second page example, the interaction, the layout and the content are all reversed at this time, then the second mirroring is performed on each sub-view, that is, the node corresponds to the content, so that the content is mirrored and displayed in the forward direction, the content in the page is displayed as a mirror image through two mirroring, and the interaction and layout image is reversed, so that the adjustment from left to right from right to left is realized.

In the embodiment of the application, on the basis of the existing third direction parameter FlexDirection of a layout engine, the first direction parameter for development and setting and the third direction parameter with the same level as the third direction parameter are introduced, so that the change of the existing system is reduced, the reusability is improved, and the development efficiency is improved.

On the basis of the above embodiments, the embodiments of the present application further provide a data processing method, taking the default direction as left to right as an example:

referring to FIG. 6, a flow chart of steps of another data processing method embodiment of the present application is shown.

Step 602, determining a third direction parameter of a node in a page.

Step 604, determining whether the parameter value of the third direction parameter is inherited. If so, go to step 608, otherwise, go to step 606. Whether inheritance is required may be determined based on whether a parameter value of the third-direction parameter is set, and may be unnecessary if the parameter value is set, or may be inherited if the parameter value is not set.

Step 606, taking the parameter value of the third direction parameter of the node as the parameter value of the first direction parameter.

Step 608, determine if the node has a previous node. If yes, go to step 610, otherwise go to step 612.

Step 610, determining the parameter value of the first direction parameter of the node at the previous stage of the node as the parameter value of the first direction parameter of the node.

Step 612, setting the parameter value of the first direction parameter of the node as a default value. For the root node, if the parameter value of the third direction parameter is not set, the parameter value of the first direction parameter of the root node may be set as a default value.

Step 614, determining a parameter value of the second direction parameter of the node.

Step 616, determining the direction information of the node according to the parameter value of the second direction parameter and the parameter value of the first direction parameter.

The process of determining the direction information is similar to the above example corresponding to fig. 4, and therefore is not described again.

Step 618, determine whether the direction information is the same as the default display direction of the view corresponding to the node. If the two are the same, the process is ended, otherwise, step 620 is executed.

And step 620, setting the attribute of the view corresponding to the node according to the direction information.

And setting a view corresponding to the node according to the direction information, wherein if the direction information is the same as the default direction of the view, the direction information does not need to be changed, and if the direction information is opposite to the default direction of the view, the direction related attribute of the view corresponding to the node can be adjusted, so that layout display from right to left is realized. Taking an Android system as an example, the left attribute may be assigned to a MarginStart, the top may be assigned to a MarginTop, and the layout direction attribute layout of View is set to RTL (from right to left), so that the layout is adjusted as shown in fig. 1.

Therefore, for the pages of the application programs in each android system, the weex page display can be adjusted from the left-to-right layout to the right-to-left layout through the process.

On the basis of the above embodiments, the embodiments of the present application further provide a data processing method, which can adjust the content direction corresponding to the node through two affine transformations. Take the default direction as left to right as an example:

referring to FIG. 7, a flowchart illustrating steps of yet another data processing method embodiment of the present application is shown.

Step 702, determining a third direction parameter of a node in the page.

Step 704, determining whether the parameter value of the third direction parameter is inherited. If so, go to step 708, otherwise go to step 706. Whether inheritance is required may be determined based on whether a parameter value of the third-direction parameter is set, and may be unnecessary if the parameter value is set, or may be inherited if the parameter value is not set.

Step 706, using the parameter value of the third direction parameter of the node as the parameter value of the first direction parameter.

Step 708, determine whether the node has a previous node. If so, go to step 710, otherwise, go to step 712.

Step 710, determining a parameter value of the first direction parameter of the node at the previous stage of the node as a parameter value of the first direction parameter of the node.

Step 712, setting a parameter value of the first direction parameter of the node as a default value. For the root node, if the parameter value of the third direction parameter is not set, the parameter value of the first direction parameter of the root node may be set as a default value.

Step 714, determining a parameter value of a second direction parameter of the node.

Step 716, determining the direction information of the node according to the parameter value of the first direction parameter and the parameter value of the second direction parameter.

The process of determining the direction information is similar to the above example corresponding to fig. 4, and therefore is not described again.

Step 618, determine whether the direction information is the same as the default display direction of the view corresponding to the node. If the two are the same, the process is ended, otherwise, step 720 is executed.

If the direction information is opposite to the default direction of the view corresponding to the node, if the default direction is from left to right, and the determined direction information is from right to left, the following steps can be executed:

and 720, carrying out affine transformation on the container view corresponding to the node, and then carrying out affine transformation on each sub-view corresponding to the container view.

Therefore, for the pages of the application programs in each iOS system, the page display can be adjusted from the layout from left to right to the layout from right to left through the process.

In the embodiment of the application, the js (javascript) end may determine a third direction parameter of an Application (APP), and then determine whether a parameter value of the third direction parameter is set to determine whether inheritance is required, for example, whether to follow the system direction by self-selection, and default LTR when no setting is made, and the like. If the front end sets 'direction: RTL' for the root node, each Element of the base class is represented as RTL layout, so that the 'direction: RTL' does not need to be set for each Element, and the transformation cost of page adaptation is reduced. In the embodiment of the present application, the experience of the scrolling container, which may also be through adjustment of the node view in the page, conforms to RTL, in which case, the first element of the scrolling container is at the rightmost side and is aligned to the right, and the scrolling direction is from right to left.

According to the method and the device, the RTL layout style can be uniformly solved at the level of a Software Development Kit (SDK), the method and the device can be applied to all service scenes, a page intrusion program is small, and after the parameter value of the third direction parameter of a root node (namely a root node) is designated, the RTL layout setting of the whole page can be completed in an inheritance mode.

In the embodiment of the present application, the default left-to-right is taken as an example, and if the default right-to-left is used in the actual processing, and it is detected that the layout needs to be adjusted to left-to-right, the method may also be performed in a manner similar to that in the above-mentioned embodiment, and the direction may be adjusted as needed.

It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred and that no particular act is required of the embodiments of the application.

On the basis of the foregoing embodiments, the present embodiment further provides a data processing apparatus, which is applied to electronic devices such as a server (cluster) and a terminal device.

Referring to fig. 8, a block diagram of a data processing apparatus according to an embodiment of the present application is shown, which may specifically include the following modules:

the node determining module 802 is configured to determine a node in a page and a node at a previous stage of the node.

A parameter value determining module 804, configured to determine a parameter value of the first direction parameter of the previous-stage node as a parameter value of the first direction parameter of the node.

A direction determining module 806, configured to determine, according to a parameter value of the first direction parameter, direction information of the node.

A direction adjusting module 808, configured to adjust the display direction of the view corresponding to the node if the direction information is opposite to the default display direction of the view corresponding to the node.

In summary, the nodes in the page and the nodes at the previous level of the nodes are determined, then the parameter value of the first direction parameter of the node at the previous level is determined as the parameter value of the first direction parameter of the node, the first direction parameter of the node can inherit the first direction parameter of the node at the previous level, and then the direction information of the node is determined according to the parameter value of the first direction parameter, so that each node can automatically detect and adjust the direction, and the method is suitable for development of various pages, has better reusability, and can improve the development efficiency of the pages.

Referring to fig. 9, a block diagram of another data processing apparatus according to another embodiment of the present application is shown, which may specifically include the following modules:

the node determining module 802 is configured to determine a node in a page and a node at a previous stage of the node.

A parameter value determining module 804, configured to determine a parameter value of the first direction parameter of the previous-stage node as a parameter value of the first direction parameter of the node.

A direction determining module 806, configured to determine, according to a parameter value of the first direction parameter, direction information of the node.

A direction adjusting module 808, configured to adjust the display direction of the view corresponding to the node if the direction information is opposite to the default display direction of the view corresponding to the node.

Wherein the direction adjustment module 808 comprises: attribute tuning sub-module 8082 and transformation sub-module 8084:

the attribute adjusting submodule 8082 is configured to set an attribute of the view corresponding to the node according to the direction information.

The transformation submodule 8084 is configured to adjust the view corresponding to the node through affine transformation.

Further, the transformation submodule 8084 is configured to perform affine transformation on the container view corresponding to the node, and then perform affine transformation on each sub-view corresponding to the container view.

The direction determining module 806 is configured to determine a parameter value of a second direction parameter of the node, where the second direction parameter is used to determine a direction of the streaming layout corresponding to the node; and determining the direction information of the node according to the parameter value of the second direction parameter and the parameter value of the first direction parameter.

In this embodiment of the present application, the parameter values of the first direction parameter include from left to right, and/or from right to left; the direction information of the node comprises: the horizontal layout from right to left corresponding to the row direction, the horizontal layout from left to right corresponding to the row direction, the vertical layout from right to left corresponding to the column direction, and/or the vertical layout from left to right corresponding to the column direction. The parameter values of the second direction parameter include: a row forward parameter value, a row reverse parameter value, a column forward parameter value, and/or a column reverse parameter value.

The parameter value determining module 804 is further configured to determine a parameter value of a third direction parameter of the root node; and taking the parameter value of the third direction parameter as the parameter value of the first direction parameter of the root node.

In the embodiment of the application, the js (javascript) end may determine a third direction parameter of an Application (APP), and then determine whether a parameter value of the third direction parameter is set to determine whether inheritance is required, for example, whether to follow the system direction by self-selection, and default LTR when no setting is made, and the like. If the front end sets 'direction: RTL' for the root node, each Element of the base class is represented as RTL layout, so that the 'direction: RTL' does not need to be set for each Element, and the transformation cost of page adaptation is reduced. In the embodiment of the present application, the experience of the scrolling container, which may also be through adjustment of the node view in the page, conforms to RTL, in which case, the first element of the scrolling container is at the rightmost side and is aligned to the right, and the scrolling direction is from right to left.

According to the method and the device, the RTL layout style can be uniformly solved at the level of a Software Development Kit (SDK), the method and the device can be applied to all service scenes, a page intrusion program is small, and after the parameter value of the third direction parameter of a root node (namely a root node) is designated, the RTL layout setting of the whole page can be completed in an inheritance mode.

In the embodiment of the present application, the default left-to-right is taken as an example, and if the default right-to-left is used in the actual processing, and it is detected that the layout needs to be adjusted to left-to-right, the method may also be performed in a manner similar to that in the above-mentioned embodiment, and the direction may be adjusted as needed.

The present application further provides a non-transitory, readable storage medium, where one or more modules (programs) are stored, and when the one or more modules are applied to a device, the device may execute instructions (instructions) of method steps in this application.

Embodiments of the present application provide one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause an electronic device to perform the methods as described in one or more of the above embodiments. In the embodiment of the application, the electronic device includes a server (cluster), a mobile device, a terminal device, and the like.

Embodiments of the present disclosure may be implemented as an apparatus, which may include electronic devices such as servers (clusters), mobile devices, terminal devices, etc., using any suitable hardware, firmware, software, or any combination thereof, for a desired configuration. Fig. 10 schematically illustrates an example apparatus 1000 that may be used to implement various embodiments described herein.

For one embodiment, fig. 10 illustrates an example apparatus 1000 having one or more processors 1002, a control module (chipset) 1004 coupled to at least one of the processor(s) 1002, memory 1006 coupled to the control module 1004, non-volatile memory (NVM)/storage 1008 coupled to the control module 1004, one or more input/output devices 1010 coupled to the control module 1004, and a network interface 1012 coupled to the control module 1004.

The processor 1002 may include one or more single-core or multi-core processors, and the processor 1002 may include any combination of general-purpose or special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the apparatus 1000 can be used as a server (cluster), a mobile device, a terminal device, and the like in this embodiment.

In some embodiments, the apparatus 1000 may include one or more computer-readable media (e.g., the memory 1006 or the NVM/storage 1008) having instructions 1014 and one or more processors 1002 that, in conjunction with the one or more computer-readable media, are configured to execute the instructions 1014 to implement modules to perform the actions described in this disclosure.

For one embodiment, control module 1004 may include any suitable interface controllers to provide any suitable interface to at least one of the processor(s) 1002 and/or any suitable device or component in communication with control module 1004.

The control module 1004 may include a memory controller module to provide an interface to the memory 1006. The memory controller module may be a hardware module, a software module, and/or a firmware module.

Memory 1006 may be used, for example, to load and store data and/or instructions 1014 for device 1000. For one embodiment, memory 1006 may comprise any suitable volatile memory, such as suitable DRAM. In some embodiments, the memory 1006 may comprise a double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

For one embodiment, the control module 1004 may include one or more input/output controllers to provide an interface to the NVM/storage 1008 and input/output device(s) 1010.

For example, NVM/storage 1008 may be used to store data and/or instructions 1014. NVM/storage 1008 may include any suitable non-volatile memory (e.g., flash memory) and/or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drive(s) (HDD (s)), one or more Compact Disc (CD) drive(s), and/or one or more Digital Versatile Disc (DVD) drive (s)).

The NVM/storage 1008 may include storage resources that are physically part of the device on which the apparatus 1000 is installed, or it may be accessible by the device and need not be part of the device. For example, NVM/storage 1008 may be accessed over a network via input/output device(s) 1010.

Input/output device(s) 1010 may provide an interface for apparatus 1000 to communicate with any other suitable device, input/output devices 1010 may include communication components, audio components, sensor components, and so forth. Network interface 1012 may provide an interface for device 1000 to communicate over one or more networks, and device 1000 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and/or protocols, such as to access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, etc., or a combination thereof.

For one embodiment, at least one of the processor(s) 1002 may be packaged together with logic for one or more controller(s) (e.g., memory controller module) of control module 1004. For one embodiment, at least one of the processor(s) 1002 may be packaged together with logic for one or more controller(s) of control module 1004 to form a System In Package (SiP). For one embodiment, at least one of the processor(s) 1002 may be integrated on the same die with the logic of one or more controllers of the control module 1004. For one embodiment, at least one of the processor(s) 1002 may be integrated on the same die with logic for one or more controller(s) of control module 1004 to form a system on chip (SoC).

In various embodiments, the apparatus 1000 may be, but is not limited to: a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.), among other terminal devices. In various embodiments, the apparatus 1000 may have more or fewer components and/or different architectures. For example, in some embodiments, device 1000 includes one or more cameras, a keyboard, a Liquid Crystal Display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an Application Specific Integrated Circuit (ASIC), and speakers.

An embodiment of the present application provides an electronic device, including: one or more processors; and one or more machine readable media having instructions stored thereon, which when executed by the one or more processors, cause the server to perform a data processing method as described in one or more of the embodiments of the application.

For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.

The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.

Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.

Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.

The foregoing detailed description has provided a data processing method and apparatus, an electronic device, and a storage medium, and the principles and embodiments of the present application are described herein using specific examples, which are merely used to help understand the method and its core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

22页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于深度学习的文本数据制造方法、装置、终端及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!