merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / FieldObservationSelectionDialog.java
index acd322f89954ce6f48cb50702e2148353ac653ed..a3bf4c29c7fc663518e1ef585efd3e62fa4df784 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -17,7 +17,7 @@ import org.eclipse.swt.widgets.Shell;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
 import eu.etaxonomy.taxeditor.newWizard.NewFieldObservationWizard;
@@ -32,17 +32,17 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @version 1.0
  */
 public class FieldObservationSelectionDialog extends
-               AbstractFilteredCdmResourceSelectionDialog<FieldObservation> {
-       
+               AbstractFilteredCdmResourceSelectionDialog<FieldUnit> {
+
        /**
         * <p>select</p>
         *
         * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
         * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-        * @param observation a {@link eu.etaxonomy.cdm.model.occurrence.FieldObservation} object.
-        * @return a {@link eu.etaxonomy.cdm.model.occurrence.FieldObservation} object.
+        * @param observation a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object.
+        * @return a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object.
         */
-       public static FieldObservation select(Shell shell, ConversationHolder conversation, FieldObservation observation){
+       public static FieldUnit select(Shell shell, ConversationHolder conversation, FieldUnit observation){
                FieldObservationSelectionDialog dialog = new FieldObservationSelectionDialog(shell, conversation,
                                "Choose Derived Unit", false, FieldObservationSelectionDialog.class.getCanonicalName(), observation);
                return getSelectionFromDialog(dialog);
@@ -58,24 +58,24 @@ public class FieldObservationSelectionDialog extends
         * @param settings a {@link java.lang.String} object.
         * @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.FieldObservation} object.
         */
-       protected FieldObservationSelectionDialog(Shell shell, ConversationHolder conversation, 
+       protected FieldObservationSelectionDialog(Shell shell, ConversationHolder conversation,
                        String title, boolean multi, String settings,
-                       FieldObservation cdmObject) {
+                       FieldUnit cdmObject) {
                super(shell, conversation, title, multi, settings, cdmObject);
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
         */
        /** {@inheritDoc} */
        @Override
-       protected FieldObservation getPersistentObject(UUID uuid) {
+       protected FieldUnit getPersistentObject(UUID uuid) {
                Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);
-               
+
                SpecimenOrObservationBase specimenObservationBase = (SpecimenOrObservationBase) HibernateProxyHelper.deproxy(object);
-               
-               if(specimenObservationBase instanceof FieldObservation){        
-                       return (FieldObservation) specimenObservationBase; 
+
+               if(specimenObservationBase instanceof FieldUnit){
+                       return (FieldUnit) specimenObservationBase;
                }
                StoreUtil.error(this.getClass(), "Selected object is not a field observation", null);
                return null;
@@ -87,7 +87,7 @@ public class FieldObservationSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
-               model = CdmStore.getService(IOccurrenceService.class).getFieldObservationUuidAndTitleCache();
+               model = CdmStore.getService(IOccurrenceService.class).getFieldUnitUuidAndTitleCache();
        }
 
        /** {@inheritDoc} */
@@ -99,6 +99,6 @@ public class FieldObservationSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected String getNewWizardLinkText() {
-               return "Click link to create a new <A>Field Observation</A>.";
+               return String.format("Create a new <a>%1s</a>", "Field Observation ");
        }
 }