leftComponent.setMargin(true);
leftComponent.setSpacing(true);
// Toolbar with buttons to hide or show lists
HorizontalLayout toolBar = new HorizontalLayout();
toolBar.setSpacing(true);
toolBar.setMargin(true);
leftComponent.addComponent(toolBar);
leftComponent.setExpandRatio(toolBar, 0.0f);
// List of trucks -----------------------
tables[0] = new Table("Trucks");
tables[0].addContainerProperty("Brand", String.class, null);
tables[0].addContainerProperty("Model", String.class, null);
tables[0].addContainerProperty("License Plate", String.class, null);
for (int i = 1; i < LENGTHS[0]; i++) {
tables[0].addItem(
new Object[] { "MAN", "XYZ", "1-ABC-" + format.format(i) },
Integer.valueOf(i));
}
tables[0].setPageLength(LENGTHS[0]);
tables[0].setWidth("100%");
tables[0].setHeight("100%");
tables[0].setSelectable(true);
leftComponent.addComponent(tables[0]);
leftComponent.setExpandRatio(tables[0], 1.0f);
// List of trailers ----------------------
tables[1] = new Table("Trailers");
tables[1].addContainerProperty("Type", String.class, null);
tables[1].addContainerProperty("License Plate", String.class, null);
for (int i = 1; i < LENGTHS[1]; i++) {
tables[1].addItem(
new Object[] { "Cooler", "1-QQQ-" + format.format(i) },
Integer.valueOf(i));
}
tables[1].setPageLength(LENGTHS[1]);
tables[1].setWidth("100%");
tables[1].setHeight("100%");
tables[1].setSelectable(true);
leftComponent.addComponent(tables[1]);
leftComponent.setExpandRatio(tables[1], 1.0f);
// List of drivers ------------------------
tables[2] = new Table("Drivers");
tables[2].addContainerProperty("First Name", String.class, null);
tables[2].addContainerProperty("Last Name", String.class, null);
tables[2].addContainerProperty("HR ID", String.class, null);
for (int i = 1; i < LENGTHS[2]; i++) {
tables[2].addItem(
new Object[] { "King", "Vabis", "HR-" + format.format(i) },
Integer.valueOf(i));
}
tables[2].setPageLength(LENGTHS[2]);
tables[2].setWidth("100%");
tables[2].setHeight("100%");
tables[2].setSelectable(true);
leftComponent.addComponent(tables[2]);
leftComponent.setExpandRatio(tables[2], 1.0f);
leftComponent.setWidth("100%");
HorizontalSplitPanel split = new HorizontalSplitPanel();
split.setFirstComponent(leftComponent);
VerticalLayout rightComponent = new VerticalLayout();
rightComponent.setMargin(true);
rightComponent.addComponent(new Label("Left blank!"));
split.setSecondComponent(rightComponent);
split.setSizeFull();
VerticalLayout mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
mainLayout.addComponent(split);
mainLayout.setExpandRatio(split, 1.0f);
LegacyWindow mainWindow = new LegacyWindow("Visibilitybug Application",
mainLayout);
mainWindow.setSizeFull();
setMainWindow(mainWindow);
// complete toolbar
for (int i = 0; i < buttons.length; i++) {
buttons[i] = new ToggleButton(tables[i]);
toolBar.addComponent(buttons[i]);
}
}