Changeset 4972
- Timestamp:
- 06/30/08 10:35:42 (6 months ago)
- Files:
-
- 1 modified
-
branches/4.0/src/com/itmill/toolkit/ui/Table.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0/src/com/itmill/toolkit/ui/Table.java
r4121 r4972 11 11 import java.util.LinkedHashSet; 12 12 import java.util.LinkedList; 13 import java.util.List; 13 14 import java.util.Map; 14 15 import java.util.Set; … … 1468 1469 1469 1470 // 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(); 1478 1472 1479 1473 // Table attributes … … 1585 1579 if (actionHandlers != null || isSelectable()) { 1586 1580 target.addAttribute("key", (String) cells[CELL_KEY][i]); 1587 if (isSelected(itemId) && keyIndex < selectedKeys.length) {1581 if (isSelected(itemId)) { 1588 1582 target.addAttribute("selected", true); 1589 selectedKeys [keyIndex++] = (String) cells[CELL_KEY][i];1583 selectedKeys.add((String) cells[CELL_KEY][i]); 1590 1584 } 1591 1585 } … … 1637 1631 // The select variable is only enabled if selectable 1638 1632 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); 1640 1636 } 1641 1637
