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