View Javadoc

1   package org.apache.maven.doxia.book.services.renderer.xdoc;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.Writer;
23  import java.util.Locale;
24  
25  import org.apache.maven.doxia.index.IndexEntry;
26  import org.codehaus.plexus.i18n.I18N;
27  
28  /**
29   * A <code>XdocSink</code> implementation for index book.
30   *
31   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
32   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
33   * @version $Id: IndexXdocBookSink.java 782330 2009-06-07 05:55:26Z ltheussl $
34   */
35  public class IndexXdocBookSink
36      extends AbstractXdocBookSink
37  {
38      /** the first IndexEntry. */
39      private final IndexEntry firstEntry;
40  
41      /**
42       * Default constructor.
43       *
44       * @param out the Writer.
45       * @param firstEntry the first IndexEntry.
46       * @param i18n I18N.
47       * @param locale wanted locale.
48       */
49      public IndexXdocBookSink( Writer out, IndexEntry firstEntry, I18N i18n, Locale locale )
50      {
51          super( out, i18n, locale );
52  
53          this.firstEntry = firstEntry;
54      }
55  
56      /** {@inheritDoc} */
57      protected void navigationPanel()
58      {
59          write( "<!--Navigation Panel-->" );
60  
61          write( "<table width=\"100%\" align=\"center\">" );
62          write( "<tr>" );
63  
64          // -----------------------------------------------------------------------
65          // Next
66          // -----------------------------------------------------------------------
67  
68          if ( firstEntry != null )
69          {
70              write( "<td><div align=\"right\">" );
71  
72              write( getString( "next" ) + ": <a href=\"" + firstEntry.getId() + ".html\">" );
73              content( firstEntry.getTitle() );
74              write( "</a>" );
75  
76              write( "</div></td>" );
77          }
78  
79          write( "</tr>" );
80          write( "</table>" );
81  
82          write( "<!--End of Navigation Panel-->" );
83      }
84  }