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