Project

General

Profile

« Previous | Next » 

Revision 6ed48b2e

Added by Patrick Plitzner about 7 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
    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 131
    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) {

Also available in: Unified diff