Hello all,
I am using a FieldFactory to create a treetable. All code is the same for a regular table and a treetable generation. The only difference resides on the constructor (new TreeTable() or new Table()) and also the container that is received implements the collapsible interface (I use a if(container instanceof Collapsible) table = new TreeTable().
Children and Parents are indented correctly, the arrows appear on the right places, the only problem is that the nodes do not collapse :S - all items are visible and the arrows animate for collapsing but the children do not disappear.
My first thought is that there are some configuration I made for a regular table that cannot be made to a Treetable… Any ideas about this?
Here is the code that is specific for the tables:
if (colIds != null) { // is Table
table = new HolosTable();
if (tableClass != null)
try {
table = tableClass.getConstructor().newInstance();
} catch (Exception e) {
System.out.println(e.getMessage());
}
if (container != null && container instanceof Collapsible)
table = new HolosTreeTable();
table.setCacheRate(0.1);
field = new CellFieldLayout(table, root != null);
HolosFieldFactory factory = new HolosFieldFactory(localItem.getItemProperty(propertyId).getType());
factory.setListeners(listeners);
factory.setGenerators(generators);
factory.setValidationGroup(validationGroup);
factory.setUsingBlurNotifier(usingBlurNotifier);
factory.setThrowingConversionException(throwConvExc);
factory.setAllEditable(allEditable);
table.setTableFieldFactory(factory);
table.setSelectable(true);
if (container == null) { // no container
container = new HolosBeanItemContainer<Object>((Class<? super Object>) localItem.getItemProperty(propertyId).getType(), colIds);
if (objList != null && objList.size() > 0) // hasValues
((HolosBeanItemContainer<Object>) container).addAll(objList);
}
table.setContainerDataSource(container);
for (Object colId : colIds) {
if (generators != null && generators.containsKey(colId)) {
((HolosTableGenerator) generators.get(colId)).setItem(localItem);
table.addGeneratedColumn(colId, generators.get(colId));
}
table.setColumnHeader(colId, TM.get(type.getSimpleName() + "." + colId));
}
}
Regards
Bruno