View Javadoc

1   /*
2    * Copyright 2010 FatWire Corporation. All Rights Reserved.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.fatwire.gst.foundation.taglib.navigation;
18  
19  import java.io.IOException;
20  
21  import javax.servlet.jsp.JspException;
22  
23  import COM.FutureTense.Interfaces.ICS;
24  
25  import com.fatwire.gst.foundation.taglib.GsfSimpleTag;
26  import com.fatwire.gst.foundation.wra.navigation.NavNode;
27  import com.fatwire.gst.foundation.wra.navigation.NavigationHelper;
28  
29  /**
30   * 
31   * jsp tag to generate the navigation data structure.
32   * 
33   * @author Dolf Dijkstra
34   * @deprecated
35   * 
36   */
37  public class NavigationTag extends GsfSimpleTag {
38  
39      private String name;
40      private int depth = 1;
41      private String pagename;
42  
43      /**
44       * @param name the name to set
45       */
46      public void setName(final String name) {
47          this.name = name;
48      }
49  
50      /**
51       * @param depth the depth to set
52       */
53      public void setDepth(final int depth) {
54          this.depth = depth;
55      }
56  
57      /**
58       * @param pagename the pagename to set
59       */
60      public void setPagename(final String pagename) {
61          this.pagename = pagename;
62      }
63  
64      /*
65       * (non-Javadoc)
66       * 
67       * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag()
68       */
69      @Override
70      public void doTag() throws JspException, IOException {
71  
72          final ICS ics = (ICS) getICS();
73          final NavigationHelper nh = new NavigationHelper(ics);
74  
75          final NavNode nav = nh.getSitePlanByPage(depth, pagename);
76          getJspContext().setAttribute(name, nav);
77          depth = 1;
78          super.doTag();
79      }
80  
81  }