View Javadoc

1   package net.stff.ical.gui.struts.actions;
2   
3   import java.io.IOException;
4   
5   import javax.servlet.ServletException;
6   import javax.servlet.http.HttpServletResponse;
7   
8   import net.stff.ical.beans.CalendarData;
9   import net.stff.util.SessionObject;
10  
11  import org.apache.struts.action.Action;
12  import org.apache.struts.action.ActionForm;
13  import org.apache.struts.action.ActionForward;
14  import org.apache.struts.action.ActionMapping;
15  
16  /***
17   *  A struts action class that displays a Calendar
18   *
19   * @author     Bernd Eickhoff
20   * @created    9. Juni 2003
21   * @company    <a href="www.stoffwechsel.net">stoffwechsel</a>
22   */
23  public final class CalendarAction extends Action{
24  	//int action = 0;  // incoming request for moving calendar up(1) down(0) for month
25  	// same as year
26  
27  	/***
28  	 *  This Action initializes the basic data or gets it from the session.
29  	 *  It returns the forward for the required view.
30  	 *
31  	 */
32  	public ActionForward execute(ActionMapping mapping, ActionForm form, javax.servlet.http.HttpServletRequest request, HttpServletResponse response)
33  		throws IOException, ServletException{
34  		CalendarData data;
35  		int mode;
36  
37  		data = (CalendarData)SessionObject.get(request).getObject("icalData", request);
38  		data.setUser(request.getRemoteUser());
39  		mode = data.getMode();
40  
41  		if (mode == CalendarData.DAYMODE){
42  			return mapping.findForward("dayview");
43  		}
44  
45  		if (mode == CalendarData.MONTHMODE){
46  			return mapping.findForward("monthview");
47  		}
48  
49  		return mapping.findForward("weekview");
50  	}
51  }