1
|
/**
|
2
|
* Copyright (C) 2018 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.vaadin.event;
|
10
|
|
11
|
import org.vaadin.spring.events.Event;
|
12
|
import org.vaadin.spring.events.EventBusListenerMethodFilter;
|
13
|
|
14
|
/**
|
15
|
* @author a.kohlbecker
|
16
|
* @since Jan 31, 2018
|
17
|
*
|
18
|
*/
|
19
|
public class ShowDetailsEventEntityTypeFilter implements EventBusListenerMethodFilter {
|
20
|
|
21
|
|
22
|
Class entityType;
|
23
|
|
24
|
private ShowDetailsEventEntityTypeFilter(Class entityType){
|
25
|
this.entityType = entityType;
|
26
|
}
|
27
|
|
28
|
/**
|
29
|
* {@inheritDoc}
|
30
|
*/
|
31
|
@Override
|
32
|
public boolean filter(Event<?> event) {
|
33
|
|
34
|
if(event.getPayload() instanceof ShowDetailsEvent){
|
35
|
ShowDetailsEvent detailsEvent = (ShowDetailsEvent)event.getPayload();
|
36
|
return this.entityType.equals(detailsEvent.getEntityType());
|
37
|
}
|
38
|
return false;
|
39
|
}
|
40
|
|
41
|
public static class RegistrationWorkingSet extends ShowDetailsEventEntityTypeFilter{
|
42
|
|
43
|
public RegistrationWorkingSet(){
|
44
|
super(eu.etaxonomy.cdm.api.service.dto.RegistrationWorkingSet.class);
|
45
|
}
|
46
|
}
|
47
|
|
48
|
public static class RegistrationDTO extends ShowDetailsEventEntityTypeFilter{
|
49
|
|
50
|
public RegistrationDTO(){
|
51
|
super(eu.etaxonomy.cdm.api.service.dto.RegistrationDTO.class);
|
52
|
}
|
53
|
}
|
54
|
}
|