Project

General

Profile

Revision 6ed48b2e

ID6ed48b2e205576b31d01ad6fec209b0ec8abc7d3
Parent 9a3af936
Child 1b0d0ec1

Added by Patrick Plitzner over 3 years ago

ref #6283 Fixed potential NPE for EntitySelectionElement

  • refactored constructors to always initialise the clazz variable

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java
52 52
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityLabelTextProvider;
53 53

  
54 54
/**
55
 * <p>
56
 * Abstract AbstractSelectionElement class.
57
 * </p>
58
 *
59 55
 * @author n.hoffmann
60 56
 * @created Nov 17, 2009
61 57
 * @version 1.0
......
101 97
	private final ConversationHolder conversation;
102 98
	private Class<T> clazz;
103 99

  
104
	/**
105
	 * <p>
106
	 * Constructor for AbstractSelectionElement.
107
	 * </p>
108
	 *
109
	 * @param formFactory
110
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
111
	 *            object.
112
	 * @param conversation
113
	 *            TODO
114
	 * @param parentElement
115
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
116
	 *            object.
117
	 * @param labelString
118
	 *            a {@link java.lang.String} object.
119
	 * @param entity
120
	 *            a T object.
121
	 * @param isEditable
122
	 *            a boolean.
123
	 * @param isSelectable
124
	 *            a boolean.
125
	 * @param isDeletable
126
	 *            a boolean.
127
	 * @param style
128
	 *            a int.
129
	 * @param <T>
130
	 *            a T object.
131
	 */
132 100
	public EntitySelectionElement(CdmFormFactory formFactory,
133
			ConversationHolder conversation, ICdmFormElement parentElement,
101
			ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz,
134 102
			String labelString, T entity, int mode, int style, boolean filterElement) {
135 103
		super(formFactory, parentElement);
136 104

  
105
		this.clazz = clazz;
137 106
		this.isEditable = (mode & EDITABLE) == EDITABLE;
138 107
		this.isDeletable = (mode & DELETABLE) == DELETABLE;
139 108
		boolean isSelectable = (mode & SELECTABLE) == SELECTABLE;
......
154 123
		}
155 124
	}
156 125

  
157
	public EntitySelectionElement(CdmFormFactory formFactory,
158
            ConversationHolder conversation, ICdmFormElement parentElement,
159
            String labelString, T entity, int mode, int style){
160
	    this(formFactory, conversation, parentElement, labelString, entity, mode, style, false);
161
	}
162

  
163
	/**
164
     * @param entity2
165
     */
166 126
    private void setFilteredEntity(T filterEntity) {
167 127
        this.filteredEntity =filterEntity;
168 128

  
169 129
    }
170 130

  
171 131
    public EntitySelectionElement(CdmFormFactory formFactory,
172
			ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz,
173
			String labelString, T entity, int mode, int style, boolean filterElement) {
174
		this(formFactory, conversation, parentElement, labelString, entity, mode, style, filterElement);
175
		this.clazz = clazz;
176
	}
177

  
178
    public EntitySelectionElement(CdmFormFactory formFactory,
179 132
            ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz,
180 133
            String labelString, T entity, int mode, int style){
181
        this(formFactory, conversation, parentElement, labelString, entity, mode, style, false);
134
        this(formFactory, conversation, parentElement, clazz, labelString, entity, mode, style, false);
182 135
    }
183 136

  
184 137
	private void createControls(Composite parent, int style) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/NomenclaturalAuthorTeamSelectionElement.java
1 1
/**
2 2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy 
3
 * European Distributed Institute of Taxonomy
4 4
 * http://www.e-taxonomy.eu
5
 * 
5
 *
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
21 21
 * <p>
22 22
 * NomenclaturalAuthorTeamSelectionElement class.
23 23
 * </p>
24
 * 
24
 *
25 25
 * @author n.hoffmann
26 26
 * @created Jun 22, 2010
27 27
 * @version 1.0
......
35 35
	 * <p>
36 36
	 * Constructor for NomenclaturalAuthorTeamSelectionElement.
37 37
	 * </p>
38
	 * 
38
	 *
39 39
	 * @param formFactory
40 40
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
41 41
	 *            object.
......
55 55
	public NomenclaturalAuthorTeamSelectionElement(CdmFormFactory formFactory,
56 56
			ConversationHolder conversation, ICdmFormElement parentElement,
57 57
			String labelString, Team entity, int mode, int style) {
58
		super(formFactory, conversation, parentElement, labelString, entity,
58
		super(formFactory, conversation, parentElement, Team.class, labelString, entity,
59 59
				mode, style);
60 60
	}
61 61

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonNodeSelectionElement.java
1 1
/**
2 2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
26 26
public class TaxonNodeSelectionElement extends EntitySelectionElement<TaxonNode> {
27 27

  
28 28
	private Classification classification;
29
	
29

  
30 30
	public TaxonNodeSelectionElement(CdmFormFactory formFactory,
31 31
			ConversationHolder conversation, ICdmFormElement parentElement,
32 32
			String labelString, TaxonNode entity, int mode, int style) {
33
		super(formFactory, conversation, parentElement, labelString, entity, mode,
33
		super(formFactory, conversation, parentElement, TaxonNode.class, labelString, entity, mode,
34 34
				style);
35 35
	}
36
	
36

  
37 37
	/**
38 38
	 * @return
39 39
	 */
40 40
	public Classification getClassification() {
41 41
		return classification;
42 42
	}
43
	
43

  
44 44
	public void setClassification(Classification classification){
45 45
		this.classification = classification;
46 46
	}
47
	
47

  
48 48
	/*
49 49
	 * (non-Javadoc)
50
	 * 
50
	 *
51 51
	 * @see
52 52
	 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
53 53
	 * .events.SelectionEvent)
......
59 59
				getConversationHolder(), "Select parent taxon", null, null, getClassification());
60 60
		setSelectionInternal(newSelection);
61 61
	}
62
	
62

  
63 63
	/*
64 64
	 * (non-Javadoc)
65
	 * 
65
	 *
66 66
	 * @see
67 67
	 * eu.etaxonomy.taxeditor.forms.selection.AbstractSelectionElement#getTitle
68 68
	 * ()

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)