1
2
3
4
5
6
7
8
9
10
11 package org.apache.maven.doxia.site.decoration;
12
13
14
15
16
17
18 @SuppressWarnings( "all" )
19 public class MenuItem
20 extends LinkItem
21 implements java.io.Serializable, java.lang.Cloneable
22 {
23
24
25
26
27
28
29
30
31
32 private String description;
33
34
35
36
37
38 private boolean collapse = false;
39
40
41
42
43
44
45
46 private String ref;
47
48
49
50
51 private java.util.List<MenuItem> items;
52
53
54
55
56
57
58
59
60
61
62
63 public void addItem( MenuItem menuItem )
64 {
65 getItems().add( menuItem );
66 }
67
68
69
70
71
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 }
96
97
98
99
100
101
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 }
126
127
128
129
130
131
132
133 public String getDescription()
134 {
135 return this.description;
136 }
137
138
139
140
141
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 }
152
153
154
155
156
157
158
159
160
161 public String getRef()
162 {
163 return this.ref;
164 }
165
166
167
168
169
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 }
183
184
185
186
187
188
189
190 public boolean isCollapse()
191 {
192 return this.collapse;
193 }
194
195
196
197
198
199
200 public void removeItem( MenuItem menuItem )
201 {
202 getItems().remove( menuItem );
203 }
204
205
206
207
208
209
210
211 public void setCollapse( boolean collapse )
212 {
213 this.collapse = collapse;
214 }
215
216
217
218
219
220
221
222 public void setDescription( String description )
223 {
224 this.description = description;
225 }
226
227
228
229
230
231
232 public void setItems( java.util.List<MenuItem> items )
233 {
234 this.items = items;
235 }
236
237
238
239
240
241
242
243
244
245 public void setRef( String ref )
246 {
247 this.ref = ref;
248 }
249
250
251
252
253
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 }
279
280 }