Project

General

Profile

« Previous | Next » 

Revision dca5b257

Added by Patrick Plitzner over 5 years ago

ref #7883 Revert visibility of class members + delete ambiguous method

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
35 35
public class TermComboElement<T extends DefinedTermBase>
36 36
		extends AbstractComboElement<T> {
37 37

  
38
	protected T emptyElement;
39
	protected static String EMPTY_ELEMENT_LABEL = "";
38
	private T emptyElement;
39
	private static String EMPTY_ELEMENT_LABEL = "";
40 40

  
41 41
	private ArrayList<T> terms;
42 42

  
43
	protected Comparator<T> termComparator;
43
	private Comparator<T> termComparator;
44 44

  
45 45
	public Comparator<T> getTermComparator() {
46 46
		return termComparator;
......
48 48

  
49 49
	public void setTermComparator(Comparator<T> termComparator) {
50 50
		this.termComparator = termComparator;
51
		List<T> termsWithoutNull = getTerms().subList(1, getTerms().size());
51
		List<T> termsWithoutNull = terms.subList(1, terms.size());
52 52

  
53 53
		populateTerms(termsWithoutNull);
54 54

  
......
60 60

  
61 61
	private List<T> customPreferredTerms;
62 62

  
63
	protected boolean useAbbrevLabel = false;
63
	private boolean useAbbrevLabel = false;
64 64
	private boolean addEmptyElement;
65 65

  
66 66
	public TermComboElement(CdmFormFactory formFactory,
......
95 95
        this.termType = termType;
96 96
        this.termVocabulary = termVocabulary;
97 97
        this.termClass = termClass;
98
        this.setAddEmptyElement(addEmptyElement);
98
        this.addEmptyElement = addEmptyElement;
99 99
        this.useAbbrevLabel = useAbbrevLabel;
100 100
        this.termComparator = comparator;
101 101
        if (labelString != null) {
......
144 144
			// set selection to the emptyElement
145 145
			selectedIndex = 0;
146 146
		}else{
147
			selectedIndex = getTerms().indexOf(selection);
147
			selectedIndex = terms.indexOf(selection);
148 148
			if (selectedIndex == -1) {
149 149
				createTermNotInPreferredTerms(selection);
150
				selectedIndex = getTerms().indexOf(selection);
150
				selectedIndex = terms.indexOf(selection);
151 151
			}
152 152
		}
153 153
		combo.select(selectedIndex);
......
167 167

  
168 168
		combo.removeAll();
169 169

  
170
		setTerms(new ArrayList<T>());
170
		terms = new ArrayList<T>();
171 171

  
172 172
		int i = 1;
173 173
		int index = 0;
174 174

  
175
		if(isAddEmptyElement()){
175
		if(addEmptyElement){
176 176
		    // Add an empty element for when nothing was selected yet
177 177
		    combo.add(EMPTY_ELEMENT_LABEL);
178
		    getTerms().add(emptyElement);
178
		    terms.add(emptyElement);
179 179
		}
180 180

  
181 181
		if (termComparator != null) {
......
199 199
			}
200 200

  
201 201
			combo.add(label);
202
			getTerms().add(term);
202
			terms.add(term);
203 203

  
204 204
			i++;
205 205
			if (selection != null) {
......
272 272
	 *
273 273
	 * @param term
274 274
	 */
275
	protected void createTermNotInPreferredTerms(T term) {
275
	private void createTermNotInPreferredTerms(T term) {
276 276
		List<T> preferredTerms = getPreferredTerms();
277 277

  
278 278
		preferredTerms.add(term);
......
283 283
	/** {@inheritDoc} */
284 284
	@Override
285 285
    public void widgetSelected(SelectionEvent e) {
286
		selection = getTerms().get(combo.getSelectionIndex());
286
		selection = terms.get(combo.getSelectionIndex());
287 287
		firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
288 288
	}
289 289

  
......
322 322
	}
323 323

  
324 324
	public void removeEmptyElement(){
325
	    if(isAddEmptyElement()){
326
	        if(getTerms().contains(emptyElement)){
327
	            getTerms().remove(emptyElement);
325
	    if(addEmptyElement){
326
	        if(terms.contains(emptyElement)){
327
	            terms.remove(emptyElement);
328 328
	        }
329 329
	        if(Arrays.asList(combo.getItems()).contains(EMPTY_ELEMENT_LABEL)){
330 330
	            combo.remove(EMPTY_ELEMENT_LABEL);
......
332 332
	    }
333 333
	}
334 334

  
335
    public ArrayList<T> getTerms() {
336
        return terms;
337
    }
338

  
339
    public void setTerms(ArrayList<T> terms) {
340
        this.terms = terms;
341
    }
342

  
343
    public boolean isAddEmptyElement() {
344
        return addEmptyElement;
345
    }
346

  
347
    public void setAddEmptyElement(boolean addEmptyElement) {
348
        this.addEmptyElement = addEmptyElement;
349
    }
350 335
}

Also available in: Unified diff