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  package com.fatwire.gst.foundation.taglib.navigation;
17  
18  import java.io.IOException;
19  import javax.servlet.jsp.JspException;
20  
21  import com.fatwire.gst.foundation.taglib.MultilingualGsfSimpleTag;
22  import com.fatwire.gst.foundation.wra.navigation.NavNode;
23  import com.fatwire.gst.foundation.wra.navigation.NavigationHelper;
24  import com.fatwire.mda.DimensionFilterInstance;
25  
26  /**
27   * jsp tag to generate the navigation data structure for multilingual site
28   * plans.
29   * 
30   * @author Tony Field
31   */
32  public final class MultilingualNavigationTag extends MultilingualGsfSimpleTag {
33  
34      private String name;
35      private int depth = 1;
36      private String pagename;
37  
38      /**
39       * @param name the name to set
40       */
41      public void setName(final String name) {
42          this.name = name;
43      }
44  
45      /**
46       * @param depth the depth to set
47       */
48      public void setDepth(final int depth) {
49          this.depth = depth;
50      }
51  
52      /**
53       * @param pagename the pagename to set
54       */
55      public void setPagename(final String pagename) {
56          this.pagename = pagename;
57      }
58  
59      public void doTag() throws JspException, IOException {
60          LOG.trace("gsf:multilingual-navigation start");
61  
62          DimensionFilterInstance filter = getDimensionFilter();
63          final NavigationHelper nh = new NavigationHelper(getICS());
64          final NavNode nav = nh.getSitePlanByPage(depth, pagename, filter);
65          getJspContext().setAttribute(name, nav);
66          super.doTag();
67  
68          LOG.trace("gsf:multilingual-navigation end");
69      }
70  }