1. Technical Field
Embodiments of the present disclosure relate generally to webpage design, and particularly to an apparatus and method for data source control conversion.
2. Description of Related Art
Many webpages include a plurality of data source controls. Controls binding data sources are defined as data source controls. For example, controls binding one-dimensional data source (e.g., one-dimensional array) are defined as one-dimensional data source controls. Controls binding two-dimensional data source (e.g., two-dimensional array) are defined as two-dimensional data source controls. For particular reasons, two one-dimensional data source controls of a webpage may need to be combined to a two-dimensional data source control binding a two-dimensional data source which is a Cartesian product of the two one-dimensional data sources of the two one-dimensional data source controls. However, redesigning of the webpage and development of a new two-dimensional data source control are required for combining the two one-dimensional data source controls, which is very inconvenient and time consuming. Therefore, there is room for improvement in the art.
The disclosure, including the accompanying drawings, is illustrated by way of example and not by way of limitation. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one.”
The control conversion system 10 may include a plurality of programs in the form of one or more computerized instructions stored in the storage 11 and executed by the processor 12 to perform operations of the computing device 1. In the embodiment, the control conversion system 10 includes a loading module 101, an acquisition module 102, a conversion module 103, a display module 104, and an exporting module 105.
In general, the word “module”, as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an EPROM. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable medium include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives.
Referring to
In step S01 the loading module 101 loads a target webpage having at least two separate one-dimensional data source controls. In one example, as shown in
In step S02, the acquisition module 102 acquires reference information of a first control and a second control of the target webpage, and acquires one-dimensional data source and columns of each of the first control and of the second control according to the reference information of the first control and of the second control. In the embodiment, both the first control and the second control are one-dimensional controls (e.g., the control W1 and W2 of
In step S03, the conversion module 103 converts the first control and the second control into a single two-dimensional data source control according to the one-dimensional data source and columns of each of the first control and the second control. In one example, it assumes that the first control (e.g., W1 of
First, the conversion module 103 creates a data sheet having i rows and j columns. Then, the conversion module 103 calculates a Cartesian product of the data source S of the first control and the data source T of the second control, to obtain a two-dimensional data source D{(S1, T1), (S1, T2) . . . (S1, Tj); (S2, T1), (S2, T2) . . . (S2, Tj); . . . ; (S1, T1), (S1, T2) . . . (Si, Tj)}. Additionally, the conversion module 103 inputs each element (Si, Tj) of the two-dimensional data source D into a cell corresponding to the ith row and jth column of the data sheet, thereby generating a two-dimensional data source control binding the two-dimensional data source D. In one example, as shown in
In step S04, the display module 104 deletes the first control and the second control from the target webpage, and displays the generated two-dimensional data source control on the target webpage. In the embodiment, the two-dimensional data source control may be displayed at a location of the first control or a location of the second control on the target webpage, according to requirements. The location of the first control and the location of the second control is determined according to the source code file of the target webpage.
In step S05, the exporting module 105 exports the target webpage and stores the target webpage when the two-dimensional data source control is displayed on the target webpage.
Although certain embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201210078862.7 | Mar 2012 | CN | national |