Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/roller/presentation/tags/menu/MenuTag.java


1   
2   package org.roller.presentation.tags.menu;
3   
4   import org.apache.velocity.VelocityContext;
5   import org.roller.presentation.tags.VelocityTag;
6   //import javax.servlet.jsp.tagext.*;
7   
8   
9   /**
10   * @jsp.tag name="Menu"
11   */
12  public class MenuTag extends VelocityTag 
13  {
14    /** Unique ID for this menu within the user's session. 
15      * @jsp.attribute 
16      */
17    public String getId() { return mMenuId; }
18      public void setId( String v ) { mMenuId= v; }
19    private String mMenuId;
20  
21    /** Name of the view to be used to render the menu.
22        * The view is a Velocity template and it must be in the classpath. 
23      * Values: tabbed, vertical, horizontal.
24      * @jsp.attribute  required="true"
25      */
26    public String getView() { return mView; }
27      public void setView( String v ) { mView = v; }
28    private String mView;
29  
30    /** Name of the model to be used.
31      * Must correspond to name of XML file in WEB-INF directory.
32      * @jsp.attribute required="true"
33      */
34    public String getModel() { return mModel; }
35      public void setModel( String v ) { mModel = v; }
36    private String mModel;
37  
38      public String getTemplateClasspath()
39      {
40          return mView;
41      }
42  
43       //------------------------------------------------------------- 
44  
45    public void prepareContext( VelocityContext ctx )
46    {
47      RollerMenuModel model = new RollerMenuModel( 
48        mMenuId, "/WEB-INF/"+mModel, pageContext.getServletContext() );
49      ctx.put("menuModel", model );
50      ctx.put("ctx", pageContext );
51      ctx.put("req", pageContext.getRequest() );
52      ctx.put("res", pageContext.getResponse() );
53    }
54  
55  }
56