« Return to Thread: Update on TreeList causes loss of selection
Hey guys,
happy new year to all. I hope you're doing fine.
We recently came across a small problem with TreeList.
The following test case fails (the last assertion).
An EventSelectionModel based on a TreeList looses
its selection when an update happens on the selected element
in the source list.
Looks like a bug to me or what do you think?
Thanks,
Holger
----
public class TreeListTestCase extends SwingTestCase {
public void guiTestTreeListSelection() {
final EventList<String> source = new BasicEventList<String>();
source.add("zero");
source.add("one");
source.add("two");
source.add("three");
final EventList<String> sourceProxy = GlazedListsSwing.swingThreadProxyList(source);
final TreeList<String> treeList = new TreeList<String>(sourceProxy, new StringFormat(),
TreeList.NODES_START_EXPANDED);
final EventSelectionModel<String> selModel = new EventSelectionModel<String>(treeList);
selModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
selModel.setSelectionInterval(2, 2);
assertEquals(Arrays.asList("two"), selModel.getSelected());
source.set(2, source.get(2));
assertEquals(Arrays.asList("two"), selModel.getSelected());
}
private static class StringFormat implements TreeList.Format<String> {
public boolean allowsChildren(String element) {
return element.equals("zero");
}
public Comparator<? extends String> getComparator(int depth) {
return null;
}
public void getPath(List<String> path, String element) {
if (!element.equals("zero")) {
getPath(path, "zero");
}
path.add(element);
}
}
}
_______________________________________________________________________
Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...
« Return to Thread: Update on TreeList causes loss of selection
| Free embeddable forum powered by Nabble | Forum Help |