Revision 7667f093
Added by Andreas Müller over 1 year ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemNameAndTypeButtons.java | ||
---|---|---|
181 | 181 |
iterator().forEachRemaining(c -> addStyledComponent(c)); |
182 | 182 |
updateEditorButtonReadonlyStates(); |
183 | 183 |
addDefaultStyles(); |
184 |
|
|
185 | 184 |
} |
186 | 185 |
|
187 |
|
|
188 | 186 |
private void updateEditorButtonReadonlyStates() { |
189 | 187 |
for(ButtonWithUserEditPermission b : editButtons){ |
190 | 188 |
boolean impossibleToUnlock = !b.userCanEdit && isLockOverride && isRegistrationLocked; |
... | ... | |
193 | 191 |
b.button.setDescription(impossibleToUnlock ? "Unlock failed due to missing permissions!" : ""); |
194 | 192 |
b.button.setIcon(isLockOverride ? FontAwesome.UNLOCK_ALT : null); |
195 | 193 |
} |
196 |
|
|
197 | 194 |
} |
198 | 195 |
|
199 | 196 |
public IdButton<TaxonName> getNameButton() { |
... | ... | |
208 | 205 |
return addTypeDesignationButton; |
209 | 206 |
} |
210 | 207 |
|
211 |
/** |
|
212 |
* {@inheritDoc} |
|
213 |
*/ |
|
214 | 208 |
@Override |
215 | 209 |
protected void addDefaultStyles() { |
216 | 210 |
addStyleName(STYLE_NAMES); |
... | ... | |
226 | 220 |
|
227 | 221 |
public class TypeDesignationWorkingSetButton { |
228 | 222 |
|
229 |
private TypedEntityReference baseEntityRef; |
|
223 |
private TypedEntityReference<?> baseEntityRef;
|
|
230 | 224 |
private TypeDesignationWorkingSetType type; |
231 | 225 |
private Button button; |
232 | 226 |
|
... | ... | |
236 | 230 |
this.button = button; |
237 | 231 |
} |
238 | 232 |
|
239 |
/** |
|
240 |
* @return the id |
|
241 |
*/ |
|
242 | 233 |
public TypedEntityReference getBaseEntity() { |
243 | 234 |
return baseEntityRef; |
244 | 235 |
} |
245 | 236 |
|
246 |
/** |
|
247 |
* @return the button |
|
248 |
*/ |
|
249 | 237 |
public Button getButton() { |
250 | 238 |
return button; |
251 | 239 |
} |
252 | 240 |
|
253 |
/** |
|
254 |
* @return the type |
|
255 |
*/ |
|
256 | 241 |
public TypeDesignationWorkingSetType getType() { |
257 | 242 |
return type; |
258 | 243 |
} |
259 |
|
|
260 | 244 |
} |
261 | 245 |
|
262 | 246 |
public class IdButton<T> { |
... | ... | |
270 | 254 |
this.button = button; |
271 | 255 |
} |
272 | 256 |
|
273 |
/** |
|
274 |
* @return the id |
|
275 |
*/ |
|
276 | 257 |
public UUID getUuid() { |
277 | 258 |
return uuid; |
278 | 259 |
} |
279 | 260 |
|
280 |
/** |
|
281 |
* @return the button |
|
282 |
*/ |
|
283 | 261 |
public Button getButton() { |
284 | 262 |
return button; |
285 | 263 |
} |
286 | 264 |
|
287 |
/** |
|
288 |
* @return the type |
|
289 |
*/ |
|
290 | 265 |
public Class<T> getType() { |
291 | 266 |
return entityType; |
292 | 267 |
} |
293 |
|
|
294 | 268 |
} |
295 | 269 |
|
296 | 270 |
public class ButtonWithUserEditPermission { |
297 | 271 |
|
298 | 272 |
Button button; |
299 | 273 |
boolean userCanEdit; |
300 |
/** |
|
301 |
* @param button |
|
302 |
* @param userCanEdit |
|
303 |
*/ |
|
304 | 274 |
public ButtonWithUserEditPermission(Button button, boolean userCanEdit) { |
305 | 275 |
super(); |
306 | 276 |
this.button = button; |
307 | 277 |
this.userCanEdit = userCanEdit; |
308 | 278 |
} |
309 |
|
|
310 |
|
|
311 |
|
|
312 | 279 |
} |
280 |
|
|
313 | 281 |
public boolean isRegistrationLocked() { |
314 | 282 |
return isRegistrationLocked; |
315 | 283 |
} |
316 | 284 |
|
317 |
|
|
318 |
/** |
|
319 |
* @return the isLockOverride |
|
320 |
*/ |
|
321 | 285 |
public boolean isLockOverride() { |
322 | 286 |
return isLockOverride; |
323 | 287 |
} |
324 | 288 |
|
325 |
/** |
|
326 |
* @param isLockOverride the isLockOverride to set |
|
327 |
*/ |
|
328 | 289 |
public void setLockOverride(boolean isLockOverride) { |
329 | 290 |
if(this.isLockOverride != isLockOverride){ |
330 | 291 |
this.isLockOverride = isLockOverride; |
... | ... | |
350 | 311 |
// TODO Auto-generated method stub |
351 | 312 |
return comparator.compare(this.status, o.status); |
352 | 313 |
} |
353 |
|
|
354 |
|
|
355 | 314 |
} |
356 |
|
|
357 |
} |
|
315 |
} |
Also available in: Unified diff
cleanup