View Javadoc
1   /*
2    * The MIT License
3    *
4    * Copyright (c) 2006, The Codehaus
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy of
7    * this software and associated documentation files (the "Software"), to deal in
8    * the Software without restriction, including without limitation the rights to
9    * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10   * of the Software, and to permit persons to whom the Software is furnished to do
11   * so, subject to the following conditions:
12   *
13   * The above copyright notice and this permission notice shall be included in all
14   * copies or substantial portions of the Software.
15   *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22   * SOFTWARE.
23   */
24  
25  package org.codehaus.plexus.maven.plugin.report;
26  
27  import java.util.ArrayList;
28  import java.util.Iterator;
29  import java.util.List;
30  
31  import org.codehaus.doxia.sink.Sink;
32  import org.jdom.Element;
33  
34  /**
35   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
36   * @version $Id$
37   */
38  public class Requirements
39  {
40      private List requirements = new ArrayList();
41  
42      public Requirements( Element element )
43      {
44          for ( Iterator it = element.getChildren( "requirement" ).iterator(); it.hasNext(); )
45          {
46              Element requireqment = (Element) it.next();
47              requirements.add( new Requirement( requireqment ) );
48          }
49      }
50  
51      public void print( Sink sink )
52      {
53          if ( requirements.size() == 0 )
54          {
55              return;
56          }
57  /*
58          sink.section4();
59          sink.sectionTitle4();
60          sink.text( "Requirements" );
61          sink.sectionTitle4_();
62          sink.section4_();
63          sink.paragraph();
64          for ( Iterator it = requirements.iterator(); it.hasNext(); )
65          {
66              Requirement requirement = (Requirement) it.next();
67              requirement.print( sink );
68          }
69          sink.paragraph_();
70  */
71  //        sink.section4();
72  //        sink.sectionTitle4();
73  //        sink.text( "Requirements" );
74  //        sink.sectionTitle4_();
75  //        sink.section4_();
76  
77          sink.paragraph();
78          sink.table();
79          sink.tableCaption();
80          sink.text( "Requirements" );
81          sink.tableCaption_();
82          for ( Iterator it = requirements.iterator(); it.hasNext(); )
83          {
84              Requirement requirement = (Requirement) it.next();
85              requirement.print( sink );
86          }
87          sink.table_();
88          sink.paragraph_();
89      }
90  }