Changeset 5142

Show
Ignore:
Timestamp:
08/06/08 07:26:52 (5 months ago)
Author:
matti.tahvonen@…
Message:

fixes #1965 (support for table column icons)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java

    r5141 r5142  
    12701270                final String cid = col.getStringAttribute("cid"); 
    12711271                updated.add(cid); 
     1272 
     1273                String caption = buildCaptionHtmlSnippet(col); 
    12721274                HeaderCell c = getHeaderCell(cid); 
    12731275                if (c == null) { 
    1274                     c = new HeaderCell(cid, col.getStringAttribute("caption")); 
     1276                    c = new HeaderCell(cid, caption); 
    12751277                    availableCells.put(cid, c); 
    12761278                    if (initializedAndAttached) { 
     
    12811283                    } 
    12821284                } else { 
    1283                     c.setText(col.getStringAttribute("caption")); 
     1285                    c.setText(caption); 
    12841286                } 
    12851287 
     
    12991301                    c.setWidth(Integer.parseInt(width)); 
    13001302                } 
    1301                 // TODO icon 
    13021303            } 
    13031304            // check for orphaned header cells 
     
    19601961                // row header 
    19611962                if (showRowHeaders) { 
    1962                     String caption = uidl.getStringAttribute("caption"); 
    1963                     if (uidl.hasAttribute("icon")) { 
    1964                         caption = "<img src=\"" 
    1965                                 + client.translateToolkitUri(uidl 
    1966                                         .getStringAttribute("icon")) 
    1967                                 + "\" alt=\"icon\" class=\"i-icon\">" + caption; 
    1968                     } 
    1969                     addCell(caption, aligns[col++], ""); 
     1963                    addCell(buildCaptionHtmlSnippet(uidl), aligns[col++], ""); 
    19701964                } 
    19711965 
     
    22502244    } 
    22512245 
     2246    /** 
     2247     * Helper function to build html snippet for column or row headers 
     2248     *  
     2249     * @param uidl 
     2250     *                possibly with values caption and icon 
     2251     * @return html snippet containing possibly an icon + caption text 
     2252     */ 
     2253    private String buildCaptionHtmlSnippet(UIDL uidl) { 
     2254        String s = uidl.getStringAttribute("caption"); 
     2255        if (uidl.hasAttribute("icon")) { 
     2256            s = "<img src=\"" 
     2257                    + client.translateToolkitUri(uidl 
     2258                            .getStringAttribute("icon")) 
     2259                    + "\" alt=\"icon\" class=\"i-icon\">" + s; 
     2260        } 
     2261        return s; 
     2262    } 
     2263 
    22522264}