Show
Ignore:
Timestamp:
07/25/08 06:49:03 (6 months ago)
Author:
risto.yrjana@…
Message:

Corrected rendering order, works in Safari but broken in FF

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • incubator/widgets/coordinatelayout/src/com/itmill/toolkit/ui/gwt/client/ui/ICoordinateLayout.java

    r4989 r5117  
    5353        DOM.setStyleAttribute(getElement(), "border", "0"); 
    5454 
    55         System.out.println("*** ICoordinateLayout init ***"); 
     55        System.out.println("\n*** ICoordinateLayout init ***"); 
    5656    } 
    5757 
     
    129129     */ 
    130130    public void iLayout() { 
     131        // Run layout functions for children.. 
     132        Util.runDescendentsLayout(this); 
    131133 
    132134        // Get our current area 
     
    145147            // Extract the values from the UIDL 
    146148            final UIDL componentUIDL = (UIDL) componentIterator.next(); 
    147             final String componentId = componentUIDL.getId(); 
    148149            final UIDL coords = componentUIDL.getChildUIDL(0); 
    149150            final UIDL dimensions = componentUIDL.getChildUIDL(1); 
     
    177178 
    178179                    // Ask the component for its size only once. 
    179                     if (componentToWidth.get(componentId) == null) { 
    180                         componentToWidth.put(componentId, new Integer( 
    181                                 componentWidget.getOffsetWidth())); 
     180                    if (componentToWidth.get(componentDataPaintable) == null) { 
     181                        componentToWidth.put(componentDataPaintable, 
     182                                new Integer(componentWidget.getOffsetWidth())); 
    182183                    } else { 
    183                         width = ((Integer) componentToWidth.get(componentId)) 
    184                                 .intValue(); 
     184                        width = ((Integer) componentToWidth 
     185                                .get(componentDataPaintable)).intValue(); 
    185186                    } 
    186187                } 
     
    199200 
    200201                    // Ask the component for its size only once. 
    201                     if (componentToHeight.get(componentId) == null) { 
    202                         componentToHeight.put(componentId, new Integer( 
    203                                 componentWidget.getOffsetHeight())); 
     202                    if (componentToHeight.get(componentDataPaintable) == null) { 
     203                        componentToHeight.put(componentDataPaintable, 
     204                                new Integer(componentWidget.getOffsetHeight())); 
    204205                    } else { 
    205                         height = ((Integer) componentToHeight.get(componentId)) 
    206                                 .intValue(); 
     206                        height = ((Integer) componentToHeight 
     207                                .get(componentDataPaintable)).intValue(); 
    207208                    } 
    208209 
     
    242243                    absoluteBottom, absoluteLeft, width, height); 
    243244 
    244         } 
    245  
    246         // Run layout functions for children.. 
    247         Util.runDescendentsLayout(this); 
     245            // Update caption position 
     246            Caption c = (Caption) componentToCaption 
     247                    .get(componentDataPaintable); 
     248            if (c != null) { 
     249                int cTop = absoluteTop - c.getOffsetHeight(); 
     250                int cRight = absoluteLeft + c.getOffsetWidth(); 
     251                int cBottom = absoluteBottom + height; 
     252                int cLeft = absoluteLeft; 
     253 
     254                setWidgetPosition(c, cTop, cRight, cBottom, cLeft, c 
     255                        .getOffsetWidth(), c.getOffsetHeight()); 
     256            } 
     257        } 
    248258 
    249259        // ...but make sure they don't change anything important 
     
    284294        DOM.setStyleAttribute(e, "height", Integer.toString(height) + "px"); 
    285295 
     296    } 
     297 
     298    public void updateCaption(Paintable component, UIDL uidl) { 
     299        Caption c = (Caption) componentToCaption.get(component); 
     300 
     301        if (Caption.isNeeded(uidl)) { 
     302            if (c == null) { 
     303                c = new Caption(component, client); 
     304                add(c); 
     305                componentToCaption.put(component, c); 
     306            } 
     307            c.updateCaption(uidl); 
     308        } else if (c != null) { 
     309            remove(c); 
     310            componentToCaption.remove(component); 
     311        } 
    286312    } 
    287313 
     
    317343    /* 
    318344     *  
    319      * @see com.itmill.toolkit.terminal.gwt.client.Container#hasChildComponent(com.google.gwt.user.client.ui.Widget) 
     345     * @see 
     346     * com.itmill.toolkit.terminal.gwt.client.Container#hasChildComponent(com 
     347     * .google.gwt.user.client.ui.Widget) 
    320348     */ 
    321349    public boolean hasChildComponent(Widget w) { 
     
    356384    /* 
    357385     * Calculates percentage from value if needed 
    358      *  
    359386     */ 
    360387    protected int calculateRealCoord(String key, UIDL coords, 
     
    383410    /* 
    384411     * These methods calculate the final coordinates for a given component. 
    385      *  
    386412     */ 
    387413    protected int calculateAbsoluteLeft(int width, int left, int right) { 
     
    471497    } 
    472498 
    473     public void updateCaption(Paintable component, UIDL uidl) { 
    474         Caption c = (Caption) componentToCaption.get(component); 
    475  
    476         if (Caption.isNeeded(uidl)) { 
    477             if (c == null) { 
    478                 c = new Caption(component, client); 
    479                 add(c); 
    480                 componentToCaption.put(component, c); 
    481             } 
    482             c.updateCaption(uidl); 
    483         } else if (c != null) { 
    484             remove(c); 
    485             componentToCaption.remove(component); 
    486         } 
    487     } 
    488  
    489499    public boolean remove(Widget w) { 
    490500        boolean wasRemoved = super.remove(w);