click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tamas Balazs <>
Subject Possible bug with PageLink class?
Date Wed, 12 Mar 2014 09:16:59 GMT
I have come across with a rather erratic behavior of PageLink class setParameters(Map) method
- possible bug, or I do something wrong.
Anyway, having created an ArrayList of PageLink I started to populate the list with a for-loop.
Upon creating a PageLink objects I set their parameters with the setParameters(Map) method
(argument is a TreeMap<String, String>). This is all fine, but if I want to add another
parameter for the very same PageLink object (in my case it is the for-counter int) then it
always puts the last counter int value!
for (int i=0; i<6; i++){list.add(new PageLink("somenames", MyClass.home);list.get(i).setParameters(paramMap);list.get(i).setParameter("counter",
You would expect the link "counter" parameter to be 0, 1, 2, 3, 4,and for the fifth link is
5. In my case it is all 5. The other parameters being passed to the new links from the TreeMap<String,
String> are all fine.
If I don't add the parameter Map to the new PageLink objects then the "counter" parameters
are fine, they are coming up ok, the first link with 0 and so on.
Funnily enough if the new PageLinks are initialized as:
list.add(new PageLink(string.valueOf(i), MyClass.home);
...then the link name will be the counter int, but if I add the paramMap and then the "counter"
parameter, then the counter parameter stays 5 at each link - despite their anchor will be
0, 1, 2 etc...
Last but not least, if I add the "counter" parameter to the paramMap within the loop before
adding it to the new PageLink objects the "counter" value will be all 5!
Well this is it...
View raw message