Changeset 4972 for branches

Show
Ignore:
Timestamp:
06/30/08 10:35:42 (6 months ago)
Author:
jouni.koivuviita@…
Message:

Toolkit 4: Changed unwanted String array to List in paintContent-method (problem with lazy-loading containers when the array needed to know the size of the whole set).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/4.0/src/com/itmill/toolkit/ui/Table.java

    r4121 r4972  
    1111import java.util.LinkedHashSet; 
    1212import java.util.LinkedList; 
     13import java.util.List; 
    1314import java.util.Map; 
    1415import java.util.Set; 
     
    14681469 
    14691470                // selection support 
    1470                 String[] selectedKeys; 
    1471                 if (isMultiSelect()) { 
    1472                         selectedKeys = new String[((Set) getValue()).size()]; 
    1473                 } else { 
    1474                         selectedKeys = new String[(getValue() == null 
    1475                                         && getNullSelectionItemId() == null ? 0 : 1)]; 
    1476                 } 
    1477                 int keyIndex = 0; 
     1471                List selectedKeys = new LinkedList(); 
    14781472 
    14791473                // Table attributes 
     
    15851579                        if (actionHandlers != null || isSelectable()) { 
    15861580                                target.addAttribute("key", (String) cells[CELL_KEY][i]); 
    1587                                 if (isSelected(itemId) && keyIndex < selectedKeys.length) { 
     1581                                if (isSelected(itemId)) { 
    15881582                                        target.addAttribute("selected", true); 
    1589                                         selectedKeys[keyIndex++] = (String) cells[CELL_KEY][i]; 
     1583                                        selectedKeys.add((String) cells[CELL_KEY][i]); 
    15901584                                } 
    15911585                        } 
     
    16371631                // The select variable is only enabled if selectable 
    16381632                if (selectable) { 
    1639                         target.addVariable(this, "selected", selectedKeys); 
     1633                        String[] list = new String[selectedKeys.size()]; 
     1634                        selectedKeys.toArray(list); 
     1635                        target.addVariable(this, "selected", list); 
    16401636                } 
    16411637