private void updateRoutes() {
routeGroupsTabbedPane.removeAll();
int maxRouteCols = preferences
.getIntValue(PreferencesKeys.ROUTE_CONTROLES);
int i = 1;
RouteControlIface routeControl = AdHocRailway.getInstance()
.getRouteControl();
routeControl.removeAllRouteChangeListeners();
RoutePersistenceIface routePersistence = AdHocRailway.getInstance()
.getRoutePersistence();
for (RouteGroup routeGroup : routePersistence.getAllRouteGroups()) {
WidgetTab routeGroupTab = new WidgetTab(maxRouteCols);
JScrollPane groupScrollPane = new JScrollPane(routeGroupTab,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
groupScrollPane.setBorder(BorderFactory.createEmptyBorder());
groupScrollPane.getVerticalScrollBar().setUnitIncrement(10);
groupScrollPane.getVerticalScrollBar().setBlockIncrement(10);
for (Route aRoute : routeGroup.getRoutes()) {
RouteWidget routeWidget = new RouteWidget(aRoute);
routeGroupTab.addWidget(routeWidget);
routeControl.addRouteChangeListener(aRoute, routeWidget);
}
routeGroupsTabbedPane.add(groupScrollPane, "F" + i + ": "
+ routeGroup.getName());
i++;
}