use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class MultipleStopsFoundTemplate method buildTemplate.
@SuppressWarnings("unchecked")
@Override
public void buildTemplate(ActionContext context) {
ValueStack vs = context.getValueStack();
List<StopBean> stops = (List<StopBean>) vs.findValue("stops");
int index = 1;
addMessage(Messages.MULTIPLE_STOPS_WERE_FOUND);
for (StopBean stop : stops) {
addMessage(Messages.FOR);
addText(_destinationPronunciation.modify(stop.getName()));
addMessage(Messages.PLEASE_PRESS);
String key = Integer.toString(index++);
addText(key);
AgiActionName action = addAction(key, "/stop/arrivalsAndDeparturesForStopId");
action.putParam("stopIds", Arrays.asList(stop.getId()));
}
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class ManageTemplate 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) {
addMessage(Messages.BOOKMARKS_TO_DELETE_THE_BOOKMARK_FOR);
addBookmarkDescription(bookmark);
addMessage(Messages.PLEASE_PRESS);
String toPress = Integer.toString(index);
addText(toPress);
AgiActionName deleteAction = addAction(toPress, "/bookmarks/deleteByIndex");
deleteAction.putParam("index", index - 1);
index++;
}
}
addAction("(#|0|.+\\*)", "/repeat");
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class StopFoundTemplate method buildTemplate.
@Override
public void buildTemplate(ActionContext context) {
ValueStack vs = context.getValueStack();
StopBean stop = (StopBean) vs.findValue("stop");
addMessage(Messages.THE_STOP_NUMBER_FOR);
addText(_destinationPronunciation.modify(stop.getName()));
String direction = _directionPronunciation.modify(stop.getDirection());
addMessage(Messages.DIRECTION_BOUND, direction);
addText(Messages.IS);
addText(stop.getCode());
addMessage(Messages.STOP_FOUND_ARRIVAL_INFO);
AgiActionName arrivalInfoAction = addAction("1", "/stop/arrivalsAndDeparturesForStopId");
arrivalInfoAction.putParam("stopIds", Arrays.asList(stop.getId()));
addMessage(Messages.STOP_FOUND_BOOKMARK_THIS_LOCATION);
AgiActionName bookmarkAction = addAction("2", "/stop/bookmark");
bookmarkAction.putParam("stop", stop);
addMessage(Messages.STOP_FOUND_RETURN_TO_MAIN_MENU);
addAction("3", "/index");
addAction("[04-9]", "/repeat");
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
use of com.opensymphony.xwork2.ActionContext in project onebusaway-application-modules by camsys.
the class StopsForRouteNavigationTemplate method buildTemplate.
@Override
public void buildTemplate(ActionContext context) {
ValueStack vs = context.getValueStack();
NavigationBean navigation = (NavigationBean) vs.findValue("navigation");
List<NameBean> names = navigation.getNames();
int index = navigation.getCurrentIndex();
if (index < 0)
index = 0;
/**
* We always listen for the key-press for the previous name in case it takes
* the user a second to press
*/
if (index > 0)
addNavigationSelectionActionForIndex(navigation, index - 1);
/**
* If we're at the first entry and there is a second, we allow the user to
* jump ahead
*/
if (index == 0 && names.size() > 1) {
addNavigationSelectionActionForIndex(navigation, index + 1);
}
if (index >= names.size()) {
AgiActionName action = setNextAction("/search/navigate-to");
action.putParam("navigation", navigation);
action.putParam("index", 0);
action.setExcludeFromHistory(true);
// Add an extra pause so the user has a chance to make a selection from
// the previous entry
addPause(1000);
addMessage(Messages.TO_REPEAT);
} else {
String key = addNavigationSelectionActionForIndex(navigation, index);
NameBean name = names.get(index);
handleName(name, key);
addNavigateToAction(navigation, "4", first(index - 1));
addNavigateToAction(navigation, "6", index + 1);
addNavigateToAction(navigation, "7", first(index - 10));
addNavigateToAction(navigation, "9", index + 10);
AgiActionName action = setNextAction("/search/navigate-to");
action.putParam("navigation", navigation);
action.putParam("index", index + 1);
action.setExcludeFromHistory(true);
}
addAction("\\*", "/back");
}
use of com.opensymphony.xwork2.ActionContext in project KeyBox by skavanagh.
the class ClickjackingInterceptor method intercept.
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext context = invocation.getInvocationContext();
HttpServletResponse response = (HttpServletResponse) context.get(StrutsStatics.HTTP_RESPONSE);
String headerValue = VALUE;
response.addHeader(HEADER, headerValue);
return invocation.invoke();
}
Aggregations