1 61 62 63 package org.nextime.ion.backoffice.action.content; 64 65 66 import java.io.IOException ; 67 68 import javax.servlet.ServletException ; 69 import javax.servlet.http.HttpServletRequest ; 70 import javax.servlet.http.HttpServletResponse ; 71 import javax.servlet.http.HttpSession ; 72 73 import org.apache.struts.action.ActionForm; 74 import org.apache.struts.action.ActionForward; 75 import org.apache.struts.action.ActionMapping; 76 import org.nextime.ion.backoffice.action.BaseAction; 77 import org.nextime.ion.backoffice.tree.TreeControl; 78 import org.nextime.ion.backoffice.tree.TreeControlNode; 79 80 81 88 89 public class TreeControlAction extends BaseAction { 90 91 92 94 95 110 public ActionForward perform(ActionMapping mapping, 111 ActionForm form, 112 HttpServletRequest request, 113 HttpServletResponse response) 114 throws IOException , ServletException { 115 116 checkUser(request); 118 119 getServlet().log("Entered TreeControlTestAction:perform()"); 120 121 String name = null; 122 HttpSession session = request.getSession(); 123 TreeControl control = 124 (TreeControl) session.getAttribute("treeControlTest"); 125 126 name = request.getParameter("tree"); 128 129 if (name != null) { 130 getServlet().log("Tree expand/contract on " + name); 131 132 TreeControlNode node = control.findNode(name); 133 134 if (node != null){ 135 getServlet().log("Found Node: " + name); 136 node.setExpanded(!node.isExpanded()); 137 } 138 }else{ 139 getServlet().log("tree param is null"); 140 } 141 142 name = request.getParameter("select"); 144 if (name != null) { 145 getServlet().log("Select event on " + name); 146 control.selectNode(name); 147 control.findNode(name).setExpanded(true); 148 } 149 150 return (mapping.findForward("view")); 152 153 } 154 155 156 } 157 | Popular Tags |