1 package com.sri.emo.annotations; 2 3 import com.jcorporate.expresso.core.controller.*; 4 import com.jcorporate.expresso.core.db.DBException; 5 import com.sri.common.controller.StateHandler; 6 import com.sri.emo.controller.AddNodeAction; 7 import com.sri.emo.dbobj.Node; 8 9 /*** 10 * @author Michael Rimov 11 * @version 1.0 12 */ 13 public class PromptAddTag implements StateHandler { 14 15 public static final String NAME = "promptAddTag"; 16 17 public static final String DESCRIPTION = "Prompt Add Tag"; 18 19 private final Controller myParent; 20 21 public PromptAddTag(final Controller parent) { 22 myParent = parent; 23 } 24 25 26 /*** 27 * Displays the add input box and add/cancel transitions. 28 * <p>{@inheritDoc}</p> 29 * 30 * @param request ExpressoRequest 31 * @param response ExpressoResponse 32 * @throws DBException 33 * @throws ControllerException 34 */ 35 public void handleRequest(final ExpressoRequest request, final ExpressoResponse response) throws DBException, 36 ControllerException { 37 38 Transition add = new Transition("addTags", "Add", myParent.getClass(), DoAddTag.NAME); 39 response.add(add); 40 41 Transition cancel = new Transition("cancel", "Cancel", AddNodeAction.class, AddNodeAction.VIEW_NODE); 42 cancel.addParam(Node.NODE_ID, request.getParameter("nodeId")); 43 response.add(cancel); 44 } 45 }