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