Project

General

Profile

Download (1.86 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2015 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.session;
10

    
11
import java.util.List;
12

    
13
import com.vaadin.ui.Component;
14

    
15
/**
16
 * @author cmathew
17
 * @since 9 Apr 2015
18
 *
19
 */
20
public class SelectionEvent {
21

    
22
    private final List<Object> selectedObjects;
23
    private Component source;
24
    private Class<? extends Component> sourceType;
25

    
26
    public SelectionEvent(List<Object> selectedObjects, Class<? extends Component> sourceType) {
27
        this.selectedObjects = selectedObjects;
28
        if(selectedObjects == null || selectedObjects.isEmpty()) {
29
            throw new IllegalArgumentException("Changed objects cannot be empty");
30
        }
31
        this.sourceType = sourceType;
32
        if(sourceType == null) {
33
            throw new IllegalArgumentException("Source type cannot be null");
34
        }
35
    }
36

    
37
    public SelectionEvent(List<Object> selectedObjects, Component source) {
38
        this.selectedObjects = selectedObjects;
39
        if(selectedObjects == null || selectedObjects.isEmpty()) {
40
            throw new IllegalArgumentException("Changed objects cannot be empty");
41
        }
42
        this.source = source;
43
        if(source == null) {
44
            throw new IllegalArgumentException("Source  cannot be null");
45
        }
46
        this.sourceType = source.getClass();
47
    }
48

    
49
    /**
50
     * @return the selectedObjects
51
     */
52
    public List<Object> getSelectedObjects() {
53
        return selectedObjects;
54
    }
55

    
56
    /**
57
     * @return the source
58
     */
59
    public Component getSource() {
60
        return source;
61
    }
62

    
63
    /**
64
     * @return the sourceType
65
     */
66
    public Class<? extends Component> getSourceType() {
67
        return sourceType;
68
    }
69

    
70

    
71
}
(9-9/10)