Abstract:
A method for redrawing a Widget is provided, which specifically includes: creating a three-dimensional container, and inserting a Widget with plane coordinates and a Z coordinate into the 3D container; informing the three-dimensional container when the Widget is changed; determining, by the three-dimensional container, whether the Z coordinate of the changed Widget is equal to a Z coordinate of another Widget, if yes, performing a redrawing according to a Widget redrawing flow on the same plane, otherwise, redrawing the changed Widget and completing the redrawing. An apparatus for redrawing a Widget is further provided. By means of the above method and apparatus, Widgets in different layers can be redrawn without a redundant redrawing operation, so that a refresh efficiency of a display interface is improved

Description:
TECHNICAL FIELD 
       [0001]    The present disclosure relates to a technology for display refresh of a Man-Machine Interface (MMI) on a terminal device, and particularly to a method and an apparatus for redrawing of a Widget. 
       BACKGROUND 
       [0002]    A BREW UI Widget (BUIW) is a new UI-package developed by an American Qualcomm after 2004. The BUIW is a User Interface (UI) management framework based on a Binary Runtime Environment for Wireless (BREW). Through integration and organization of UI elements such as man-machine interaction, event handling, interface display and the like, a BREW UI programmer may easily develop a BREW UI application program. 
         [0003]    A Widget in the BUIW is used to display a specific UI such as a text, an image and the like on a screen, and the Widget has a specific extent and can interact with a user by responding a keying or a clicking. The Widget is put into a container which is responsible to organize and manage an internal Widget, for example a layout of the Widget, event handling and the like. 
         [0004]    A container may have many different Widgets and can record positions of all the Widgets. When one Widget in the container is changed and needs to be redisplayed, the Widget should inform the container in advance; and the container determines which Widget needs to be redrawn according to an overlapping region of the respective Widgets, and then informs a display position and a region of the Widget needing to be redrawn to the Widget to refresh itself. The more accurate a calculation of an overlapping region is, the smaller a region needing to be redrawn is and the higher a redrawing efficiency is. 
         [0005]      FIG. 1  is an effect drawing of an overlapping region of Widgets in an existing calculation container of a BUIW. As shown in  FIG. 1 , there are two Widgets in the two-dimensional (2D) container, which are a Widget_ 1  and a Widget_ 2 ; and the 2D container records X coordinates and Y coordinates of the two Widgets, and the Widgets record their own width (W) and height (H) respectively. In this way, according to the X coordinates and Y coordinates of the two Widgets and the W and H obtained from the two Widgets, the container may calculate an overlapping region of the two Widgets in the container, and thus redraw the Widget_ 1  and the Widget_ 2  according to the overlapping region. 
         [0006]    The drawback of the existing method is that: only plane coordinates of the Widgets, i.e., the X coordinates and Y coordinates, are recorded in the container; however, if the two Widgets are distributed in different layers, as the container can only calculate the X coordinates and the Y coordinates by the current calculation method, the container can still obtain an overlapping region through a calculation; therefore, when such an error occurs, the container will carry out a redundant redrawing operation, thereby resulting in a low refresh efficiency of a display interface. 
       SUMMARY 
       [0007]    In view of the problem above, the main purpose of the present disclosure is to provide a method and an apparatus for redrawing a Widget, which can effectively avoid a redundant redrawing operation during redrawing of the Widgets on different layers. 
         [0008]    In order to achieve the purpose above, the technical solution of the present disclosure is realized as follows. 
         [0009]    The present disclosure provides a method for redrawing a Widget, which includes: 
         [0010]    creating a three-dimensional (3D) container, and inserting a Widget with plane coordinates and a Z coordinate into the 3D container; and 
         [0011]    informing the 3D container when the Widget is changed; determining, by the 3D container, whether the Z coordinate of the changed Widget is equal to a Z coordinate of another Widget, and, if yes, performing a redrawing according to a Widget redrawing flow on the same plane, otherwise, redrawing the changed Widget. 
         [0012]    Wherein, the 3D container may include: an X coordinate of a plane, a Y coordinate of the plane, and a Z coordinate perpendicular to the plane formed by the X coordinate and the Y coordinate. 
         [0013]    Wherein, the another Widget may include: one or more Widgets in the 3D container except the changed Widget. 
         [0014]    Wherein, the step of determining by the 3D container whether the Z coordinate of the changed Widget is equal to the Z coordinate of the another Widget may include: determining whether the Z coordinate of each of the one or more Widgets is equal to the Z coordinate of the changed Widget. 
         [0015]    Wherein, the Widget redrawing flow on the same plane may include: determining, according to a display range of the changed Widget and a display range of the another Widget on the same plane, whether there is an overlapping region between the display range of the changed Widget and the display range of the another Widget, if yes, redrawing the another Widget at first and then redrawing the changed Widget at last, otherwise, directly redrawing the changed Widget. 
         [0016]    Wherein, the display range may be calculated according to the X coordinate and the Y coordinate of the plane of the Widget, a width of the Widget and a height of the Widget. 
         [0017]    The present disclosure further provides an apparatus for redrawing a Widget, which includes: a container module and a Widget module, wherein 
         [0018]    the container module is configured to create a three-dimensional (3D) container, receive a notification message from the Widget module, determine whether a Z coordinate of a changed Widget is equal to a Z coordinate of another Widget, if yes, perform a redrawing according to a Widget redrawing flow on the same plane, otherwise, redraw the changed Widget; and 
         [0019]    the Widget module is configured to insert a Widget with plane coordinates and a Z coordinate into the 3D container created by the container module, and send the notification message to the container module. 
         [0020]    Wherein, the 3D container created by the container module may include: an X coordinate of a plane, a Y coordinate of the plane, and a Z coordinate perpendicular to the plane formed by the X coordinate and the Y coordinate. 
         [0021]    Wherein, the another Widget may include: one or more Widgets in the 3D container except the changed Widget. 
         [0022]    Wherein, the container module may be configured to determine whether the Z coordinate of the changed Widget is equal to the Z coordinate of the another Widget through a following way: 
         [0023]    determine whether the Z coordinate of each of the one or more Widgets is equal to the Z coordinate of the changed Widget. 
         [0024]    The method and the apparatus for redrawing a Widget according to the present disclosure include: creating a three-dimensional container, and inserting a Widget with plane coordinates and a Z coordinate into the 3D container; informing the three-dimensional container when the Widget is changed; determining, by the three-dimensional container, whether the Z coordinate of the changed Widget is equal to a Z coordinate of another Widget, if yes, performing a redrawing according to a Widget redrawing flow on the same plane, otherwise, redrawing the changed Widget. By adding the Z coordinate only, the present disclosure can avoid a redundant redrawing operation during redrawing of Widgets on different layers, and thus improve a refresh efficiency of a display interface. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0025]      FIG. 1  is an effect drawing of an overlapping region of Widgets in an existing calculation container of a BUIW; 
           [0026]      FIG. 2  is a flow diagram of a method for redrawing a Widget according to the present disclosure; 
           [0027]      FIG. 3  is a rendering of a 3D container supporting a Z coordinate according to the present disclosure; 
           [0028]      FIG. 4  is a flow diagram of a specific example of a method for creating a 3D container and inserting a Widget with plane coordinates and a Z coordinate into the 3D container according to the present disclosure; and 
           [0029]      FIG. 5  is a structure diagram of an apparatus for redrawing a Widget according to the present disclosure. 
       
    
    
     DETAILED DESCRIPTION 
       [0030]    The basic idea of the present disclosure is: creating a 3D container, and inserting a Widget with plane coordinates and a Z coordinate into the 3D container; informing the 3D container when the Widget is changed; determining by the 3D container whether the Z coordinate of the changed Widget is equal to a Z coordinate of another Widget, if yes, performing a redrawing according to a Widget redrawing flow on the same plane, otherwise, redrawing the changed Widget and completing a redrawing. 
         [0031]    The technical solution of the present disclosure will be described in combination with the accompanying drawings and specific embodiments hereinafter. 
         [0032]      FIG. 2  is a flow diagram of a method for redrawing a Widget according to the present disclosure; as shown in  FIG. 2 , the method for redrawing a Widget specifically includes the following steps. 
         [0033]    Step  201 , a 3D container is created, and a Widget with plane coordinates and a Z coordinate is inserted into the 3D container. 
         [0034]    Specifically, the plane coordinates include an X coordinate of a plane, a Y coordinate of the plane, and the Z coordinate is perpendicular to the plane formed by the X coordinate and the Y coordinate. 
         [0035]      FIG. 3  is an effect drawing of a 3D container supporting a Z coordinate according to the present disclosure; as shown in  FIG. 3 , in the 3D container, a Widget_ 1  and a Widget_ 2  both have X coordinates, Y coordinates, and Z coordinates indicating that the Widget_ 1  and the Widget_ 2  are on different planes. Meanwhile, the Widget_ 1  and the Widget_ 2  further have a W 1  and an H 1 , and a W 2  and an H 2  respectively, which indicates their respective extents. 
         [0036]    Step  202 , when the Widget is changed, the 3D container is informed to perform a redrawing. 
         [0037]    Specifically, when the position or extent of the Widget is changed, the 3D container will be informed to perform a redrawing. The X coordinate, Y coordinate, Z coordinate, W and H of the Widget needing to be redrawn are carried in a notification message for notifying the container. The change of the Widget is triggered by a user through a man-machine operation, wherein the change of the Widget may be: enlarging or reducing the Widget that displays an image, or moving the Widget. 
         [0038]    Step  203 , the 3D container determines whether the Z coordinate of the changed Widget is equal to a Z coordinate of another Widget, if yes, Step  204  is executed, otherwise, Step  205  is executed. 
         [0039]    Specifically, the 3D container records the X coordinates, Y coordinates and Z coordinates of all Widgets respectively, and the Widgets record their respective W and H. The another Widget includes: other one or more Widgets in the 3D container. When the 3D container has other more Widgets, the 3D container determines respectively and successively whether a Z coordinate of each of the other more Widgets is equal to the Z coordinate of the changed Widget, wherein if a determining result is that there is one or more Widgets with the equal Z coordinate, then it means that these Widgets and the changed Widget are located on the same plane, and Step  204  is executed specific to these Widgets and the changed Widget; since other Widgets with an unequal Z coordinate are located on different planes, the other Widgets do not need to be redrawn; if there are no Widget with the equal Z coordinate, Step  205  will be executed. 
         [0040]    Step  204 , a redrawing is performed according to a Widget redrawing flow on the same plane, and a current processing flow is ended. 
         [0041]    Specifically, the Widget redrawing flow on the same plane includes: determining, according to a display range of the changed Widget and a display range of another Widget on the same plane, whether there is an overlapping region between the display range of the changed Widget and the display range of the another Widget, if yes, redrawing the other Widget at first and the changed Widget at last, otherwise, directly redrawing the changed Widget and completing the redrawing. Wherein, the display range is calculated according to the X coordinate, Y coordinate, W and H of the Widget. The display range obtained by the calculation is from X to X+W on a horizontal axis, and from Y to Y+H on a vertical axis. The determination of the overlapping region is to compare the display ranges of the two Widgets, for example, the display range of the Widget_ 1  is from X 1  to X 1 +W 1 , and from Y 1  to Y 1 +H 1 ; the display range of the Widget_ 2  is from X 2  to X 2 +W 2 , and from Y 2  to Y 2 +H 2 ; and when X 2  or X 2 +W 2  is located between X 1  and X 1 +W 1  and Y 2  or Y 2 +H 2  is located between Y 1  and Y 1 +H 1 , the Widget_ 2  and the Widget_ 1  have an overlapping region. 
         [0042]    Step  205 , the changed Widget is redrawn, and a current processing flow is ended. 
         [0043]    Specifically, the changed Widget is redrawn refers to that after the Widget is changed, the container determines the display range of the changed Widget according to the X coordinate, Y coordinate, W and H of the changed Widget and then performs the redrawing. 
         [0044]      FIG. 4  is a flow diagram of a specific example of a method for creating a 3D container and inserting a Widget with plane coordinates and a Z coordinate into the 3D container according to the present disclosure; as shown in  FIG. 4 , the method specifically includes the following steps. 
         [0045]    Step  401 : a new form is created, wherein the form is a carrier of a container and a Widget; 
         [0046]    Step  402 : a 3D container which belongs to the form is created; 
         [0047]    specifically, an X coordinate, a Y coordinate and a Z coordinate may be saved in the 3D container; 
         [0048]    Step  403 : it is determined whether the 3D container is successfully created, if yes, Step  404  is executed; otherwise, Step  412  is executed; 
         [0049]    Step  404 : a Widget  1  (Widget_ 1 ) is created; 
         [0050]    Step  405 : it is determined whether the Widget_ 1  is successfully created, if yes, Step  406  is executed; otherwise, Step  412  is executed; 
         [0051]    Step  406 : an extent of the Widget_ 1 : a W 1  and an H 1 , is set; 
         [0052]    Step  407 : the Widget_ 1  is inserted into the container, and the coordinates of the Widget_ 1  in the container: X 1 , Y 1 , and Z 1 , are transmitted into the container; 
         [0053]    Step  408 : a Widget  2  (Widget_ 2 ) is created; 
         [0054]    Step  409 : it is determined whether the Widget_ 2  is successfully created, if yes, Step  410  is executed; otherwise, Step  412  is executed; 
         [0055]    Step  410 : an extent of the Widget_ 2 : a W 2  and an H 2 , is set; 
         [0056]    Step  411 : the Widget_ 2  is inserted into the container, and the coordinates of Widget_ 2  in the container: X 2 , Y 2 , and Z 2 , are transmitted into the container; 
         [0057]    Step  412 : the flow is ended. 
         [0058]      FIG. 5  is a structure diagram of an apparatus for redrawing a Widget according to the present disclosure; as shown in  FIG. 5 , the apparatus for redrawing a Widget specifically includes: a container module  51  and a Widget module  52 , wherein, 
         [0059]    the container module  51  is configured to create a 3D container, receive a notification message from the Widget module  52 , determine whether a Z coordinate of the changed Widget is equal to a Z coordinate of another Widget, if yes, perform a redrawing according to a Widget redrawing flow on the same plane, otherwise redraw the changed Widget and completing the redrawing; 
         [0060]    specifically, the 3D container created by the container module includes: an X coordinate of a plane, a Y coordinate of the plane, and a Z coordinate perpendicular to the plane formed by the X coordinate and the Y coordinate; and the another Widget may include: one or more Widgets in the 3D container; 
         [0061]    when the 3D container has other more Widgets, it is determined respectively whether the Z coordinate of each of the other more Widgets is equal to the Z coordinate of the changed Widget; when the changed Widget is compared with the other more Widgets, if there is one or more equal Z coordinates, only the Widgets with the equal Z coordinate need to be redrawn according to the Widget redrawing flow on the same plane; since other Widgets with unequal Z coordinates are located on different planes, the other Widgets do not need to be redrawn; if there are no Widget with the equal Z coordinate, only the changed Widget is redrawn; wherein the changed Widget is redrawn refers to that after the Widget is changed, the container determines the display range of the Widget according to the X coordinate, Y coordinate, W and H of the changed Widget and then performs a redrawing; 
         [0062]    the Widget redrawing flow on the same plane includes: determining, according to the display range of the changed Widget and the display range of another Widget on the same plane, whether there is an overlapping region between the display range of the changed Widget and the display range of the another Widget, if yes, redrawing the other Widget at first and the changed Widget at last; otherwise, directly redrawing the changed Widget and completing the redrawing; wherein, the display range is calculated according to the X coordinate, Y coordinate, W and H of the Widget; and 
         [0063]    the Widget module  52  is configured to insert a Widget with plane coordinates and a Z coordinate into a 3D container created by the container module  51 , and send a notification message to the container module  51 ; 
         [0064]    specifically, the plane coordinates include the X coordinate and the Y coordinate; the Z coordinate is perpendicular to the plane formed by the X coordinate and the Y coordinate; and, when the Widget module  52  receives that the Widget triggered by a user through a man-machine operation is changed, the Widget module  52  sends a notification message to the container module  51 ; wherein the X coordinate, Y coordinate, Z coordinate, W and H of the changed Widget are carried in the notification message. 
         [0065]    The above are preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modification, identical replacement and improvement made without departing from the spirit and principle of the present disclosure shall be fall within the scope of protection of the present disclosure.