use of org.onebusaway.presentation.model.BookmarkWithStopsBean in project onebusaway-application-modules by camsys.
the class IndexTemplate method buildTemplate.
@SuppressWarnings("unchecked")
@Override
public void buildTemplate(ActionContext context) {
ValueStack stack = context.getValueStack();
List<BookmarkWithStopsBean> bookmarks = (List<BookmarkWithStopsBean>) stack.findValue("bookmarks");
if (bookmarks.isEmpty()) {
addMessage(Messages.BOOKMARKS_EMPTY);
} else {
int index = 1;
for (BookmarkWithStopsBean bookmark : bookmarks) {
String toPress = Integer.toString(index);
addMessage(Messages.FOR);
AgiActionName stopAction = addAction(toPress, "/stop/arrivalsAndDeparturesForStopId");
List<String> stopIds = MappingLibrary.map(bookmark.getStops(), "id");
Set<String> routeIds = new HashSet<String>(MappingLibrary.map(bookmark.getRoutes(), "id", String.class));
stopAction.putParam("stopIds", stopIds);
stopAction.putParam("routeIds", routeIds);
addBookmarkDescription(bookmark);
addMessage(Messages.PLEASE_PRESS);
addText(toPress);
index++;
}
}
addAction("(#|0|.+\\*)", "/repeat");
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
Aggregations