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