1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2015 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.vaadin.session;
|
11
|
|
12
|
import java.util.List;
|
13
|
|
14
|
import com.vaadin.ui.Component;
|
15
|
|
16
|
/**
|
17
|
* @author cmathew
|
18
|
* @date 9 Apr 2015
|
19
|
*
|
20
|
*/
|
21
|
public class SelectionEvent {
|
22
|
|
23
|
private final List<Object> selectedObjects;
|
24
|
private Component source;
|
25
|
private Class<? extends Component> sourceType;
|
26
|
|
27
|
public SelectionEvent(List<Object> selectedObjects, Class<? extends Component> sourceType) {
|
28
|
this.selectedObjects = selectedObjects;
|
29
|
if(selectedObjects == null || selectedObjects.isEmpty()) {
|
30
|
throw new IllegalArgumentException("Changed objects cannot be empty");
|
31
|
}
|
32
|
this.sourceType = sourceType;
|
33
|
if(sourceType == null) {
|
34
|
throw new IllegalArgumentException("Source type cannot be null");
|
35
|
}
|
36
|
}
|
37
|
|
38
|
public SelectionEvent(List<Object> selectedObjects, Component source) {
|
39
|
this.selectedObjects = selectedObjects;
|
40
|
if(selectedObjects == null || selectedObjects.isEmpty()) {
|
41
|
throw new IllegalArgumentException("Changed objects cannot be empty");
|
42
|
}
|
43
|
this.source = source;
|
44
|
if(source == null) {
|
45
|
throw new IllegalArgumentException("Source cannot be null");
|
46
|
}
|
47
|
this.sourceType = source.getClass();
|
48
|
}
|
49
|
|
50
|
/**
|
51
|
* @return the selectedObjects
|
52
|
*/
|
53
|
public List<Object> getSelectedObjects() {
|
54
|
return selectedObjects;
|
55
|
}
|
56
|
|
57
|
/**
|
58
|
* @return the source
|
59
|
*/
|
60
|
public Component getSource() {
|
61
|
return source;
|
62
|
}
|
63
|
|
64
|
/**
|
65
|
* @return the sourceType
|
66
|
*/
|
67
|
public Class<? extends Component> getSourceType() {
|
68
|
return sourceType;
|
69
|
}
|
70
|
|
71
|
|
72
|
}
|