+ return addResponse(false, action);
+ }
+
+ /**
+ * insert a response at the beginning of the chain for the action. Useful to add
+ * pre-action validations local to the Dialog class
+ *
+ * @param action
+ * @return
+ */
+ public T firstResponse(RunResponse action)
+ {
+ return addResponse(true, action);
+ }
+
+ protected T addResponse(boolean prePend, RunResponse action)
+ {
+ List<RunResponse> laction = callbacks.get(action.ourTrigger);
+ if (laction == null)
+ {
+ laction = new ArrayList<>();
+ callbacks.put(action.ourTrigger, laction);
+ }
+ if (prePend)
+ {
+ laction.add(0,action);
+ } else {
+ laction.add(action);
+ }