View Javadoc
1   /*
2    Licensed to the Apache Software Foundation (ASF) under one
3    or more contributor license agreements.  See the NOTICE file
4    distributed with this work for additional information
5    regarding copyright ownership.  The ASF licenses this file
6    to you under the Apache License, Version 2.0 (the
7    "License"); you may not use this file except in compliance
8    with the License.  You may obtain a copy of the License at
9    
10       http://www.apache.org/licenses/LICENSE-2.0
11   
12   Unless required by applicable law or agreed to in writing,
13   software distributed under the License is distributed on an
14   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   KIND, either express or implied.  See the License for the
16   specific language governing permissions and limitations
17   under the License.
18   =================== DO NOT EDIT THIS FILE ====================
19   Generated by Modello 2.5.1,
20   any modifications will be overwritten.
21   ==============================================================
22   */
23  
24  package org.apache.maven.doxia.site;
25  
26  /**
27   * A menu in the navigation.
28   * 
29   * @version $Revision$ $Date$
30   */
31  @SuppressWarnings( "all" )
32  public class Menu
33      implements java.io.Serializable, java.lang.Cloneable
34  {
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /**
41       * The name to display for the menu.
42       */
43      private String name;
44  
45      /**
46       * 
47       *             The way in which the menu is inherited. Can be
48       * one of : <code>top</code>, <code>bottom</code> or empty. If
49       * empty the menu is not inherited (i.e. won't be exposed in
50       * sub projects) which is the default behavior.
51       *             Value <code>bottom</code> means it appears below
52       * sub project's defined menus, <code>top</code> means it
53       * appears above sub project's defined menus.
54       *           
55       */
56      private String inherit;
57  
58      /**
59       * 
60       *             If this is a reference, setting to
61       * <code>true</code> means that it will be populated
62       *             in the site, whereas if it is
63       * <code>false</code>, it is populated in the parent and then
64       * inherited.
65       *           
66       */
67      private boolean inheritAsRef = false;
68  
69      /**
70       * 
71       *             Mark this menu as reference to a pre-defined
72       * menu: <code>reports</code>, <code>modules</code>
73       *             or <code>parent</code>. It will be populated at
74       * runtime with corresponding pre-defined content.
75       *           
76       */
77      private String ref;
78  
79      /**
80       * The image for the menu.
81       */
82      private Image image;
83  
84      /**
85       * Field items.
86       */
87      private java.util.List<MenuItem> items;
88  
89  
90        //-----------/
91       //- Methods -/
92      //-----------/
93  
94      /**
95       * Method addItem.
96       * 
97       * @param menuItem a menuItem object.
98       */
99      public void addItem( MenuItem menuItem )
100     {
101         getItems().add( menuItem );
102     } //-- void addItem( MenuItem )
103 
104     /**
105      * Method clone.
106      * 
107      * @return Menu
108      */
109     public Menu clone()
110     {
111         try
112         {
113             Menu copy = (Menu) super.clone();
114 
115             if ( this.image != null )
116             {
117                 copy.image = (Image) this.image.clone();
118             }
119 
120             if ( this.items != null )
121             {
122                 copy.items = new java.util.ArrayList<MenuItem>();
123                 for ( MenuItem item : this.items )
124                 {
125                     copy.items.add( ( (MenuItem) item).clone() );
126                 }
127             }
128 
129             return copy;
130         }
131         catch ( java.lang.Exception ex )
132         {
133             throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
134                 + " does not support clone()" ).initCause( ex );
135         }
136     } //-- Menu clone()
137 
138     /**
139      * Method equals.
140      * 
141      * @param other a other object.
142      * @return boolean
143      */
144     public boolean equals( Object other )
145     {
146         if ( this == other )
147         {
148             return true;
149         }
150 
151         if ( !( other instanceof Menu ) )
152         {
153             return false;
154         }
155 
156         Menu that = (Menu) other;
157         boolean result = true;
158 
159         result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
160         result = result && ( getInherit() == null ? that.getInherit() == null : getInherit().equals( that.getInherit() ) );
161         result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) );
162         result = result && ( getImage() == null ? that.getImage() == null : getImage().equals( that.getImage() ) );
163         result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) );
164 
165         return result;
166     } //-- boolean equals( Object )
167 
168     /**
169      * Get the image for the menu.
170      * 
171      * @return Image
172      */
173     public Image getImage()
174     {
175         return this.image;
176     } //-- Image getImage()
177 
178     /**
179      * Get the way in which the menu is inherited. Can be one of :
180      * <code>top</code>, <code>bottom</code> or empty. If empty the
181      * menu is not inherited (i.e. won't be exposed in sub
182      * projects) which is the default behavior.
183      *             Value <code>bottom</code> means it appears below
184      * sub project's defined menus, <code>top</code> means it
185      * appears above sub project's defined menus.
186      * 
187      * @return String
188      */
189     public String getInherit()
190     {
191         return this.inherit;
192     } //-- String getInherit()
193 
194     /**
195      * Method getItems.
196      * 
197      * @return List
198      */
199     public java.util.List<MenuItem> getItems()
200     {
201         if ( this.items == null )
202         {
203             this.items = new java.util.ArrayList<MenuItem>();
204         }
205 
206         return this.items;
207     } //-- java.util.List<MenuItem> getItems()
208 
209     /**
210      * Get the name to display for the menu.
211      * 
212      * @return String
213      */
214     public String getName()
215     {
216         return this.name;
217     } //-- String getName()
218 
219     /**
220      * Get mark this menu as reference to a pre-defined menu:
221      * <code>reports</code>, <code>modules</code>
222      *             or <code>parent</code>. It will be populated at
223      * runtime with corresponding pre-defined content.
224      * 
225      * @return String
226      */
227     public String getRef()
228     {
229         return this.ref;
230     } //-- String getRef()
231 
232     /**
233      * Method hashCode.
234      * 
235      * @return int
236      */
237     public int hashCode()
238     {
239         int result = 17;
240 
241         result = 37 * result + ( name != null ? name.hashCode() : 0 );
242         result = 37 * result + ( inherit != null ? inherit.hashCode() : 0 );
243         result = 37 * result + ( ref != null ? ref.hashCode() : 0 );
244         result = 37 * result + ( image != null ? image.hashCode() : 0 );
245         result = 37 * result + ( items != null ? items.hashCode() : 0 );
246 
247         return result;
248     } //-- int hashCode()
249 
250     /**
251      * Get if this is a reference, setting to <code>true</code>
252      * means that it will be populated
253      *             in the site, whereas if it is
254      * <code>false</code>, it is populated in the parent and then
255      * inherited.
256      * 
257      * @return boolean
258      */
259     public boolean isInheritAsRef()
260     {
261         return this.inheritAsRef;
262     } //-- boolean isInheritAsRef()
263 
264     /**
265      * Method removeItem.
266      * 
267      * @param menuItem a menuItem object.
268      */
269     public void removeItem( MenuItem menuItem )
270     {
271         getItems().remove( menuItem );
272     } //-- void removeItem( MenuItem )
273 
274     /**
275      * Set the image for the menu.
276      * 
277      * @param image a image object.
278      */
279     public void setImage( Image image )
280     {
281         this.image = image;
282     } //-- void setImage( Image )
283 
284     /**
285      * Set the way in which the menu is inherited. Can be one of :
286      * <code>top</code>, <code>bottom</code> or empty. If empty the
287      * menu is not inherited (i.e. won't be exposed in sub
288      * projects) which is the default behavior.
289      *             Value <code>bottom</code> means it appears below
290      * sub project's defined menus, <code>top</code> means it
291      * appears above sub project's defined menus.
292      * 
293      * @param inherit a inherit object.
294      */
295     public void setInherit( String inherit )
296     {
297         this.inherit = inherit;
298     } //-- void setInherit( String )
299 
300     /**
301      * Set if this is a reference, setting to <code>true</code>
302      * means that it will be populated
303      *             in the site, whereas if it is
304      * <code>false</code>, it is populated in the parent and then
305      * inherited.
306      * 
307      * @param inheritAsRef a inheritAsRef object.
308      */
309     public void setInheritAsRef( boolean inheritAsRef )
310     {
311         this.inheritAsRef = inheritAsRef;
312     } //-- void setInheritAsRef( boolean )
313 
314     /**
315      * Set a list of menu item.
316      * 
317      * @param items a items object.
318      */
319     public void setItems( java.util.List<MenuItem> items )
320     {
321         this.items = items;
322     } //-- void setItems( java.util.List )
323 
324     /**
325      * Set the name to display for the menu.
326      * 
327      * @param name a name object.
328      */
329     public void setName( String name )
330     {
331         this.name = name;
332     } //-- void setName( String )
333 
334     /**
335      * Set mark this menu as reference to a pre-defined menu:
336      * <code>reports</code>, <code>modules</code>
337      *             or <code>parent</code>. It will be populated at
338      * runtime with corresponding pre-defined content.
339      * 
340      * @param ref a ref object.
341      */
342     public void setRef( String ref )
343     {
344         this.ref = ref;
345     } //-- void setRef( String )
346 
347     /**
348      * Method toString.
349      * 
350      * @return String
351      */
352     public java.lang.String toString()
353     {
354         StringBuilder buf = new StringBuilder( 128 );
355 
356         buf.append( "name = '" );
357         buf.append( getName() );
358         buf.append( "'" );
359         buf.append( "\n" ); 
360         buf.append( "inherit = '" );
361         buf.append( getInherit() );
362         buf.append( "'" );
363         buf.append( "\n" ); 
364         buf.append( "ref = '" );
365         buf.append( getRef() );
366         buf.append( "'" );
367         buf.append( "\n" ); 
368         buf.append( "image = '" );
369         buf.append( getImage() );
370         buf.append( "'" );
371         buf.append( "\n" ); 
372         buf.append( "items = '" );
373         buf.append( getItems() );
374         buf.append( "'" );
375 
376         return buf.toString();
377     } //-- java.lang.String toString()
378 
379 }