commit 06c249ebc0359beacdb3ffa8df5abbd5095ef2c5
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Mon May 22 14:40:47 2017 +0200

    ref #6169 better name for IdAndString class: EntityReference
      - also deleting an example class

diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/model/BeanItemContainerExample.java b/src/main/java/eu/etaxonomy/cdm/vaadin/model/BeanItemContainerExample.java
deleted file mode 100644
index d25fea6d..00000000
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/model/BeanItemContainerExample.java
+++ /dev/null
@@ -1,350 +0,0 @@
-package eu.etaxonomy.cdm.vaadin.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-
-public class BeanItemContainerExample extends CustomComponent  {
-    private static final long serialVersionUID = -6235574698344484522L;
-
-    public void init (String context) {
-        VerticalLayout layout = new VerticalLayout();
-
-        if ("basic".equals(context))
-            basic(layout);
-        else if ("addall".equals(context))
-            addall(layout);
-        else if ("dualbinding".equals(context))
-            dualbinding(layout);
-        else if ("beanupdate".equals(context))
-            beanupdate(layout);
-        else if ("nestedbean".equals(context))
-            nestedbean(layout);
-        else
-            layout.addComponent(new Label("Invalid context: " + context));
-        
-        setCompositionRoot(layout);
-    }
-    
-    // BEGIN-EXAMPLE: datamodel.container.beanitemcontainer.basic
-    // Here is a bean
-    public class Bean implements Serializable {
-        private static final long serialVersionUID = -1520923107014804137L;
-
-        String name;
-        double energy; // Energy content in kJ/100g
-        
-        public Bean(String name, double energy) {
-            this.name   = name;
-            this.energy = energy;
-        }
-        
-        public String getName() {
-            return name;
-        }
-        
-        public void setName(String name) {
-            this.name = name;
-        }
-        
-        public double getEnergy() {
-            return energy;
-        }
-        
-        public void setEnergy(double energy) {
-            this.energy = energy;
-        }
-    }
-    
-    void basic(VerticalLayout layout) {
-        // Create a container for such beans
-        BeanItemContainer<Bean> beans =
-            new BeanItemContainer<Bean>(Bean.class);
-        
-        // Add some beans to it
-        beans.addBean(new Bean("Mung bean",   1452.0));
-        beans.addBean(new Bean("Chickpea",    686.0));
-        beans.addBean(new Bean("Lentil",      1477.0));
-        beans.addBean(new Bean("Common bean", 129.0));
-        beans.addBean(new Bean("Soybean",     1866.0));
-
-        // Bind a table to it
-        Table table = new Table("Beans of All Sorts", beans);
-        layout.addComponent(table);
-        // END-EXAMPLE: datamodel.container.beanitemcontainer.basic
-        
-        table.setPageLength(beans.size());
-        table.setVisibleColumns(new Object[]{"name", "energy"});
-    }
-    
-    void addall(VerticalLayout layout) {
-        // BEGIN-EXAMPLE: datamodel.container.beanitemcontainer.addall
-        // Have a collection with some beans
-        ArrayList<Bean> beanlist = new ArrayList<Bean>();
-        beanlist.add(new Bean("Mung bean",   1452.0));
-        beanlist.add(new Bean("Chickpea",    686.0));
-        beanlist.add(new Bean("Lentil",      1477.0));
-        beanlist.add(new Bean("Common bean", 129.0));
-        beanlist.add(new Bean("Soybean",     1866.0));
-        
-        // Create a container for the beans
-        final BeanItemContainer<Bean> beans =
-            new BeanItemContainer<Bean>(Bean.class);
-        
-        // Add them all
-        beans.addAll(beanlist);
-
-        // Bind a table to the container
-        Table table = new Table("Beans of All Sorts", beans);
-        layout.addComponent(table);
-        
-        // Have a button to empty and create some new items
-        Button recreate = new Button("Recreate");
-        recreate.addListener(new ClickListener() {
-            private static final long serialVersionUID = 6823630748713272361L;
-
-            @Override
-            public void buttonClick(ClickEvent event) {
-                beans.removeAllItems();
-
-                ArrayList<Bean> beanlist = new ArrayList<Bean>();
-                beanlist.add(new Bean("Space bean",   42.0));
-                beanlist.add(new Bean("Moon bean",    388.0));
-                
-                beans.addAll(beanlist);
-            }
-        });
-        layout.addComponent(recreate);
-        // END-EXAMPLE: datamodel.container.beanitemcontainer.addall
-        
-        table.setPageLength(beans.size());
-        table.setVisibleColumns(new Object[]{"name", "energy"});
-    }
-    
-    public static final String dualbindingDescription =
-        "<h1>Binding a bean both to a Table and a Form</h1>"+
-        "<p>Editing the <b>BeanItem</b> in the form fires value change events, "+
-        "which are communicated to the other components bound to the same data source, in this case the <b>Table</b>.</p>";
-
-    @SuppressWarnings("unchecked")
-    void dualbinding(VerticalLayout vlayout) {
-        // BEGIN-EXAMPLE: datamodel.container.beanitemcontainer.dualbinding
-        // Create a container for beans
-        final BeanItemContainer<Bean> beans =
-            new BeanItemContainer<Bean>(Bean.class);
-        
-        // Add some beans to it
-        beans.addBean(new Bean("Mung bean",   1452.0));
-        beans.addBean(new Bean("Chickpea",    686.0));
-        beans.addBean(new Bean("Lentil",      1477.0));
-        beans.addBean(new Bean("Common bean", 129.0));
-        beans.addBean(new Bean("Soybean",     1866.0));
-
-        // A layout for the table and form
-        HorizontalLayout layout = new HorizontalLayout();
-
-        // Bind a table to it
-        final Table table = new Table("Beans of All Sorts", beans);
-        table.setVisibleColumns(new Object[]{"name", "energy"});
-        table.setPageLength(7);
-        layout.addComponent(table);
-        
-        // Create a form for editing a selected or new item.
-        // It is invisible until actually used.
-        final Form form = new Form();
-        form.setCaption("Edit Item");
-        form.setVisible(false);
-        layout.addComponent(form);
-        
-        // When the user selects an item, show it in the form
-        table.addListener(new Property.ValueChangeListener() {
-            private static final long serialVersionUID = 1162945655606583495L;
-
-            public void valueChange(ValueChangeEvent event) {
-                // Close the form if the item is deselected
-                if (event.getProperty().getValue() == null) {
-                    form.setVisible(false);
-                    return;
-                }
-
-                // Bind the form to the selected item
-                form.setItemDataSource(beans.getItem(table.getValue()));
-                form.setVisible(true);
-            }
-        });
-        table.setSelectable(true);
-        table.setImmediate(true);
-
-        // Creates a new bean for editing in the form before adding
-        // it to the table. Adding is handled after committing
-        // the form.
-        final Button newBean = new Button("New Bean");
-        newBean.addListener(new Button.ClickListener() {
-            private static final long serialVersionUID = -7340189561756261036L;
-
-            public void buttonClick(ClickEvent event) {
-                // Create a new bean and bind it to the form
-                Bean bean = new Bean(null, 0.0);
-                BeanItem<Bean> item = new BeanItem<Bean>(bean);
-                form.setItemDataSource(item);
-
-                // Make the form a bit nicer
-                form.setVisibleItemProperties(
-                        new Object[]{"name", "energy"});
-                ((TextField)form.getField("name"))
-                        .setNullRepresentation("");
-                
-                table.select(null);
-                table.setEnabled(false);
-                newBean.setEnabled(false);
-                form.setVisible(true);
-            }
-        });
-
-        // When OK button is clicked, commit the form to the bean
-        Button submit = new Button("OK");
-        submit.addListener(new Button.ClickListener() {
-            private static final long serialVersionUID = 6823630748713272361L;
-
-            public void buttonClick(ClickEvent event) {
-                form.commit();
-                form.setVisible(false); // and close it
-                
-                // New items have to be added to the container
-                if (table.getValue() == null) {
-                    BeanItem<Bean> item =
-                        (BeanItem<Bean>) form.getItemDataSource();
-
-                    // This creates a new BeanItem
-                    beans.addBean(item.getBean());
-                    
-                    table.setEnabled(true);
-                    newBean.setEnabled(true);
-                }
-            }
-        });
-        form.getFooter().addComponent(submit);
-
-        Button cancel = new Button("Cancel");
-        cancel.addListener(new Button.ClickListener() {
-            private static final long serialVersionUID = -1749148888766063606L;
-
-            public void buttonClick(ClickEvent event) {
-                form.discard(); // Not really necessary
-                form.setVisible(false); // and close it
-                table.setEnabled(true);
-                newBean.setEnabled(true);
-            }
-        });
-        form.getFooter().addComponent(cancel);
-        // END-EXAMPLE: datamodel.container.beanitemcontainer.dualbinding
-
-        layout.setSpacing(true);
-        vlayout.addComponent(layout);
-        vlayout.addComponent(newBean);
-    }
-
-    void beanupdate(VerticalLayout vlayout) {
-        // BEGIN-EXAMPLE: datamodel.container.beanitemcontainer.beanupdate
-        // Create a container for beans
-        final BeanItemContainer<Bean> beans =
-            new BeanItemContainer<Bean>(Bean.class);
-    }
-
-    // BEGIN-EXAMPLE: datamodel.container.beanitemcontainer.nestedbean
-    /** Bean to be nested */
-    public class EqCoord implements Serializable {
-        private static final long serialVersionUID = -3020840929725381667L;
-
-        double rightAscension; /* In angle hours */
-        double declination;    /* In degrees     */
-        
-        public EqCoord(double ra, double decl) {
-            this.rightAscension = ra;
-            this.declination    = decl;
-        }
-        
-        public double getRightAscension() {
-            return rightAscension;
-        }
-        public void setRightAscension(double rightAscension) {
-            this.rightAscension = rightAscension;
-        }
-
-        public double getDeclination() {
-            return declination;
-        }
-        public void setDeclination(double declination) {
-            this.declination = declination;
-        }
-    }
-
-    /** Bean containing a nested bean */
-    public class Star implements Serializable {
-        private static final long serialVersionUID = -312738461368736290L;
-
-        String  name;
-        EqCoord equatorial; /* Nested bean */
-        
-        public Star(String name, EqCoord equatorial) {
-            this.name       = name;
-            this.equatorial = equatorial;
-        }
-        
-        public String getName() {
-            return name;
-        }
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        /** Access to the nested bean. */
-        public EqCoord getEquatorial() {
-            return equatorial;
-        }
-        public void setEquatorial(EqCoord equatorial) {
-            this.equatorial = equatorial;
-        }
-    }
-    
-    void nestedbean(VerticalLayout layout) {
-        // Create a container for beans
-        final BeanItemContainer<Star> stars =
-            new BeanItemContainer<Star>(Star.class);
-        
-        // Declare the nested properties to be used in the container
-        stars.addNestedContainerProperty("equatorial.rightAscension");
-        stars.addNestedContainerProperty("equatorial.declination");
-        
-        // Add some items
-        stars.addBean(new Star("Sirius",  new EqCoord(6.75, 16.71611)));
-        stars.addBean(new Star("Polaris", new EqCoord(2.52, 89.26417)));
-        
-        // Put them in a table
-        Table table = new Table("Stars", stars);
-        table.setColumnHeader("equatorial.rightAscension", "RA");
-        table.setColumnHeader("equatorial.declination",    "Decl");
-        table.setPageLength(table.size());
-        
-        // Have to set explicitly to hide the "equatorial" property
-        table.setVisibleColumns(new Object[]{"name",
-            "equatorial.rightAscension", "equatorial.declination"});
-        
-        layout.addComponent(table);
-    }        
-    // END-EXAMPLE: datamodel.container.beanitemcontainer.nestedbean
-}
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/model/EntityReference.java b/src/main/java/eu/etaxonomy/cdm/vaadin/model/EntityReference.java
new file mode 100644
index 00000000..d3255511
--- /dev/null
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/model/EntityReference.java
@@ -0,0 +1,27 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.vaadin.model;
+
+public class EntityReference {
+    int id;
+    String label;
+
+    public EntityReference(int id, String label) {
+        this.id = id;
+        this.label = label;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationConverter.java b/src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationConverter.java
index 86c375cb..bba0661a 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationConverter.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationConverter.java
@@ -25,7 +25,7 @@ import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
-import eu.etaxonomy.cdm.vaadin.view.registration.IdAndString;
+import eu.etaxonomy.cdm.vaadin.model.EntityReference;
 import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationValidationException;
 
 /**
@@ -44,9 +44,9 @@ public class TypeDesignationConverter {
     private final String separator = ", ";
 
     private Collection<TypeDesignationBase> typeDesignations;
-    private Map<TypeDesignationStatusBase<?>, Collection<IdAndString>> orderedStringsByType;
-    private LinkedHashMap<String, Collection<IdAndString>> orderedRepresentations = new LinkedHashMap<>();
-    private IdAndString typifiedName;
+    private Map<TypeDesignationStatusBase<?>, Collection<EntityReference>> orderedStringsByType;
+    private LinkedHashMap<String, Collection<EntityReference>> orderedRepresentations = new LinkedHashMap<>();
+    private EntityReference typifiedName;
 
     private String finalString = null;
 
@@ -60,7 +60,7 @@ public class TypeDesignationConverter {
     public TypeDesignationConverter(Collection<TypeDesignationBase> typeDesignations) throws RegistrationValidationException {
         this.typeDesignations = typeDesignations;
         orderedStringsByType = new HashMap<>();
-        typeDesignations.forEach(td -> putString(td.getTypeStatus(), new IdAndString(td.getId(), stringify(td))));
+        typeDesignations.forEach(td -> putString(td.getTypeStatus(), new EntityReference(td.getId(), stringify(td))));
         orderedRepresentations = buildOrderedRepresentations();
         this.typifiedName = findTypifiedName();
     }
@@ -106,7 +106,7 @@ public class TypeDesignationConverter {
         return this;
     }
 
-    public Map<String, Collection<IdAndString>> getOrderedTypeDesignationRepresentations() {
+    public Map<String, Collection<EntityReference>> getOrderedTypeDesignationRepresentations() {
         return orderedRepresentations;
     }
 
@@ -116,7 +116,7 @@ public class TypeDesignationConverter {
      * @return
      * @throws RegistrationValidationException
      */
-    private IdAndString findTypifiedName() throws RegistrationValidationException {
+    private EntityReference findTypifiedName() throws RegistrationValidationException {
 
         List<String> problems = new ArrayList<>();
 
@@ -154,7 +154,7 @@ public class TypeDesignationConverter {
         }
 
         if(typifiedName != null){
-            return new IdAndString(typifiedName.getId(), typifiedName.getTitleCache());
+            return new EntityReference(typifiedName.getId(), typifiedName.getTitleCache());
         }
         return null;
     }
@@ -173,7 +173,7 @@ public class TypeDesignationConverter {
     /**
      * @return the title cache of the typifying name or <code>null</code>
      */
-    public IdAndString getTypifiedName() {
+    public EntityReference getTypifiedName() {
 
        return typifiedName;
 
@@ -264,13 +264,13 @@ public class TypeDesignationConverter {
         return sb.toString();
     }
 
-    private void putString(TypeDesignationStatusBase<?> status, IdAndString idAndString){
+    private void putString(TypeDesignationStatusBase<?> status, EntityReference idAndString){
         // the cdm orderd term bases are ordered invers, fixing this for here
         if(status == null){
             status = SpecimenTypeDesignationStatus.TYPE();
         }
         if(!orderedStringsByType.containsKey(status)){
-            orderedStringsByType.put(status, new ArrayList<IdAndString>());
+            orderedStringsByType.put(status, new ArrayList<EntityReference>());
         }
         orderedStringsByType.get(status).add(idAndString);
     }
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/IdAndString.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/IdAndString.java
deleted file mode 100644
index 98da7d3d..00000000
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/IdAndString.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
-* Copyright (C) 2017 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.cdm.vaadin.view.registration;
-
-public class IdAndString {
-    int id;
-    String label;
-
-    public IdAndString(int id, String label) {
-        this.id = id;
-        this.label = label;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public String getLabel() {
-        return label;
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationDTO.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationDTO.java
index 354de4ec..084c5a2b 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationDTO.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationDTO.java
@@ -26,6 +26,7 @@ import eu.etaxonomy.cdm.model.name.RegistrationStatus;
 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
 import eu.etaxonomy.cdm.model.reference.IReference;
+import eu.etaxonomy.cdm.vaadin.model.EntityReference;
 import eu.etaxonomy.cdm.vaadin.util.converter.TypeDesignationConverter;
 
 public class RegistrationDTO{
@@ -42,7 +43,7 @@ public class RegistrationDTO{
 
     private String submitterUserName = null;
 
-    private IdAndString name = null;
+    private EntityReference name = null;
 
     private TypeDesignationConverter typeDesignationConverter;
 
@@ -71,7 +72,7 @@ public class RegistrationDTO{
         if(hasName(reg)){
             citation = reg.getName().getNomenclaturalReference();
             citationDetail = reg.getName().getNomenclaturalMicroReference();
-            name = new IdAndString(reg.getName().getId(), reg.getName().getTitleCache());
+            name = new EntityReference(reg.getName().getId(), reg.getName().getTitleCache());
         }
         if(hasTypifications(reg)){
             if(!reg.getTypeDesignations().isEmpty()){
@@ -221,15 +222,15 @@ public class RegistrationDTO{
         return citation == null ? null : citation.getId();
     }
 
-    public IdAndString getTypifiedName() {
+    public EntityReference getTypifiedName() {
         return typeDesignationConverter != null ? typeDesignationConverter.getTypifiedName() : null;
     }
 
-    public IdAndString getName() {
+    public EntityReference getName() {
         return name;
     }
 
-    public Map<String, Collection<IdAndString>> getTypeDesignations() {
+    public Map<String, Collection<EntityReference>> getTypeDesignations() {
         return typeDesignationConverter != null ? typeDesignationConverter.getOrderedTypeDesignationRepresentations() : null;
     }
 
