Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Menu |
|
| 2.4285714285714284;2,429 |
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 in the navigation. | |
12 | * | |
13 | * @version $Revision$ $Date$ | |
14 | */ | |
15 | @SuppressWarnings( "all" ) | |
16 | 246 | public class Menu |
17 | implements java.io.Serializable, java.lang.Cloneable | |
18 | { | |
19 | ||
20 | //--------------------------/ | |
21 | //- Class/Member Variables -/ | |
22 | //--------------------------/ | |
23 | ||
24 | /** | |
25 | * The name to display for the menu. | |
26 | */ | |
27 | private String name; | |
28 | ||
29 | /** | |
30 | * | |
31 | * The way in which the menu is inherited. Can be | |
32 | * one of : <code>top</code>, <code>bottom</code>. | |
33 | * | |
34 | */ | |
35 | private String inherit; | |
36 | ||
37 | /** | |
38 | * | |
39 | * If this is a reference, setting | |
40 | * <inheritAsRef>true</inheritAsRef> means that it will be | |
41 | * populated | |
42 | * in the project, whereas if it is false, it is | |
43 | * populated in the parent and then inherited. | |
44 | * | |
45 | */ | |
46 | 246 | private boolean inheritAsRef = false; |
47 | ||
48 | /** | |
49 | * | |
50 | * A reference to a pre-defined menu, such as a | |
51 | * <code>reports</code>, <code>modules</code> | |
52 | * or <code>parent</code>. | |
53 | * | |
54 | */ | |
55 | private String ref; | |
56 | ||
57 | /** | |
58 | * The source location of an menu image. | |
59 | */ | |
60 | private String img; | |
61 | ||
62 | /** | |
63 | * The alt description for the image. | |
64 | */ | |
65 | private String alt; | |
66 | ||
67 | /** | |
68 | * Where to place the image regarding the displayed name (left | |
69 | * or right). | |
70 | */ | |
71 | 246 | private String position = "left"; |
72 | ||
73 | /** | |
74 | * The border to use for the menu image. | |
75 | */ | |
76 | private String border; | |
77 | ||
78 | /** | |
79 | * The width to use for the menu image. | |
80 | */ | |
81 | private String width; | |
82 | ||
83 | /** | |
84 | * The height to use for the menu image. | |
85 | */ | |
86 | private String height; | |
87 | ||
88 | /** | |
89 | * Field items. | |
90 | */ | |
91 | private java.util.List<MenuItem> items; | |
92 | ||
93 | ||
94 | //-----------/ | |
95 | //- Methods -/ | |
96 | //-----------/ | |
97 | ||
98 | /** | |
99 | * Method addItem. | |
100 | * | |
101 | * @param menuItem | |
102 | */ | |
103 | public void addItem( MenuItem menuItem ) | |
104 | { | |
105 | 0 | getItems().add( menuItem ); |
106 | 0 | } //-- void addItem( MenuItem ) |
107 | ||
108 | /** | |
109 | * Method clone. | |
110 | * | |
111 | * @return Menu | |
112 | */ | |
113 | public Menu clone() | |
114 | { | |
115 | try | |
116 | { | |
117 | 120 | Menu copy = (Menu) super.clone(); |
118 | ||
119 | 120 | if ( this.items != null ) |
120 | { | |
121 | 108 | copy.items = new java.util.ArrayList<MenuItem>(); |
122 | 108 | for ( MenuItem item : this.items ) |
123 | { | |
124 | 120 | copy.items.add( ( (MenuItem) item).clone() ); |
125 | } | |
126 | } | |
127 | ||
128 | 120 | return copy; |
129 | } | |
130 | 0 | catch ( java.lang.Exception ex ) |
131 | { | |
132 | 0 | throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName() |
133 | + " does not support clone()" ).initCause( ex ); | |
134 | } | |
135 | } //-- Menu clone() | |
136 | ||
137 | /** | |
138 | * Method equals. | |
139 | * | |
140 | * @param other | |
141 | * @return boolean | |
142 | */ | |
143 | public boolean equals( Object other ) | |
144 | { | |
145 | 156 | if ( this == other ) |
146 | { | |
147 | 0 | return true; |
148 | } | |
149 | ||
150 | 156 | if ( !( other instanceof Menu ) ) |
151 | { | |
152 | 0 | return false; |
153 | } | |
154 | ||
155 | 156 | Menu that = (Menu) other; |
156 | 156 | boolean result = true; |
157 | ||
158 | 156 | result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) ); |
159 | 156 | result = result && ( getInherit() == null ? that.getInherit() == null : getInherit().equals( that.getInherit() ) ); |
160 | 156 | result = result && ( getRef() == null ? that.getRef() == null : getRef().equals( that.getRef() ) ); |
161 | 156 | result = result && ( getImg() == null ? that.getImg() == null : getImg().equals( that.getImg() ) ); |
162 | 156 | result = result && ( getAlt() == null ? that.getAlt() == null : getAlt().equals( that.getAlt() ) ); |
163 | 156 | result = result && ( getPosition() == null ? that.getPosition() == null : getPosition().equals( that.getPosition() ) ); |
164 | 156 | result = result && ( getBorder() == null ? that.getBorder() == null : getBorder().equals( that.getBorder() ) ); |
165 | 156 | result = result && ( getWidth() == null ? that.getWidth() == null : getWidth().equals( that.getWidth() ) ); |
166 | 156 | result = result && ( getHeight() == null ? that.getHeight() == null : getHeight().equals( that.getHeight() ) ); |
167 | 156 | result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) ); |
168 | ||
169 | 156 | return result; |
170 | } //-- boolean equals( Object ) | |
171 | ||
172 | /** | |
173 | * Get the alt description for the image. | |
174 | * | |
175 | * @return String | |
176 | */ | |
177 | public String getAlt() | |
178 | { | |
179 | 312 | return this.alt; |
180 | } //-- String getAlt() | |
181 | ||
182 | /** | |
183 | * Get the border to use for the menu image. | |
184 | * | |
185 | * @return String | |
186 | */ | |
187 | public String getBorder() | |
188 | { | |
189 | 312 | return this.border; |
190 | } //-- String getBorder() | |
191 | ||
192 | /** | |
193 | * Get the height to use for the menu image. | |
194 | * | |
195 | * @return String | |
196 | */ | |
197 | public String getHeight() | |
198 | { | |
199 | 312 | return this.height; |
200 | } //-- String getHeight() | |
201 | ||
202 | /** | |
203 | * Get the source location of an menu image. | |
204 | * | |
205 | * @return String | |
206 | */ | |
207 | public String getImg() | |
208 | { | |
209 | 312 | return this.img; |
210 | } //-- String getImg() | |
211 | ||
212 | /** | |
213 | * Get the way in which the menu is inherited. Can be one of : | |
214 | * <code>top</code>, <code>bottom</code>. | |
215 | * | |
216 | * @return String | |
217 | */ | |
218 | public String getInherit() | |
219 | { | |
220 | 636 | return this.inherit; |
221 | } //-- String getInherit() | |
222 | ||
223 | /** | |
224 | * Method getItems. | |
225 | * | |
226 | * @return List | |
227 | */ | |
228 | public java.util.List<MenuItem> getItems() | |
229 | { | |
230 | 1008 | if ( this.items == null ) |
231 | { | |
232 | 258 | this.items = new java.util.ArrayList<MenuItem>(); |
233 | } | |
234 | ||
235 | 1008 | return this.items; |
236 | } //-- java.util.List<MenuItem> getItems() | |
237 | ||
238 | /** | |
239 | * Get the name to display for the menu. | |
240 | * | |
241 | * @return String | |
242 | */ | |
243 | public String getName() | |
244 | { | |
245 | 468 | return this.name; |
246 | } //-- String getName() | |
247 | ||
248 | /** | |
249 | * Get where to place the image regarding the displayed name | |
250 | * (left or right). | |
251 | * | |
252 | * @return String | |
253 | */ | |
254 | public String getPosition() | |
255 | { | |
256 | 468 | return this.position; |
257 | } //-- String getPosition() | |
258 | ||
259 | /** | |
260 | * Get a reference to a pre-defined menu, such as a | |
261 | * <code>reports</code>, <code>modules</code> | |
262 | * or <code>parent</code>. | |
263 | * | |
264 | * @return String | |
265 | */ | |
266 | public String getRef() | |
267 | { | |
268 | 312 | return this.ref; |
269 | } //-- String getRef() | |
270 | ||
271 | /** | |
272 | * Get the width to use for the menu image. | |
273 | * | |
274 | * @return String | |
275 | */ | |
276 | public String getWidth() | |
277 | { | |
278 | 312 | return this.width; |
279 | } //-- String getWidth() | |
280 | ||
281 | /** | |
282 | * Method hashCode. | |
283 | * | |
284 | * @return int | |
285 | */ | |
286 | public int hashCode() | |
287 | { | |
288 | 0 | int result = 17; |
289 | ||
290 | 0 | result = 37 * result + ( name != null ? name.hashCode() : 0 ); |
291 | 0 | result = 37 * result + ( inherit != null ? inherit.hashCode() : 0 ); |
292 | 0 | result = 37 * result + ( ref != null ? ref.hashCode() : 0 ); |
293 | 0 | result = 37 * result + ( img != null ? img.hashCode() : 0 ); |
294 | 0 | result = 37 * result + ( alt != null ? alt.hashCode() : 0 ); |
295 | 0 | result = 37 * result + ( position != null ? position.hashCode() : 0 ); |
296 | 0 | result = 37 * result + ( border != null ? border.hashCode() : 0 ); |
297 | 0 | result = 37 * result + ( width != null ? width.hashCode() : 0 ); |
298 | 0 | result = 37 * result + ( height != null ? height.hashCode() : 0 ); |
299 | 0 | result = 37 * result + ( items != null ? items.hashCode() : 0 ); |
300 | ||
301 | 0 | return result; |
302 | } //-- int hashCode() | |
303 | ||
304 | /** | |
305 | * Get if this is a reference, setting | |
306 | * <inheritAsRef>true</inheritAsRef> means that it will be | |
307 | * populated | |
308 | * in the project, whereas if it is false, it is | |
309 | * populated in the parent and then inherited. | |
310 | * | |
311 | * @return boolean | |
312 | */ | |
313 | public boolean isInheritAsRef() | |
314 | { | |
315 | 0 | return this.inheritAsRef; |
316 | } //-- boolean isInheritAsRef() | |
317 | ||
318 | /** | |
319 | * Method removeItem. | |
320 | * | |
321 | * @param menuItem | |
322 | */ | |
323 | public void removeItem( MenuItem menuItem ) | |
324 | { | |
325 | 0 | getItems().remove( menuItem ); |
326 | 0 | } //-- void removeItem( MenuItem ) |
327 | ||
328 | /** | |
329 | * Set the alt description for the image. | |
330 | * | |
331 | * @param alt | |
332 | */ | |
333 | public void setAlt( String alt ) | |
334 | { | |
335 | 0 | this.alt = alt; |
336 | 0 | } //-- void setAlt( String ) |
337 | ||
338 | /** | |
339 | * Set the border to use for the menu image. | |
340 | * | |
341 | * @param border | |
342 | */ | |
343 | public void setBorder( String border ) | |
344 | { | |
345 | 0 | this.border = border; |
346 | 0 | } //-- void setBorder( String ) |
347 | ||
348 | /** | |
349 | * Set the height to use for the menu image. | |
350 | * | |
351 | * @param height | |
352 | */ | |
353 | public void setHeight( String height ) | |
354 | { | |
355 | 0 | this.height = height; |
356 | 0 | } //-- void setHeight( String ) |
357 | ||
358 | /** | |
359 | * Set the source location of an menu image. | |
360 | * | |
361 | * @param img | |
362 | */ | |
363 | public void setImg( String img ) | |
364 | { | |
365 | 0 | this.img = img; |
366 | 0 | } //-- void setImg( String ) |
367 | ||
368 | /** | |
369 | * Set the way in which the menu is inherited. Can be one of : | |
370 | * <code>top</code>, <code>bottom</code>. | |
371 | * | |
372 | * @param inherit | |
373 | */ | |
374 | public void setInherit( String inherit ) | |
375 | { | |
376 | 186 | this.inherit = inherit; |
377 | 186 | } //-- void setInherit( String ) |
378 | ||
379 | /** | |
380 | * Set if this is a reference, setting | |
381 | * <inheritAsRef>true</inheritAsRef> means that it will be | |
382 | * populated | |
383 | * in the project, whereas if it is false, it is | |
384 | * populated in the parent and then inherited. | |
385 | * | |
386 | * @param inheritAsRef | |
387 | */ | |
388 | public void setInheritAsRef( boolean inheritAsRef ) | |
389 | { | |
390 | 0 | this.inheritAsRef = inheritAsRef; |
391 | 0 | } //-- void setInheritAsRef( boolean ) |
392 | ||
393 | /** | |
394 | * Set a list of menu item. | |
395 | * | |
396 | * @param items | |
397 | */ | |
398 | public void setItems( java.util.List<MenuItem> items ) | |
399 | { | |
400 | 0 | this.items = items; |
401 | 0 | } //-- void setItems( java.util.List ) |
402 | ||
403 | /** | |
404 | * Set the name to display for the menu. | |
405 | * | |
406 | * @param name | |
407 | */ | |
408 | public void setName( String name ) | |
409 | { | |
410 | 246 | this.name = name; |
411 | 246 | } //-- void setName( String ) |
412 | ||
413 | /** | |
414 | * Set where to place the image regarding the displayed name | |
415 | * (left or right). | |
416 | * | |
417 | * @param position | |
418 | */ | |
419 | public void setPosition( String position ) | |
420 | { | |
421 | 0 | this.position = position; |
422 | 0 | } //-- void setPosition( String ) |
423 | ||
424 | /** | |
425 | * Set a reference to a pre-defined menu, such as a | |
426 | * <code>reports</code>, <code>modules</code> | |
427 | * or <code>parent</code>. | |
428 | * | |
429 | * @param ref | |
430 | */ | |
431 | public void setRef( String ref ) | |
432 | { | |
433 | 0 | this.ref = ref; |
434 | 0 | } //-- void setRef( String ) |
435 | ||
436 | /** | |
437 | * Set the width to use for the menu image. | |
438 | * | |
439 | * @param width | |
440 | */ | |
441 | public void setWidth( String width ) | |
442 | { | |
443 | 0 | this.width = width; |
444 | 0 | } //-- void setWidth( String ) |
445 | ||
446 | /** | |
447 | * Method toString. | |
448 | * | |
449 | * @return String | |
450 | */ | |
451 | public java.lang.String toString() | |
452 | { | |
453 | 0 | StringBuilder buf = new StringBuilder( 128 ); |
454 | ||
455 | 0 | buf.append( "name = '" ); |
456 | 0 | buf.append( getName() ); |
457 | 0 | buf.append( "'" ); |
458 | 0 | buf.append( "\n" ); |
459 | 0 | buf.append( "inherit = '" ); |
460 | 0 | buf.append( getInherit() ); |
461 | 0 | buf.append( "'" ); |
462 | 0 | buf.append( "\n" ); |
463 | 0 | buf.append( "ref = '" ); |
464 | 0 | buf.append( getRef() ); |
465 | 0 | buf.append( "'" ); |
466 | 0 | buf.append( "\n" ); |
467 | 0 | buf.append( "img = '" ); |
468 | 0 | buf.append( getImg() ); |
469 | 0 | buf.append( "'" ); |
470 | 0 | buf.append( "\n" ); |
471 | 0 | buf.append( "alt = '" ); |
472 | 0 | buf.append( getAlt() ); |
473 | 0 | buf.append( "'" ); |
474 | 0 | buf.append( "\n" ); |
475 | 0 | buf.append( "position = '" ); |
476 | 0 | buf.append( getPosition() ); |
477 | 0 | buf.append( "'" ); |
478 | 0 | buf.append( "\n" ); |
479 | 0 | buf.append( "border = '" ); |
480 | 0 | buf.append( getBorder() ); |
481 | 0 | buf.append( "'" ); |
482 | 0 | buf.append( "\n" ); |
483 | 0 | buf.append( "width = '" ); |
484 | 0 | buf.append( getWidth() ); |
485 | 0 | buf.append( "'" ); |
486 | 0 | buf.append( "\n" ); |
487 | 0 | buf.append( "height = '" ); |
488 | 0 | buf.append( getHeight() ); |
489 | 0 | buf.append( "'" ); |
490 | 0 | buf.append( "\n" ); |
491 | 0 | buf.append( "items = '" ); |
492 | 0 | buf.append( getItems() ); |
493 | 0 | buf.append( "'" ); |
494 | ||
495 | 0 | return buf.toString(); |
496 | } //-- java.lang.String toString() | |
497 | ||
498 | } |