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