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