Check in of new files before trying to add databinding.
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor.prototype2 / src / eu / etaxonomy / taxeditor / prototype2 / model / TaxonList.java
1 package eu.etaxonomy.taxeditor.prototype2.model;
2
3 import java.beans.PropertyChangeListener;
4 import java.beans.PropertyChangeSupport;
5 import java.util.ArrayList;
6 import java.util.List;
7
8 import eu.etaxonomy.cdm.model.name.TaxonName;
9
10 public class TaxonList {
11
12 private List<TaxonName>taxonList = new ArrayList<TaxonName>();
13
14 public void add(TaxonName tn) {
15 this.taxonList.add(tn);
16 firePropertyChange("taxonList", null, null); //$NON-NLS-1$
17 }
18
19 public void remove(TaxonName tn) {
20 this.taxonList.remove(tn);
21 firePropertyChange("taxonList", null, null); //$NON-NLS-1$
22 }
23
24 public TaxonName[] toArray() {
25 return (TaxonName[]) this.taxonList.toArray(new TaxonName[this.taxonList.size()]);
26 }
27
28 public List<TaxonName> getTaxonList() {
29 return taxonList;
30 }
31
32 public void setTaxonList(List<TaxonName> taxonList) {
33 this.taxonList = taxonList;
34 }
35
36 protected final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
37 public void addPropertyChangeListener(PropertyChangeListener listener) {
38 propertyChangeSupport.addPropertyChangeListener(listener);
39 }
40
41 public void addPropertyChangeListener(String propertyName,
42 PropertyChangeListener listener) {
43 propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
44 }
45
46 public void removePropertyChangeListener(PropertyChangeListener listener) {
47 propertyChangeSupport.removePropertyChangeListener(listener);
48 }
49
50 public void removePropertyChangeListener(String propertyName,
51 PropertyChangeListener listener) {
52 propertyChangeSupport.removePropertyChangeListener(propertyName,
53 listener);
54 }
55
56 protected void firePropertyChange(String propertyName, Object oldValue,
57 Object newValue) {
58 propertyChangeSupport.firePropertyChange(propertyName, oldValue,
59 newValue);
60 }
61 }