summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2010-10-04 10:39:17 +0000
committerHenri Sara <henri.sara@itmill.com>2010-10-04 10:39:17 +0000
commitbfadd60078dc780dfc30d4b5e9dc3a8473ba277b (patch)
treea18baed47acdbb4867e804ebc3056995a6acd02a /src/com/vaadin
parent01906da2fd34fd4dafcc5c1cad6da068d618c9c1 (diff)
downloadvaadin-framework-bfadd60078dc780dfc30d4b5e9dc3a8473ba277b.tar.gz
vaadin-framework-bfadd60078dc780dfc30d4b5e9dc3a8473ba277b.zip
#5692 Generics: Tree and Table property and item ID types can be anything, changeVariables()
svn changeset:15340/svn branch:6.5
Diffstat (limited to 'src/com/vaadin')
-rw-r--r--src/com/vaadin/ui/Table.java21
-rw-r--r--src/com/vaadin/ui/Tree.java32
2 files changed, 27 insertions, 26 deletions
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java
index db3ee51863..b8ebeddc22 100644
--- a/src/com/vaadin/ui/Table.java
+++ b/src/com/vaadin/ui/Table.java
@@ -456,7 +456,7 @@ public class Table extends AbstractSelect implements Action.Container,
// Checks that the new visible columns contains no nulls and properties
// exist
- final Collection properties = getContainerPropertyIds();
+ final Collection<?> properties = getContainerPropertyIds();
for (int i = 0; i < visibleColumns.length; i++) {
if (visibleColumns[i] == null) {
throw new NullPointerException("Ids must be non-nulls");
@@ -1823,7 +1823,8 @@ public class Table extends AbstractSelect implements Action.Container,
// columnGenerators 'override' properties, don't add the same id twice
Collection<Object> col = new LinkedList<Object>();
- for (Iterator it = getContainerPropertyIds().iterator(); it.hasNext();) {
+ for (Iterator<?> it = getContainerPropertyIds().iterator(); it
+ .hasNext();) {
Object id = it.next();
if (columnGenerators == null || !columnGenerators.containsKey(id)) {
col.add(id);
@@ -2284,9 +2285,9 @@ public class Table extends AbstractSelect implements Action.Container,
// selection support
LinkedList<String> selectedKeys = new LinkedList<String>();
if (isMultiSelect()) {
- HashSet sel = new HashSet((Set) getValue());
- Collection vids = getVisibleItemIds();
- for (Iterator it = vids.iterator(); it.hasNext();) {
+ HashSet<?> sel = new HashSet<Object>((Set<?>) getValue());
+ Collection<?> vids = getVisibleItemIds();
+ for (Iterator<?> it = vids.iterator(); it.hasNext();) {
Object id = it.next();
if (sel.contains(id)) {
selectedKeys.add(itemIdMapper.key(id));
@@ -2338,7 +2339,7 @@ public class Table extends AbstractSelect implements Action.Container,
target.addAttribute("colfooters", columnFootersVisible);
// Visible column order
- final Collection sortables = getSortableContainerPropertyIds();
+ final Collection<?> sortables = getSortableContainerPropertyIds();
final ArrayList<String> visibleColOrder = new ArrayList<String>();
for (final Iterator<Object> it = visibleColumns.iterator(); it
.hasNext();) {
@@ -2360,7 +2361,7 @@ public class Table extends AbstractSelect implements Action.Container,
if (columnGenerators.containsKey(columnId)) {
iscomponent[iscomponentIndex++] = true;
} else {
- final Class colType = getType(columnId);
+ final Class<?> colType = getType(columnId);
iscomponent[iscomponentIndex++] = colType != null
&& Component.class.isAssignableFrom(colType);
}
@@ -3023,7 +3024,7 @@ public class Table extends AbstractSelect implements Action.Container,
* @see com.vaadin.ui.Select#getVisibleItemIds()
*/
@Override
- public Collection getVisibleItemIds() {
+ public Collection<?> getVisibleItemIds() {
final LinkedList<Object> visible = new LinkedList<Object>();
@@ -3366,12 +3367,12 @@ public class Table extends AbstractSelect implements Action.Container,
*
* @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
*/
- public Collection getSortableContainerPropertyIds() {
+ public Collection<?> getSortableContainerPropertyIds() {
final Container c = getContainerDataSource();
if (c instanceof Container.Sortable && !isSortDisabled()) {
return ((Container.Sortable) c).getSortableContainerPropertyIds();
} else {
- return new LinkedList();
+ return new LinkedList<Object>();
}
}
diff --git a/src/com/vaadin/ui/Tree.java b/src/com/vaadin/ui/Tree.java
index 04d1c89dcc..2deb0bab1f 100644
--- a/src/com/vaadin/ui/Tree.java
+++ b/src/com/vaadin/ui/Tree.java
@@ -237,7 +237,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
boolean result = true;
// Initial stack
- final Stack todo = new Stack();
+ final Stack<Object> todo = new Stack<Object>();
todo.add(startItemId);
// Expands recursively
@@ -290,7 +290,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
boolean result = true;
// Initial stack
- final Stack todo = new Stack();
+ final Stack<Object> todo = new Stack<Object>();
todo.add(startItemId);
// Collapse recursively
@@ -373,7 +373,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
* java.util.Map)
*/
@Override
- public void changeVariables(Object source, Map variables) {
+ public void changeVariables(Object source, Map<String, Object> variables) {
if (variables.containsKey("clickedKey")) {
String key = (String) variables.get("clickedKey");
@@ -390,7 +390,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
if (!isSelectable() && variables.containsKey("selected")) {
// Not-selectable is a special case, AbstractSelect does not support
// TODO could be optimized.
- variables = new HashMap(variables);
+ variables = new HashMap<String, Object>(variables);
variables.remove("selected");
}
@@ -462,7 +462,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
final String[] ka = (String[]) variables.get("selected");
// Converts the key-array to id-set
- final LinkedList s = new LinkedList();
+ final LinkedList<Object> s = new LinkedList<Object>();
for (int i = 0; i < ka.length; i++) {
final Object id = itemIdMapper.get(ka[i]);
if (!isNullSelectionAllowed()
@@ -537,8 +537,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
final LinkedList<String> expandedKeys = new LinkedList<String>();
// Iterates through hierarchical tree using a stack of iterators
- final Stack<Iterator> iteratorStack = new Stack<Iterator>();
- Collection ids;
+ final Stack<Iterator<?>> iteratorStack = new Stack<Iterator<?>>();
+ Collection<?> ids;
if (partialUpdate) {
ids = getChildren(expandedItemId);
} else {
@@ -552,7 +552,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
while (!iteratorStack.isEmpty()) {
// Gets the iterator for current tree level
- final Iterator i = iteratorStack.peek();
+ final Iterator<?> i = iteratorStack.peek();
// If the level is finished, back to previous tree level
if (!i.hasNext()) {
@@ -694,7 +694,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
*
* @see com.vaadin.data.Container.Hierarchical#getChildren(Object)
*/
- public Collection getChildren(Object itemId) {
+ public Collection<?> getChildren(Object itemId) {
return ((Container.Hierarchical) items).getChildren(itemId);
}
@@ -730,7 +730,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
*
* @see com.vaadin.data.Container.Hierarchical#rootItemIds()
*/
- public Collection rootItemIds() {
+ public Collection<?> rootItemIds() {
return ((Container.Hierarchical) items).rootItemIds();
}
@@ -1030,20 +1030,20 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
* @see com.vaadin.ui.Select#getVisibleItemIds()
*/
@Override
- public Collection getVisibleItemIds() {
+ public Collection<?> getVisibleItemIds() {
- final LinkedList visible = new LinkedList();
+ final LinkedList<Object> visible = new LinkedList<Object>();
// Iterates trough hierarchical tree using a stack of iterators
- final Stack<Iterator> iteratorStack = new Stack<Iterator>();
- final Collection ids = rootItemIds();
+ final Stack<Iterator<?>> iteratorStack = new Stack<Iterator<?>>();
+ final Collection<?> ids = rootItemIds();
if (ids != null) {
iteratorStack.push(ids.iterator());
}
while (!iteratorStack.isEmpty()) {
// Gets the iterator for current tree level
- final Iterator i = iteratorStack.peek();
+ final Iterator<?> i = iteratorStack.peek();
// If the level is finished, back to previous tree level
if (!i.hasNext()) {
@@ -1241,7 +1241,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
VerticalDropLocation dropLocation = getDropLocation();
if (VerticalDropLocation.TOP == dropLocation) {
// if on top of the caption area, add before
- Collection children;
+ Collection<?> children;
Object itemIdInto = getItemIdInto();
if (itemIdInto != null) {
// seek the previous from child list