Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MenuItem |
|
| 2.5714285714285716;2,571 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.4.1 on 2011-04-27 00:03:43, | |
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 | 306 | 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 | 306 | 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 | 0 | getItems().add( menuItem ); |
63 | 0 | } //-- void addItem( MenuItem ) |
64 | ||
65 | /** | |
66 | * Method clone. | |
67 | * | |
68 | * @return MenuItem | |
69 | */ | |
70 | public MenuItem clone() | |
71 | { | |
72 | try | |
73 | { | |
74 | 120 | MenuItem copy = (MenuItem) super.clone(); |
75 | ||
76 | 120 | if ( this.items != null ) |
77 | { | |
78 | 0 | copy.items = new java.util.ArrayList<MenuItem>(); |
79 | 0 | for ( MenuItem item : this.items ) |
80 | { | |
81 | 0 | copy.items.add( ( (MenuItem) item).clone() ); |
82 | } | |
83 | } | |
84 | ||
85 | 120 | return copy; |
86 | } | |
87 | 0 | catch ( java.lang.Exception ex ) |
88 | { | |
89 | 0 | 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 | 192 | if ( this == other ) |
103 | { | |
104 | 0 | return true; |
105 | } | |
106 | ||
107 | 192 | if ( !( other instanceof MenuItem ) ) |
108 | { | |
109 | 0 | return false; |
110 | } | |
111 | ||
112 | 192 | MenuItem that = (MenuItem) other; |
113 | 192 | boolean result = true; |
114 | ||
115 | 192 | result = result && ( getDescription() == null ? that.getDescription() == null : getDescription().equals( that.getDescription() ) ); |
116 | 192 | result = result && collapse == that.collapse; |
117 | 192 | result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) ); |
118 | 192 | result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) ); |
119 | 192 | result = result && ( super.equals( other ) ); |
120 | ||
121 | 192 | 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 | 384 | 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 | 726 | if ( this.items == null ) |
143 | { | |
144 | 426 | this.items = new java.util.ArrayList<MenuItem>(); |
145 | } | |
146 | ||
147 | 726 | 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 | 384 | return this.ref; |
161 | } //-- String getRef() | |
162 | ||
163 | /** | |
164 | * Method hashCode. | |
165 | * | |
166 | * @return int | |
167 | */ | |
168 | public int hashCode() | |
169 | { | |
170 | 0 | int result = 17; |
171 | ||
172 | 0 | result = 37 * result + ( description != null ? description.hashCode() : 0 ); |
173 | 0 | result = 37 * result + ( collapse ? 0 : 1 ); |
174 | 0 | result = 37 * result + ( ref != null ? ref.hashCode() : 0 ); |
175 | 0 | result = 37 * result + ( items != null ? items.hashCode() : 0 ); |
176 | 0 | result = 37 * result + super.hashCode(); |
177 | ||
178 | 0 | 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 | 0 | return this.collapse; |
190 | } //-- boolean isCollapse() | |
191 | ||
192 | /** | |
193 | * Method removeItem. | |
194 | * | |
195 | * @param menuItem | |
196 | */ | |
197 | public void removeItem( MenuItem menuItem ) | |
198 | { | |
199 | 0 | getItems().remove( menuItem ); |
200 | 0 | } //-- 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 | 0 | this.collapse = collapse; |
211 | 0 | } //-- 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 | 0 | this.description = description; |
222 | 0 | } //-- 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 | 0 | this.items = items; |
232 | 0 | } //-- 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 | 0 | this.ref = ref; |
245 | 0 | } //-- void setRef( String ) |
246 | ||
247 | /** | |
248 | * Method toString. | |
249 | * | |
250 | * @return String | |
251 | */ | |
252 | public java.lang.String toString() | |
253 | { | |
254 | 0 | StringBuilder buf = new StringBuilder( 128 ); |
255 | ||
256 | 0 | buf.append( "description = '" ); |
257 | 0 | buf.append( getDescription() ); |
258 | 0 | buf.append( "'" ); |
259 | 0 | buf.append( "\n" ); |
260 | 0 | buf.append( "collapse = '" ); |
261 | 0 | buf.append( isCollapse() ); |
262 | 0 | buf.append( "'" ); |
263 | 0 | buf.append( "\n" ); |
264 | 0 | buf.append( "ref = '" ); |
265 | 0 | buf.append( getRef() ); |
266 | 0 | buf.append( "'" ); |
267 | 0 | buf.append( "\n" ); |
268 | 0 | buf.append( "items = '" ); |
269 | 0 | buf.append( getItems() ); |
270 | 0 | buf.append( "'" ); |
271 | 0 | buf.append( "\n" ); |
272 | 0 | buf.append( super.toString() ); |
273 | ||
274 | 0 | return buf.toString(); |
275 | } //-- java.lang.String toString() | |
276 | ||
277 | } |