View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.4.1 on 2012-04-17 22:28:45,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.apache.maven.doxia.site.decoration;
9   
10  /**
11   * A menu item.
12   * 
13   * @version $Revision$ $Date$
14   */
15  @SuppressWarnings( "all" )
16  public class MenuItem
17      extends LinkItem
18      implements java.io.Serializable, java.lang.Cloneable
19  {
20  
21        //--------------------------/
22       //- Class/Member Variables -/
23      //--------------------------/
24  
25      /**
26       * A description of the menu item. This is used on any summary
27       * pages for a menu.
28       */
29      private String description;
30  
31      /**
32       * Whether to collapse children elements of an item menu (by
33       * default).
34       */
35      private boolean collapse = false;
36  
37      /**
38       * A reference to a pre-defined menu item, such as a report
39       * (specified by the report goal
40       *             name). Any elements explicitly given override
41       * those from the pre-defined reference.
42       */
43      private String ref;
44  
45      /**
46       * Field items.
47       */
48      private java.util.List<MenuItem> items;
49  
50  
51        //-----------/
52       //- Methods -/
53      //-----------/
54  
55      /**
56       * Method addItem.
57       * 
58       * @param menuItem
59       */
60      public void addItem( MenuItem menuItem )
61      {
62          getItems().add( menuItem );
63      } //-- void addItem( MenuItem )
64  
65      /**
66       * Method clone.
67       * 
68       * @return MenuItem
69       */
70      public MenuItem clone()
71      {
72          try
73          {
74              MenuItem copy = (MenuItem) super.clone();
75  
76              if ( this.items != null )
77              {
78                  copy.items = new java.util.ArrayList<MenuItem>();
79                  for ( MenuItem item : this.items )
80                  {
81                      copy.items.add( ( (MenuItem) item).clone() );
82                  }
83              }
84  
85              return copy;
86          }
87          catch ( java.lang.Exception ex )
88          {
89              throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
90                  + " does not support clone()" ).initCause( ex );
91          }
92      } //-- MenuItem clone()
93  
94      /**
95       * Method equals.
96       * 
97       * @param other
98       * @return boolean
99       */
100     public boolean equals( Object other )
101     {
102         if ( this == other )
103         {
104             return true;
105         }
106 
107         if ( !( other instanceof MenuItem ) )
108         {
109             return false;
110         }
111 
112         MenuItem that = (MenuItem) other;
113         boolean result = true;
114 
115         result = result && ( getDescription() == null ? that.getDescription() == null : getDescription().equals( that.getDescription() ) );
116         result = result && collapse == that.collapse;
117         result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) );
118         result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) );
119         result = result && ( super.equals( other ) );
120 
121         return result;
122     } //-- boolean equals( Object )
123 
124     /**
125      * Get a description of the menu item. This is used on any
126      * summary pages for a menu.
127      * 
128      * @return String
129      */
130     public String getDescription()
131     {
132         return this.description;
133     } //-- String getDescription()
134 
135     /**
136      * Method getItems.
137      * 
138      * @return List
139      */
140     public java.util.List<MenuItem> getItems()
141     {
142         if ( this.items == null )
143         {
144             this.items = new java.util.ArrayList<MenuItem>();
145         }
146 
147         return this.items;
148     } //-- java.util.List<MenuItem> getItems()
149 
150     /**
151      * Get a reference to a pre-defined menu item, such as a report
152      * (specified by the report goal
153      *             name). Any elements explicitly given override
154      * those from the pre-defined reference.
155      * 
156      * @return String
157      */
158     public String getRef()
159     {
160         return this.ref;
161     } //-- String getRef()
162 
163     /**
164      * Method hashCode.
165      * 
166      * @return int
167      */
168     public int hashCode()
169     {
170         int result = 17;
171 
172         result = 37 * result + ( description != null ? description.hashCode() : 0 );
173         result = 37 * result + ( collapse ? 0 : 1 );
174         result = 37 * result + ( ref != null ? ref.hashCode() : 0 );
175         result = 37 * result + ( items != null ? items.hashCode() : 0 );
176         result = 37 * result + super.hashCode();
177 
178         return result;
179     } //-- int hashCode()
180 
181     /**
182      * Get whether to collapse children elements of an item menu
183      * (by default).
184      * 
185      * @return boolean
186      */
187     public boolean isCollapse()
188     {
189         return this.collapse;
190     } //-- boolean isCollapse()
191 
192     /**
193      * Method removeItem.
194      * 
195      * @param menuItem
196      */
197     public void removeItem( MenuItem menuItem )
198     {
199         getItems().remove( menuItem );
200     } //-- void removeItem( MenuItem )
201 
202     /**
203      * Set whether to collapse children elements of an item menu
204      * (by default).
205      * 
206      * @param collapse
207      */
208     public void setCollapse( boolean collapse )
209     {
210         this.collapse = collapse;
211     } //-- void setCollapse( boolean )
212 
213     /**
214      * Set a description of the menu item. This is used on any
215      * summary pages for a menu.
216      * 
217      * @param description
218      */
219     public void setDescription( String description )
220     {
221         this.description = description;
222     } //-- void setDescription( String )
223 
224     /**
225      * Set a list of menu item.
226      * 
227      * @param items
228      */
229     public void setItems( java.util.List<MenuItem> items )
230     {
231         this.items = items;
232     } //-- void setItems( java.util.List )
233 
234     /**
235      * Set a reference to a pre-defined menu item, such as a report
236      * (specified by the report goal
237      *             name). Any elements explicitly given override
238      * those from the pre-defined reference.
239      * 
240      * @param ref
241      */
242     public void setRef( String ref )
243     {
244         this.ref = ref;
245     } //-- void setRef( String )
246 
247     /**
248      * Method toString.
249      * 
250      * @return String
251      */
252     public java.lang.String toString()
253     {
254         StringBuilder buf = new StringBuilder( 128 );
255 
256         buf.append( "description = '" );
257         buf.append( getDescription() );
258         buf.append( "'" );
259         buf.append( "\n" ); 
260         buf.append( "collapse = '" );
261         buf.append( isCollapse() );
262         buf.append( "'" );
263         buf.append( "\n" ); 
264         buf.append( "ref = '" );
265         buf.append( getRef() );
266         buf.append( "'" );
267         buf.append( "\n" ); 
268         buf.append( "items = '" );
269         buf.append( getItems() );
270         buf.append( "'" );
271         buf.append( "\n" );
272         buf.append( super.toString() );
273 
274         return buf.toString();
275     } //-- java.lang.String toString()
276 
277 }