use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class StopFoundAction method execute.
@Override
public String execute() throws Exception {
Integer navState = (Integer) sessionMap.get("navState");
if (navState == null) {
navState = DISPLAY_DATA;
}
_log.debug("StopsForRouteNavigationAction:navState: " + navState);
if (navState == DISPLAY_DATA) {
ActionContext context = ActionContext.getContext();
ValueStack vs = context.getValueStack();
StopBean stop = (StopBean) vs.findValue("stop");
sessionMap.put("stop", stop);
addMessage(Messages.THE_STOP_NUMBER_FOR);
addText(_destinationPronunciation.modify(stop.getName()));
String stopDir = stop.getDirection();
if (stopDir != null && stopDir.length() > 0) {
String direction = _directionPronunciation.modify(stopDir);
addMessage(Messages.DIRECTION_BOUND, direction);
}
addMessage(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);
sessionMap.put("navState", new Integer(DO_ROUTING));
return SUCCESS;
} else {
if (PREVIOUS_MENU_ITEM.equals(getInput())) {
return "back";
} else if ("1".equals(getInput())) {
StopBean stop = (StopBean) sessionMap.get("stop");
_stopIds = Arrays.asList(stop.getId());
return "arrivals-and-departures";
} else if ("2".equals(getInput())) {
StopBean stop = (StopBean) sessionMap.get("stop");
_stopIds = Arrays.asList(stop.getId());
return "bookmark-stop";
}
return SUCCESS;
}
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class StopsForRouteNavigationAction method buildStopsList.
// protected void buildPredictedArrivals(List<ArrivalAndDepartureBean> arrivals) {
protected void buildStopsList() {
ActionContext context = ActionContext.getContext();
ValueStack vs = context.getValueStack();
// NavigationBean navigation = (NavigationBean) vs.findValue("navigation");
NavigationBean navigation = (NavigationBean) sessionMap.get("navigation");
List<NameBean> names = navigation.getNames();
index = navigation.getCurrentIndex();
_log.debug("StopsForRoute.buildStopsList: index: " + index);
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
*/
_log.debug("in StopsForRouteNavigationAction, index = " + index + ", names.size = " + names.size());
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
addMessage("<Pause length=\"1\"/>");
// 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);
// setNextAction("navigate-to");
}
sessionMap.put("navigation", navigation);
// addAction("\\*", "/back");
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class TwilioSupport method addMessage.
protected void addMessage(String msg, Object... args) {
ActionContext context = ActionContext.getContext();
Locale locale = context.getLocale();
ValueStack valueStack = context.getValueStack();
String text = LocalizedTextUtil.findText(TwilioSupport.this.getClass(), msg, locale, msg, args, valueStack);
_log.debug("message: " + text);
_message.append(" " + text + " ");
_log.debug(getText(msg));
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class Debug method execute.
@Override
public String execute() throws Exception {
ActionContext context = ActionContext.getContext();
ActionInvocation invocation = context.getActionInvocation();
ActionProxy proxy = invocation.getProxy();
String name = proxy.getActionName().toLowerCase();
String namespace = proxy.getNamespace().toLowerCase();
// return the 404 message if so. There has to be a better way than this?
if ((name.equals("") || name.equals("index") || name.equals("debug")) && (namespace.equals("") || namespace.equals("/"))) {
return SUCCESS;
}
return "NotFound";
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class ResourceUrlFunction method setServletContext.
@Inject(required = true)
public void setServletContext(ServletContext servletContext) {
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
context.getAutowireCapableBeanFactory().autowireBean(this);
}
Aggregations