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