1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.portal.service.dashboard;
35
36 import fr.paris.lutece.portal.service.plugin.Plugin;
37 import fr.paris.lutece.portal.service.plugin.PluginService;
38
39 import org.apache.commons.lang.ObjectUtils;
40
41
42
43
44
45 public abstract class DashboardComponent implements IDashboardComponent
46 {
47 private String _strName;
48 private String _strRight;
49 private int _nZone;
50 private int _nOrder;
51 private Plugin _plugin;
52
53
54
55
56
57 @Override
58 public String getName( )
59 {
60 return _strName;
61 }
62
63
64
65
66
67 @Override
68 public void setName( String strName )
69 {
70 _strName = strName;
71 }
72
73
74
75
76
77
78
79
80
81
82
83 @Override
84 public String getRight( )
85 {
86 return _strRight;
87 }
88
89
90
91
92
93 @Override
94 public void setRight( String strRight )
95 {
96 _strRight = strRight;
97 }
98
99
100
101
102
103 @Override
104 public int getZone( )
105 {
106 return _nZone;
107 }
108
109
110
111
112
113 @Override
114 public void setZone( int nZone )
115 {
116 _nZone = nZone;
117 }
118
119
120
121
122
123 @Override
124 public int getOrder( )
125 {
126 return _nOrder;
127 }
128
129
130
131
132
133 @Override
134 public void setOrder( int nOrder )
135 {
136 _nOrder = nOrder;
137 }
138
139
140
141
142
143 @Override
144 public Plugin getPlugin( )
145 {
146 return _plugin;
147 }
148
149
150
151
152
153 @Override
154 public void setPlugin( Plugin plugin )
155 {
156 _plugin = plugin;
157 }
158
159
160
161
162
163
164 @Override
165 public int compareTo( IDashboardComponent o )
166 {
167 return getOrder( ) - o.getOrder( );
168 }
169
170
171
172
173
174 @Override
175 public boolean isEnabled( )
176 {
177 return PluginService.isPluginEnable( _plugin.getName( ) );
178 }
179
180
181
182
183
184 @Override
185 public boolean equals( Object obj )
186 {
187 if ( obj instanceof IDashboardComponent )
188 {
189 IDashboardComponent other = (IDashboardComponent) obj;
190
191 return ObjectUtils.equals( this.getName( ), other.getName( ) );
192 }
193
194 return false;
195 }
196
197
198
199
200
201 @Override
202 public int hashCode( )
203 {
204 return ObjectUtils.hashCode( this.getName( ) );
205 }
206
207
208
209
210
211 @Override
212 public String toString( )
213 {
214 return getClass( ).getName( ) + "[name=" + this.getName( ) + ", zone=" + this.getZone( ) + ", order=" +
215 this.getOrder( ) + "]";
216 }
217 }