Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 3 weeks ago
How to fill this TreeTable?
I have created a TreeTable, but is does not work. I've been trying to find the error, but cannot figure it out.
Any help would be appreciated!
import ...
public class DashboardView extends Panel implements View {
public static final String NAME = "dashboard";
protected static final String CHECK_PROPERTY = "Book";
protected static final String FROM_PROPERTY = "From Terminal";
protected static final String TO_PROPERTY = "To Terminal";
protected static final String HOURS_PROPERTY = "Houres";
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
final TreeTable sample = new TreeTable("Possible Routes");
sample.addContainerProperty(CHECK_PROPERTY, CheckBox.class, "");
sample.addContainerProperty(FROM_PROPERTY, String.class, "");
sample.addContainerProperty(TO_PROPERTY, String.class, "");
sample.addContainerProperty(HOURS_PROPERTY, Integer.class, "");
sample.setWidth("150em");
List<Route[]> listOfRoutes = new ArrayList<Route[]>();
Route route1 = new Route("Route 1", "Route 2", 2);
Route route2 = new Route("Route 2", "Route 3", 1);
Route[] routes = new Route[2];
routes[1] = route1;
routes[2] = route2;
listOfRoutes.add(routes);
listOfRoutes.add(routes);
for(int i = 0; i < listOfRoutes.size() 2; i++) {
Route route[] = listOfRoutes.get(i);
int allHours = 0;
sample.addItem(new Object[] {new CheckBox(""), route[0].toTerminal, route[route.length - 1].toTerminal, 0}, i);
for(int j = 0; j < route.length 5; j++) {
int hours = route[j].hours;
sample.addItem(new Object[] {new CheckBox(""), route[j].fromTerminal, route[j].toTerminal, route[j].hours}, j * 1000);
allHours += hours;
sample.setParent(j * 1000, i);
}
sample.getItem(i).getItemProperty(HOURS_PROPERTY).setValue(allHours);
}
VerticalLayout content = new VerticalLayout();
setContent(content);
content.addComponent(sample);
}
}
Last updated on
You cannot reply to this thread.