Merge branch 'release/3.7.0'
authorjenkins <jenkins-int@bgbm.org>
Wed, 15 Jul 2015 15:56:02 +0000 (17:56 +0200)
committerjenkins <jenkins-int@bgbm.org>
Wed, 15 Jul 2015 15:56:02 +0000 (17:56 +0200)
Conflicts:
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.feature.platform/feature.xml
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF

112 files changed:
eu.etaxonomy.taxeditor.application/.classpath
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.application/pom.xml
eu.etaxonomy.taxeditor.application/src/test/java/README [new file with mode: 0644]
eu.etaxonomy.taxeditor.application/src/test/java/eu/etaxonomy/taxeditor/README.txt [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.bulkeditor/pom.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ConvertPerson2TeamHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsContentProvider.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsLabelProvider.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/.gitignore [new file with mode: 0644]
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.cdmlib/pom.xml
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/lazyloading/CdmLazyLoader.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/pom.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientAgentService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientCollectionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientDescriptionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientNameService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientReferenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTermService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java
eu.etaxonomy.taxeditor.feature.platform/feature.xml
eu.etaxonomy.taxeditor.feature.platform/pom.xml
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.feature/pom.xml
eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.help/pom.xml
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.navigation/plugin.xml
eu.etaxonomy.taxeditor.navigation/pom.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationCdmViewer.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeComparator.java with 75% similarity]
eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.printpublisher/pom.xml
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/pom.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/MatchStrategyConfigurator.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmFormElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamMemberElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementMediaSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/ITogglableMediaElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/ImageFileElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaRepresentationPartElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/ProtologueElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractUnboundEntityCollectionSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSamplePreparationPreservationDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSamplePreparationPreservationSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SequenceReferenceCollectionDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/MarkerElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/MarkerSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/FeatureDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElementWithAbbreviatedTitle.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerChooser.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerContextMenu.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/ICdmViewer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
eu.etaxonomy.taxeditor.store/src/test/resources/eu/etaxonomy/cdm/database/dataset.dtd
eu.etaxonomy.taxeditor.store/src/test/resources/eu/etaxonomy/taxeditor/io/NormalExplicitImportTest.xml
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor/.gitignore [new file with mode: 0644]
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product
eu.etaxonomy.taxeditor/pom.xml
pom.xml

index 53dbdc7801b5019e5530b50d2e88e1f666fa8f39..4c7e96f59500b4f98198fb4a11bdf511d1107b48 100644 (file)
@@ -4,6 +4,5 @@
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
        <classpathentry kind="src" path="src/main/resources"/>
-       <classpathentry kind="src" path="src/test/java/"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index e172653a0d711e4915c9c6440eec46f0451ca629..4ea588535e15a26b46ce0aa107d32163968e1156 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Application
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
 Bundle-Vendor: EDIT
 Bundle-Localization: OSGI-INF/l10n/plugin
index 015590ea9db114224d6ff4ce5380d95593e108c3..bd81b5f07dccb5a81004cd74bacb75fce7b29486 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>3.6.1</version>
+    <version>3.7.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/eu.etaxonomy.taxeditor.application/src/test/java/README b/eu.etaxonomy.taxeditor.application/src/test/java/README
new file mode 100644 (file)
index 0000000..48df6ff
--- /dev/null
@@ -0,0 +1 @@
+This is only a placeholder to allow empty folder be committed to git. Can be removed if any other file exists in this folder.
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.application/src/test/java/eu/etaxonomy/taxeditor/README.txt b/eu.etaxonomy.taxeditor.application/src/test/java/eu/etaxonomy/taxeditor/README.txt
new file mode 100644 (file)
index 0000000..b2e1e57
--- /dev/null
@@ -0,0 +1 @@
+This is only a placeholder file to allow an empty folder. Can be deleted once another file is present in this folder.
\ No newline at end of file
index 83c58bcc615f656d51e71914448634de0c1c4bbd..90e193d0d47e063c144fbfb9030cf21d0ea9fb10 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Bulkeditor Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
index f4bce774650a6ae2b7ffc18771770edeeae65744..6a4d7e4397134813756f8dcd6a038cf18dd8d9de 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.6.1</version>
+               <version>3.7.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 2191fa9b5cd94a918920d0b4e0fd88e443e821f2..cb3a610edd667d001572a5b70e125f53384a4e97 100644 (file)
@@ -79,9 +79,9 @@ public class ConvertPerson2TeamHandler extends AbstractHandler {
                                        try {\r
                                                team = CdmStore.getService(IAgentService.class).convertPerson2Team(person);\r
                                        } catch (IllegalArgumentException e) {\r
-                                               MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());\r
+                                               MessagingUtils.errorDialog("Can not convert Team to Person", null, e.getMessage(), null,e, true);\r
                                        } catch (MergeException e) {\r
-                                               MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());\r
+                                               MessagingUtils.errorDialog("Can not convert Team to Person", null, e.getMessage(), null,e, true);\r
                                        }\r
                                }else{\r
                                        MessagingUtils.informationDialog("Can not convert Team to Person", "convertTeam2Person can only be called on a team.");\r
index 206f0d518538d97a4811bb5fbda4973798a6e16c..a34d7c5d1ce0f0d7cc4b40ed6a0a4357d841a6a2 100644 (file)
@@ -140,14 +140,14 @@ public class DeleteHandler extends AbstractHandler {
                                                if (name != null){
                                                        NameDeletionConfigurator config = new NameDeletionConfigurator();
                                                        
-                                                       result = service.delete(name, config);
+                                                       result = service.delete(name.getUuid(), config);
                                                } 
                                        } else if (object instanceof TaxonBase){
                                                ITaxonService service = controller.getTaxonService();
                                                TaxonBase taxonBase = service.load(((TaxonBase) object).getUuid());
                                                if (taxonBase != null){
                                                        if (object instanceof Taxon){
-                                                               result = service.deleteTaxon((Taxon)object, null, null);
+                                                               result = service.deleteTaxon(((TaxonBase) object).getUuid(), null, null);
                                                        }else{
                                                                result = service.deleteSynonym((Synonym)object, null);
                                                        }
index e5b852b5ab76e79dc3e8abf0862f5ef0cd935e35..82cd233202777608632aee5d212f9fbc00bf7ee6 100644 (file)
@@ -52,7 +52,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
        private List<T> model;
 
        private IEntityCreator<T> entityCreator;
-       
+
        private static Class serviceClass;
 
        /**
@@ -62,7 +62,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
         * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
         */
        static public AbstractBulkEditorInput NewInstance(BulkEditorInputType inputType) {
-               
+
                return BulkEditorInputType.getInput(inputType);
        }
 
@@ -99,7 +99,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
         * @return a T object.
         */
        protected T loadEntity(UUID entityUuid) {
-               List<String> propertyPaths = Arrays.asList(new String[]{}); 
+               List<String> propertyPaths = Arrays.asList(new String[]{});
                return (T) CdmStore.getService(serviceClass).load(entityUuid, propertyPaths);
        }
 
@@ -179,7 +179,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
 
                if(getEntityUuid() != null){
 
-                       T entity = (T) loadEntity(getEntityUuid());
+                       T entity = loadEntity(getEntityUuid());
                        entityList.add(entity);
                        model = entityList;
                }
@@ -191,7 +191,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
                        entityList = listEntities(configurator);
 
                        Collections.sort(entityList, queryComparator);
-                       
+
 
                }
 
@@ -231,7 +231,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
     public boolean merge(T entity, T mergeTarget) {
                if (entity instanceof IMergable) {
                        try {
-                               CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, null);                             
+                               CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity);
                        } catch (MergeException e) {
                                MessagingUtils.errorDialog("Bulk Editor Merge Error",
                                                this,
@@ -279,7 +279,7 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEd
         * Returns a textual representation given object. The default implementation
         * in the abstract base class returns the simple name of the class, this may
         * be overwritten to something more specific in subclasses.
-        * 
+        *
         * @param entity
         * @return a textual representation given object.
         */
index 6bc3888409bdd444a98f135658dca8d55e41fbf1..8c198fc9bd5805715f409370627356eca4d4f62f 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.
 */
@@ -25,31 +25,26 @@ import org.eclipse.jface.viewers.Viewer;
  */
 public class ReferencingObjectsContentProvider implements
                IStructuredContentProvider {
-       private static final Logger logger = Logger
+       @SuppressWarnings("unused")
+    private static final Logger logger = Logger
                        .getLogger(ReferencingObjectsContentProvider.class);
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
-        */
        /** {@inheritDoc} */
-       public Object[] getElements(Object inputElement) {
+       @Override
+    public Object[] getElements(Object inputElement) {
                if (inputElement instanceof Collection) {
-                       return ((Collection) inputElement).toArray();
+                       return ((Collection<?>) inputElement).toArray();
                }
                return new Object[0];
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.IContentProvider#dispose()
-        */
        /**
         * <p>dispose</p>
         */
-       public void dispose() {}
+       @Override
+    public void dispose() {}
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
-        */
        /** {@inheritDoc} */
-       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+       @Override
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
 }
index ec442ba8121e224a2e91bbf51ce2d6614601a522..99bbb847af9933d59eaeec55e21f68ac00915e9f 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.
 */
@@ -37,24 +37,20 @@ public class ReferencingObjectsLabelProvider extends LabelProvider implements IT
        public ReferencingObjectsLabelProvider() {
        }
 
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
-        */
+
        /** {@inheritDoc} */
-       public Image getColumnImage(Object element, int columnIndex) {
+       @Override
+    public Image getColumnImage(Object element, int columnIndex) {
                return null;
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
-        */
        /** {@inheritDoc} */
-       public String getColumnText(Object element, int columnIndex) {
+       @Override
+    public String getColumnText(Object element, int columnIndex) {
                String text = null;
-               
+
                Object deproxiedElement = HibernateProxyHelper.deproxy(element);
-               
+
                if (columnIndex == 0) {
                        text = DescriptionHelper.getObjectClassname(deproxiedElement);
                }else if (columnIndex == 1) {
@@ -68,8 +64,8 @@ public class ReferencingObjectsLabelProvider extends LabelProvider implements IT
                                text = ((CdmBase) element).getId() + "";
                        }
                }
-               
+
                return text == null ? element.toString() : text;
-               
+
        }
 }
index a9f3c11b85715ee97d1d86b4e2aff6810b7cc2f2..ee3cd44efb078430a6d24fdee4cd1db9eb08a8a1 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.
 */
@@ -22,44 +22,38 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
-
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.INullSelectionListener;
-import org.eclipse.ui.ISelectionListener;
-
 import org.eclipse.ui.IWorkbenchPart;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
-
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.IUserService;
-
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Group;
-
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.model.DescriptionHelper;
 import eu.etaxonomy.taxeditor.model.LineSelection;
@@ -79,12 +73,12 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
 
        /** Constant <code>ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects";
-       
+
        private TableViewer viewer;
 
        private String referencedObjectTitleCache;
-       private ConversationHolder conversation; 
-       
+       private ConversationHolder conversation;
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
         */
@@ -98,9 +92,37 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                createColumns(viewer);
                viewer.setContentProvider(new ReferencingObjectsContentProvider());
                viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
+               viewer.setCellModifier(new ICellModifier() {
+
+            @Override
+            public void modify(Object element, String property, Object value) {
+                // TODO Auto-generated method stub
+
+            }
+
+            @Override
+            public Object getValue(Object element, String property) {
+                ITableLabelProvider tableLabelProvider = null;
+                if(viewer.getLabelProvider() instanceof ITableLabelProvider){
+                    tableLabelProvider = (ITableLabelProvider) viewer.getLabelProvider();
+                }
+                Object[] columnProperties = viewer.getColumnProperties();
+                for (int i=0;i<columnProperties.length;i++) {
+                    if(columnProperties[i].equals(property) && tableLabelProvider!=null){
+                        return tableLabelProvider.getColumnText(element, i);
+                    }
+                }
+                return "";
+            }
+
+            @Override
+            public boolean canModify(Object element, String property) {
+                return true;
+            }
+        });
 //             viewer.setInput(new ArrayList<CdmBase>());
        }
-       
+
        /**
         * Create the columns for the table
         * @param viewer
@@ -110,8 +132,11 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                String[] titles = {"Class", "Description", "UUID", "Object ID" };
                int[] bounds = { 100, 200, 100, 70};
 
+        CellEditor[] editors = new CellEditor[titles.length];
+
                for (int i = 0; i < titles.length; i++) {
                        TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+                       editors[i] = new TextCellEditor(table);
                        column.getColumn().setText(titles[i]);
                        column.getColumn().setWidth(bounds[i]);
                        column.getColumn().setResizable(true);
@@ -119,6 +144,9 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                }
                table.setHeaderVisible(true);
                table.setLinesVisible(true);
+
+               viewer.setCellEditors(editors);
+               viewer.setColumnProperties(titles);
        }
 
        /**
@@ -127,39 +155,38 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
         * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
         */
        public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
-               
+
                final Display display = Display.getCurrent();
-               
+
                Job job = new Job("Update Referencing Objects") {
-                       
+
                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
                                monitor.beginTask("Calculating referencing objects", 10);
-                       
+
                                monitor.worked(3);
-                               
+
                                display.asyncExec(new Runnable() {
-                                       
+
                                        @Override
                                        public void run() {
                                                if (entityUUID != null){
-                                                       
+
                                                        List<CdmBase> referencingObjects = getReferencingObjects(entityUUID, objectClass);
-                                                       
+
                                                        updateView(referencingObjects);
-                                                       
-                                                       
+
                                                }
                                        }
                                });
-                               
+
                                monitor.done();
-                               
-                               
+
+
                                return Status.OK_STATUS;
                        }
                };
-               
+
                job.setPriority(Job.DECORATE);
                job.schedule();
        }
@@ -184,31 +211,32 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                }
                        //referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
                Set<CdmBase> setOfReferencingObjects = null;
-               
+
                if (referencedObject != null){
                        referencedObjectTitleCache = ((IdentifiableEntity)referencedObject).getTitleCache();
                        setOfReferencingObjects = CdmStore.getCommonService().getReferencingObjects(referencedObject);
                }
                if (setOfReferencingObjects != null){
-                       List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);                     
-                       
+                       List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
+
                        Collections.sort(referencingObjects, new ReferencingClassComparator());
-                               
+
                        return referencingObjects;
-                       
+
                }
         } catch (Exception e) {
             logger.error("Error retrieving referencing objects", e);
         }
                return null;
        }
-       
+
        class ReferencingClassComparator implements Comparator<CdmBase> {
 
                /* (non-Javadoc)
                 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
                 */
-               public int compare(CdmBase o1, CdmBase o2) {
+               @Override
+        public int compare(CdmBase o1, CdmBase o2) {
                        String string1 = o1.getClass().getSimpleName();
                        String string2 = o2.getClass().getSimpleName();
                        int classCompare = string1.compareToIgnoreCase(string2);
@@ -221,46 +249,52 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                        }
                }
        }
-       
+
        /**
-        * 
+        *
         */
        private void updateView(List<CdmBase> referencingObjects) {
                if (viewer != null && !viewer.getControl().isDisposed()){
-                       viewer.setInput(referencingObjects);
-                       if (referencedObjectTitleCache != null){
-                               setContentDescription("'" + referencedObjectTitleCache + "' is referenced by:");
-                       } else {
-                               setContentDescription("");
+                       try{
+                               viewer.setInput(referencingObjects);
+                               if (referencedObjectTitleCache != null){
+                                       setContentDescription("'" + referencedObjectTitleCache + "' is referenced by:");
+                               } else {
+                                       setContentDescription("");
+                               }
+                               showViewer();
+                       }catch(Exception e){
+                               setContentDescription("Some Problems occured.");
                        }
-                       showViewer();
+
                }
        }
 
        /** {@inheritDoc} */
-       public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+       @Override
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
                if(! (part instanceof BulkEditor)){
                        setContentDescription("");
                        showEmptyPage();
                        return;
                }
-               
+
                if(! (selection instanceof LineSelection)){
                        return;
                }
                LineSelection lineSelection = (LineSelection) selection;
-               
+
                if(lineSelection.size() != 1){
                        return;
                }
-                       
+
                if(! (lineSelection.getFirstElement() instanceof IdentifiableEntity)){
                        return;
                }
-               
+
                showViewer(part, lineSelection);
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#showViewer(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
         */
@@ -268,10 +302,10 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        @Override
        public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
        //      this.part = part;
-               
+
                updateReferencingObjects(((IdentifiableEntity) selection.getFirstElement()).getUuid(),selection.getFirstElement().getClass() );
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void dispose() {
@@ -279,7 +313,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                super.dispose();
-               
+
        }
 
        /* (non-Javadoc)
@@ -299,7 +333,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        public void changed(Object object) {
                // no editing in this view
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#onComplete()
         */
@@ -308,14 +342,14 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        public boolean onComplete() {
                return false;
        }
-       
+
        public void refresh(){
-               
+
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                selectionService.addPostSelectionListener(this);
                selectionService.addSelectionListener(this);
-               
+
        }
 
 
index deca8d664d03c902de60245576e1706e29c78900..20cffab12135d832275af97a5af5a8ae56d0d5a2 100644 (file)
@@ -1,5 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.7.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.7.0.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry kind="src" path="src/main/java"/>
        <classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/poi-3.10-FINAL.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/poi-ooxml-3.10-FINAL.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.3.0.jar"/>
diff --git a/eu.etaxonomy.taxeditor.cdmlib/.gitignore b/eu.etaxonomy.taxeditor.cdmlib/.gitignore
new file mode 100644 (file)
index 0000000..c5e82d7
--- /dev/null
@@ -0,0 +1 @@
+bin
\ No newline at end of file
index 83fdfb4880f18b10566688d7258182a0d6ad865a..a9257eb9dcb152a015c92e1d9ebec0050ed7689a 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: CDM Library Dependencies Plugin
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Eclipse-BundleShape: dir
 Export-Package: com.google.api,
  com.google.api.detect,
@@ -607,25 +607,17 @@ Bundle-ClassPath: .,
  lib/spring-security-remoting-3.1.3.RELEASE.jar,
  lib/jena-core-2.11.2.jar,
  lib/jena-iri-1.0.2.jar,
- lib/cdmlib-commons-3.6.1-sources.jar,
- lib/cdmlib-commons-3.6.1.jar,
- lib/cdmlib-ext-3.6.1-sources.jar,
- lib/cdmlib-ext-3.6.1.jar,
- lib/cdmlib-io-3.6.1-sources.jar,
- lib/cdmlib-io-3.6.1.jar,
- lib/cdmlib-model-3.6.1-sources.jar,
- lib/cdmlib-model-3.6.1.jar,
- lib/cdmlib-persistence-3.6.1-sources.jar,
- lib/cdmlib-persistence-3.6.1.jar,
- lib/cdmlib-print-3.6.1-sources.jar,
- lib/cdmlib-print-3.6.1.jar,
- lib/cdmlib-remote-3.6.1-sources.jar,
- lib/cdmlib-remote-3.6.1.jar,
- lib/cdmlib-services-3.6.1-sources.jar,
- lib/cdmlib-services-3.6.1.jar,
  lib/poi-3.10-FINAL.jar,
  lib/poi-ooxml-3.10-FINAL.jar,
  lib/xmlbeans-2.3.0.jar,
  lib/poi-ooxml-schemas-3.10-FINAL.jar,
- lib/swagger-annotations-1.3.5.jar
+ lib/swagger-annotations-1.3.5.jar,
+ lib/cdmlib-commons-3.7.0.jar,
+ lib/cdmlib-ext-3.7.0.jar,
+ lib/cdmlib-io-3.7.0.jar,
+ lib/cdmlib-model-3.7.0.jar,
+ lib/cdmlib-persistence-3.7.0.jar,
+ lib/cdmlib-print-3.7.0.jar,
+ lib/cdmlib-remote-3.7.0.jar,
+ lib/cdmlib-services-3.7.0.jar
 Import-Package: eu.etaxonomy.cdm.api.application
index f2e704dbbc2ffefc0cfde877e358d9693e295496..e5abfe10683163772e1a966a434c0d85ad7dc75d 100644 (file)
@@ -193,23 +193,15 @@ bin.includes = META-INF/,\
                lib/poi-ooxml-3.10-FINAL.jar,\\r
                lib/poi-ooxml-schemas-3.10-FINAL.jar,\\r
                lib/xmlbeans-2.3.0.jar,\\r
-               lib/cdmlib-commons-3.6.1-sources.jar,\\r
-               lib/cdmlib-commons-3.6.1.jar,\\r
-               lib/cdmlib-ext-3.6.1-sources.jar,\\r
-               lib/cdmlib-ext-3.6.1.jar,\\r
-               lib/cdmlib-io-3.6.1-sources.jar,\\r
-               lib/cdmlib-io-3.6.1.jar,\\r
-               lib/cdmlib-model-3.6.1-sources.jar,\\r
-               lib/cdmlib-model-3.6.1.jar,\\r
-               lib/cdmlib-persistence-3.6.1-sources.jar,\\r
-               lib/cdmlib-persistence-3.6.1.jar,\\r
-               lib/cdmlib-print-3.6.1-sources.jar,\\r
-               lib/cdmlib-print-3.6.1.jar,\\r
-               lib/cdmlib-remote-3.6.1-sources.jar,\\r
-               lib/cdmlib-remote-3.6.1.jar,\\r
-               lib/cdmlib-services-3.6.1-sources.jar,\\r
-               lib/cdmlib-services-3.6.1.jar,\\r
-               lib/swagger-annotations-1.3.5.jar\r
+               lib/swagger-annotations-1.3.5.jar,\\r
+               lib/cdmlib-commons-3.7.0.jar,\\r
+               lib/cdmlib-ext-3.7.0.jar,\\r
+               lib/cdmlib-io-3.7.0.jar,\\r
+               lib/cdmlib-model-3.7.0.jar,\\r
+               lib/cdmlib-persistence-3.7.0.jar,\\r
+               lib/cdmlib-print-3.7.0.jar,\\r
+               lib/cdmlib-remote-3.7.0.jar,\\r
+               lib/cdmlib-services-3.7.0.jar\r
 \r
 jars.compile.order = .\r
 output.. = bin/\r
index 7ebc5c5e32ce0f22f1e36eb3f834d3fc1104ab59..9526cf8915ea55d37d7c19b0c8285c752cd26c84 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>3.6.1</version>
+    <version>3.7.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>
index f122d18eb3dc948b16be3a74afea317ebdf08f2a..4de156c496dadc30b98aa873290f29f8d6b2613e 100644 (file)
@@ -20,7 +20,7 @@ import eu.etaxonomy.cdm.model.common.CdmBase;
  * @param <T>
  */
 @Component
-public class CdmServiceCacher<T extends CdmBase> extends CdmCacher<T> {
+public class CdmServiceCacher<T extends CdmBase> extends CdmCacher {
 
        @Autowired
        ITermService termService;
@@ -39,4 +39,22 @@ public class CdmServiceCacher<T extends CdmBase> extends CdmCacher<T> {
 
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.model.ICdmCacher#isCachable(eu.etaxonomy.cdm.model.common.CdmBase)
+     */
+    @Override
+    public boolean isCachable(CdmBase arg0) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.cache.CdmCacher#load(eu.etaxonomy.cdm.model.common.CdmBase)
+     */
+    @Override
+    public CdmBase load(CdmBase arg0) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }
index e98d40df7db0f293682d58f91da538d3f74caa1a..db64c568cc1ca7b2e7289ccecfbad00cd8b5c91e 100644 (file)
@@ -1,6 +1,5 @@
 package eu.etaxonomy.cdm.api.lazyloading;
 
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -37,24 +36,24 @@ import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
 public class CdmLazyLoader {
 
 
-       private Set classes = new HashSet();
-       
+       private final Set classes = new HashSet();
+
        public static boolean enableWeaving = true;
        private static Set<String> classesToIgnore = new HashSet<String>();
-       
-       
+
+
        @Autowired
        private ICommonService commonService;
 
        public CdmLazyLoader() {
                //classesToIgnore.add("eu.etaxonomy.cdm.model.common.TermVocabulary");
                //classesToIgnore.add("eu.etaxonomy.cdm.model.common.OrderedTermVocabulary");
-               
+
        }
-       
+
        /**
         *  Point cut for the 'initialize' method of the AbstractLazyInitializer.
-        *  
+        *
         */
        @Pointcut("execution(* org.hibernate.proxy.AbstractLazyInitializer.initialize())")
        public void possibleEntityLazyInitializationException() {
@@ -63,43 +62,43 @@ public class CdmLazyLoader {
 
        /**
         *  'Around' advice for the initialization of CDM Entity Objects
-        *  
+        *
         */
        @Around(value = "possibleEntityLazyInitializationException()")
-       public Object preloadEntityOnDemand(ProceedingJoinPoint pjp) throws Throwable {          
+       public Object preloadEntityOnDemand(ProceedingJoinPoint pjp) throws Throwable {
                if(enableWeaving) {
-                       LazyInitializer ll = (LazyInitializer)pjp.getTarget();          
-                       if(ll.isUninitialized()) {                              
+                       LazyInitializer ll = (LazyInitializer)pjp.getTarget();
+                       if(ll.isUninitialized()) {
                                int classid = ((Integer)ll.getIdentifier()).intValue();
                                System.out.print("--> AspectJ Compile-Time Weaving " + ll.getEntityName() + " with id " + classid);
-                               Class clazz = (Class<? extends CdmBase>) Class.forName(ll.getEntityName());
+                               Class clazz = Class.forName(ll.getEntityName());
                                CdmBase cdmBase = CdmBase.deproxy(commonService.find(clazz,classid),clazz);
                                ll.setImplementation(cdmBase);
                                System.out.println("....Done");
                        }
                }
-               return pjp.proceed();                             
+               return pjp.proceed();
        }
-       
+
 
        /**
         *  Point cut for the 'initialize' method of the AbstractPersistentCollection.
-        *  
+        *
         */
        @Pointcut("execution(protected final void org.hibernate.collection.internal.AbstractPersistentCollection.initialize(..))")
        public void possibleCollectionLazyInitializationException() {
        }
-       
+
        /**
         *  'Around' advice for the initialization of Collection objects
-        *  
+        *
         */
-       @Around(value = "possibleCollectionLazyInitializationException()")      
-       public Object preloadCollectionOnDemand(ProceedingJoinPoint pjp) throws Throwable {              
+       @Around(value = "possibleCollectionLazyInitializationException()")
+       public Object preloadCollectionOnDemand(ProceedingJoinPoint pjp) throws Throwable {
                if(enableWeaving) {
                        PersistentCollection ps = (PersistentCollection) pjp.getTarget();
                        if (ps.getOwner() != null && !classesToIgnore.contains(ps.getOwner().getClass().getName()) && !ps.wasInitialized() &&  !classes.contains(ps.getKey())) {
-                               System.out.print("--> AspectJCompile-Time Weaving " + ps.getRole());                
+                               System.out.print("--> AspectJCompile-Time Weaving " + ps.getRole());
                                classes.add(ps.getKey());
                                try {
                                        String role = ps.getRole();
@@ -107,29 +106,31 @@ public class CdmLazyLoader {
                                        System.out.print(", field : " + fieldName);
                                        Object owner = ps.getOwner();
 
-                                       PersistentCollection col = commonService.initializeCollection(ps); 
+                                       Object col = commonService.initializeCollection(((CdmBase)owner).getUuid(), fieldName);
                                        ps.afterInitialize();
 
-                                       Class<?> clazz = ps.getClass();
-                                       if (clazz != null) {    
-                                               CollectionField cf = getCollectionField(col);
-                                               Field field = clazz.getDeclaredField(cf.getFieldName());
-                                               field.setAccessible(true);
-                                               field.set(ps, cf.getCollection());                             
-                                       }               
+//                                     Class<?> clazz = ps.getClass();
+//                                     if (clazz != null) {
+//                                             CollectionField cf = getCollectionField(col);
+//                                             Field field = clazz.getDeclaredField(cf.getFieldName());
+//                                             field.setAccessible(true);
+//                                             field.set(ps, cf.getCollection());
+//                                     }
+
                                } catch (Exception ex) {
                                        ex.printStackTrace();
                                        System.out.println("Error in ReattachSessionAspect : " + ex.getMessage());
                                } finally {
                                        classes.remove(ps.getKey());
                                        System.out.println("....Done");
-                               }       
+                                       throw new Exception("This code is invalid");
+                               }
                        }
-               } 
+               }
                return pjp.proceed();
 
        }
-       
+
        private CollectionField getCollectionField(PersistentCollection pc) {
                if(pc != null) {
                        if(pc instanceof PersistentSet) {
@@ -150,12 +151,12 @@ public class CdmLazyLoader {
                }
                return null;
        }
-       
+
        private String getCollectionFieldName(PersistentCollection pc) {
                if(pc != null) {
                        if(pc instanceof PersistentSet || pc instanceof PersistentSortedSet) {
                                return "set";
-                       }                       
+                       }
                        if(pc instanceof PersistentList) {
                                return "list";
                        }
@@ -165,19 +166,19 @@ public class CdmLazyLoader {
                }
                return null;
        }
-       
+
        private class CollectionField {
-               private Object col;
-               private String fieldName;
+               private final Object col;
+               private final String fieldName;
                public CollectionField(Object col, String fieldName) {
                        this.col = col;
                        this.fieldName = fieldName;
                }
-               
+
                public Object getCollection() {
                        return this.col;
                }
-               
+
                public String getFieldName() {
                        return this.fieldName;
                }
index e6841035b006c86e34fadc4ffca125640c6a7789..1bc42c44fbef5dc66862dd34bcc8e7793e529717 100644 (file)
@@ -26,7 +26,6 @@
 package org.hibernate.collection.internal;
 
 import java.io.Serializable;
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -78,7 +77,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        private static final Logger log = Logger.getLogger( AbstractPersistentCollection.class );
 
        private static final long serialVersionUID = -7238232378593030571L;
-       
+
        private transient SessionImplementor session;
        private boolean initialized;
        private transient List<DelayedOperation> operationQueue;
@@ -97,31 +96,38 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        private String sessionFactoryUuid;
        private boolean specjLazyLoad = false;
 
-       public final String getRole() {
+       @Override
+    public final String getRole() {
                return role;
        }
 
-       public final Serializable getKey() {
+       @Override
+    public final Serializable getKey() {
                return key;
        }
 
-       public final boolean isUnreferenced() {
+       @Override
+    public final boolean isUnreferenced() {
                return role == null;
        }
 
-       public final boolean isDirty() {
+       @Override
+    public final boolean isDirty() {
                return dirty;
        }
 
-       public final void clearDirty() {
+       @Override
+    public final void clearDirty() {
                dirty = false;
        }
 
-       public final void dirty() {
+       @Override
+    public final void dirty() {
                dirty = true;
        }
 
-       public final Serializable getStoredSnapshot() {
+       @Override
+    public final Serializable getStoredSnapshot() {
                return storedSnapshot;
        }
 
@@ -130,7 +136,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * Is the initialized collection empty?
         */
-       public abstract boolean empty();
+       @Override
+    public abstract boolean empty();
 
        /**
         * Called by any read-only method of the collection interface
@@ -151,9 +158,9 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                        else {
                                // In remoting we are sure that session is null
                                // both when using property paths and switching off conversations
-                               if(session == null && remoting) {                               
+                               if(session == null && remoting) {
                                        log.info("--> readSize, of " + getRole() + " with key " + getKey());
-                                       read();                                                         
+                                       read();
                                } else {
                                        boolean isExtraLazy = withTemporarySessionIfNeeded(
                                                        new LazyInitializationWork<Boolean>() {
@@ -236,7 +243,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                                        .getTransactionContext().getTransactionEnvironment()
                                        .getTransactionFactory()
                                        .compatibleWithJtaSynchronization();
-                       
+
                        if ( !isJTA ) {
                                // Explicitly handle the transactions only if we're not in
                                // a JTA environment.  A lazy loading temporary session can
@@ -245,7 +252,7 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                                // multiple transactions.
                                ( ( Session) session ).beginTransaction();
                        }
-                       
+
                        session.getPersistenceContext().addUninitializedDetachedCollection(
                                        session.getFactory().getCollectionPersister( getRole() ),
                                        this
@@ -286,9 +293,9 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                if ( !initialized ) {
                        // In remoting we are sure that session is null
                        // both when using property paths and switching off conversations
-                       if(session == null && remoting) {                       
+                       if(session == null && remoting) {
                                log.info("--> readIndexExistence, of " + getRole() + " with key " + getKey());
-                               read();                                                                         
+                               read();
                        } else {
                                Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
                                                new LazyInitializationWork<Boolean>() {
@@ -323,8 +330,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                        // both when using property paths and switching off conversations
                        if(session == null && remoting) {
                                log.info("--> readElementExistence, of " + getRole() + " with key " + getKey());
-                               read();                         
-                               
+                               read();
+
                        } else {
                                Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
                                                new LazyInitializationWork<Boolean>() {
@@ -359,10 +366,10 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                if ( !initialized ) {
                        // In remoting we are sure that session is null
                        // both when using property paths and switching off conversations
-                       if(session == null && remoting) {                               
+                       if(session == null && remoting) {
                                log.info("--> readElementByIndex, of " + getRole() + " with key " + getKey());
-                               read();                         
-                               
+                               read();
+
                        } else {
                                class ExtraLazyElementByIndexReader implements LazyInitializationWork {
                                        private boolean isExtraLazy;
@@ -510,7 +517,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * After flushing, re-init snapshot state.
         */
-       public void setSnapshot(Serializable key, String role, Serializable snapshot) {
+       @Override
+    public void setSnapshot(Serializable key, String role, Serializable snapshot) {
                this.key = key;
                this.role = role;
                this.storedSnapshot = snapshot;
@@ -520,7 +528,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
         * After flushing, clear any "queued" additions, since the
         * database state is now synchronized with the memory state.
         */
-       public void postAction() {
+       @Override
+    public void postAction() {
                operationQueue = null;
                cachedSize = -1;
                clearDirty();
@@ -540,14 +549,16 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * return the user-visible collection (or array) instance
         */
-       public Object getValue() {
+       @Override
+    public Object getValue() {
                return this;
        }
 
        /**
         * Called just before reading any rows from the JDBC result set
         */
-       public void beginRead() {
+       @Override
+    public void beginRead() {
                // override on some subclasses
                initializing = true;
        }
@@ -555,12 +566,14 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * Called after reading all rows from the JDBC result set
         */
-       public boolean endRead() {
+       @Override
+    public boolean endRead() {
                //override on some subclasses
                return afterInitialize();
        }
 
-       public boolean afterInitialize() {
+       @Override
+    public boolean afterInitialize() {
                setInitialized();
                //do this bit after setting initialized to true or it will recurse
                if ( operationQueue != null ) {
@@ -586,14 +599,14 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                // In remoting we are sure that session is null
                // both when using property paths and switching off conversations
                if(session == null && remoting) {
-                       remoteInitialize();                     
+                       remoteInitialize();
                }
-               
+
                if ( initialized ) {
                        return;
                }
 
-               
+
                withTemporarySessionIfNeeded(
                                new LazyInitializationWork<Object>() {
                                        @Override
@@ -635,7 +648,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
         * Could the application possibly have a direct reference to
         * the underlying collection implementation?
         */
-       public boolean isDirectlyAccessible() {
+       @Override
+    public boolean isDirectlyAccessible() {
                return directlyAccessible;
        }
 
@@ -644,7 +658,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
         *
         * @return true if this was currently associated with the given session
         */
-       public final boolean unsetSession(SessionImplementor currentSession) {
+       @Override
+    public final boolean unsetSession(SessionImplementor currentSession) {
                prepareForPossibleSpecialSpecjInitialization();
                if ( currentSession == this.session ) {
                        this.session = null;
@@ -679,7 +694,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
         * @throws HibernateException if the collection was already associated
         * with another open session
         */
-       public final boolean setCurrentSession(SessionImplementor session) throws HibernateException {
+       @Override
+    public final boolean setCurrentSession(SessionImplementor session) throws HibernateException {
                if ( session == this.session ) {
                        return false;
                }
@@ -711,7 +727,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * Do we need to completely recreate this collection when it changes?
         */
-       public boolean needsRecreate(CollectionPersister persister) {
+       @Override
+    public boolean needsRecreate(CollectionPersister persister) {
                return false;
        }
 
@@ -719,7 +736,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
         * To be called internally by the session, forcing
         * immediate initialization.
         */
-       public final void forceInitialization() throws HibernateException {
+       @Override
+    public final void forceInitialization() throws HibernateException {
                if ( !initialized ) {
                        if ( initializing ) {
                                throw new AssertionFailure( "force initialize loading collection" );
@@ -746,38 +764,45 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * Is this instance initialized?
         */
-       public final boolean wasInitialized() {
+       @Override
+    public final boolean wasInitialized() {
                return initialized;
        }
 
-       public boolean isRowUpdatePossible() {
+       @Override
+    public boolean isRowUpdatePossible() {
                return true;
        }
 
        /**
         * Does this instance have any "queued" additions?
         */
-       public final boolean hasQueuedOperations() {
+       @Override
+    public final boolean hasQueuedOperations() {
                return operationQueue != null;
        }
 
        /**
         * Iterate the "queued" additions
         */
-       public final Iterator queuedAdditionIterator() {
+       @Override
+    public final Iterator queuedAdditionIterator() {
                if ( hasQueuedOperations() ) {
                        return new Iterator() {
                                int i = 0;
 
-                               public Object next() {
+                               @Override
+                public Object next() {
                                        return operationQueue.get( i++ ).getAddedInstance();
                                }
 
-                               public boolean hasNext() {
+                               @Override
+                public boolean hasNext() {
                                        return i < operationQueue.size();
                                }
 
-                               public void remove() {
+                               @Override
+                public void remove() {
                                        throw new UnsupportedOperationException();
                                }
                        };
@@ -790,7 +815,8 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
        /**
         * Iterate the "queued" additions
         */
-       @SuppressWarnings({"unchecked"})
+       @Override
+    @SuppressWarnings({"unchecked"})
        public final Collection getQueuedOrphans(String entityName) {
                if ( hasQueuedOperations() ) {
                        Collection additions = new ArrayList( operationQueue.size() );
@@ -810,19 +836,22 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
         * Called before inserting rows, to ensure that any surrogate keys
         * are fully generated
         */
-       public void preInsert(CollectionPersister persister) throws HibernateException {
+       @Override
+    public void preInsert(CollectionPersister persister) throws HibernateException {
        }
 
        /**
         * Called after inserting a row, to fetch the natively generated id
         */
-       public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException {
+       @Override
+    public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException {
        }
 
        /**
         * get all "orphaned" elements
         */
-       public abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException;
+       @Override
+    public abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException;
 
        /**
         * Get the current session
@@ -839,15 +868,18 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                        this.itr = itr;
                }
 
-               public boolean hasNext() {
+               @Override
+        public boolean hasNext() {
                        return itr.hasNext();
                }
 
-               public Object next() {
+               @Override
+        public Object next() {
                        return itr.next();
                }
 
-               public void remove() {
+               @Override
+        public void remove() {
                        write();
                        itr.remove();
                }
@@ -861,42 +893,51 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                        this.itr = itr;
                }
 
-               @SuppressWarnings({"unchecked"})
+               @Override
+        @SuppressWarnings({"unchecked"})
                public void add(Object o) {
                        write();
                        itr.add( o );
                }
 
-               public boolean hasNext() {
+               @Override
+        public boolean hasNext() {
                        return itr.hasNext();
                }
 
-               public boolean hasPrevious() {
+               @Override
+        public boolean hasPrevious() {
                        return itr.hasPrevious();
                }
 
-               public Object next() {
+               @Override
+        public Object next() {
                        return itr.next();
                }
 
-               public int nextIndex() {
+               @Override
+        public int nextIndex() {
                        return itr.nextIndex();
                }
 
-               public Object previous() {
+               @Override
+        public Object previous() {
                        return itr.previous();
                }
 
-               public int previousIndex() {
+               @Override
+        public int previousIndex() {
                        return itr.previousIndex();
                }
 
-               public void remove() {
+               @Override
+        public void remove() {
                        write();
                        itr.remove();
                }
 
-               @SuppressWarnings({"unchecked"})
+               @Override
+        @SuppressWarnings({"unchecked"})
                public void set(Object o) {
                        write();
                        itr.set( o );
@@ -911,63 +952,76 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                        this.set = set;
                }
 
-               @SuppressWarnings({"unchecked"})
+               @Override
+        @SuppressWarnings({"unchecked"})
                public boolean add(Object o) {
                        write();
                        return set.add( o );
                }
 
-               @SuppressWarnings({"unchecked"})
+               @Override
+        @SuppressWarnings({"unchecked"})
                public boolean addAll(Collection c) {
                        write();
                        return set.addAll( c );
                }
 
-               public void clear() {
+               @Override
+        public void clear() {
                        write();
                        set.clear();
                }
 
-               public boolean contains(Object o) {
+               @Override
+        public boolean contains(Object o) {
                        return set.contains( o );
                }
 
-               public boolean containsAll(Collection c) {
+               @Override
+        public boolean containsAll(Collection c) {
                        return set.containsAll( c );
                }
 
-               public boolean isEmpty() {
+               @Override
+        public boolean isEmpty() {
                        return set.isEmpty();
                }
 
-               public Iterator iterator() {
+               @Override
+        public Iterator iterator() {
                        return new IteratorProxy( set.iterator() );
                }
 
-               public boolean remove(Object o) {
+               @Override
+        public boolean remove(Object o) {
                        write();
                        return set.remove( o );
                }
 
-               public boolean removeAll(Collection c) {
+               @Override
+        public boolean removeAll(Collection c) {
                        write();
                        return set.removeAll( c );
                }
 
-               public boolean retainAll(Collection c) {
+               @Override
+        public boolean retainAll(Collection c) {
                        write();
                        return set.retainAll( c );
                }
 
-               public int size() {
+               @Override
+        public int size() {
                        return set.size();
                }
 
-               public Object[] toArray() {
+               @Override
+        public Object[] toArray() {
                        return set.toArray();
                }
 
-               @SuppressWarnings({"unchecked"})
+               @Override
+        @SuppressWarnings({"unchecked"})
                public Object[] toArray(Object[] array) {
                        return set.toArray( array );
                }
@@ -1207,50 +1261,53 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                }
        }
 
-       public Object getIdentifier(Object entry, int i) {
+       @Override
+    public Object getIdentifier(Object entry, int i) {
                throw new UnsupportedOperationException();
        }
 
-       public Object getOwner() {
+       @Override
+    public Object getOwner() {
                return owner;
        }
 
-       public void setOwner(Object owner) {
+       @Override
+    public void setOwner(Object owner) {
                this.owner = owner;
        }
 
        /** ------ Below is section of code which makes remote service calls ----- */
-       // The affected methods are : 
+       // The affected methods are :
        // initialize(final boolean writing)
        // readSize()
        // readIndexExistence(final Object index)
        // readElementExistence(final Object element)
-       // readElementByIndex(final Object index) 
-       
+       // readElementByIndex(final Object index)
+
        private static ICdmApplicationConfiguration configuration;
        private static boolean remoting = false;
-       
+
        public static void setConfiguration(ICdmApplicationConfiguration conf) {
                configuration = conf;
-                       
+
                if(conf instanceof CdmApplicationRemoteController) {
                        remoting = true;
                } else {
                        remoting = false;
                }
        }
-       
-       
+
+
        private void remoteInitialize() {
-               
-               if (getOwner() != null && !initialized) {                       
-                       
+
+               if (getOwner() != null && !initialized) {
+
                        try {
                                String role = getRole();
                                String fieldName = role.substring(role.lastIndexOf(".") + 1);
                                log.info("--> Remote Lazy Initializing " + getRole() + " , key : " + getKey() + " , field : " + fieldName);
                                Object owner = getOwner();
-                               
+
                                if(configuration == null) {
                                        throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
                                }
@@ -1258,24 +1315,25 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                                if(commonService == null) {
                                        throw new HibernateException("commonService not initialized (null)");
                                }
-                               
-                               PersistentCollection col = commonService.initializeCollection(this); 
-                               afterInitialize();
-
-                               Class<?> clazz = getClass();
-                               if (clazz != null) {    
-                                       CollectionField cf = getCollectionField(col);
-                                       Field field = clazz.getDeclaredField(cf.getFieldName());
-                                       field.setAccessible(true);
-                                       field.set(this, cf.getCollection());                           
-                               }               
+
+//                             PersistentCollection col = commonService.initializeCollection(this);
+//                             afterInitialize();
+//
+//                             Class<?> clazz = getClass();
+//                             if (clazz != null) {
+//                                     CollectionField cf = getCollectionField(col);
+//                                     Field field = clazz.getDeclaredField(cf.getFieldName());
+//                                     field.setAccessible(true);
+//                                     field.set(this, cf.getCollection());
+//                             }
                        } catch (Exception ex) {
                                log.warn(ex.getMessage());
-                       }                       
+                       }
+                       log.warn("This code is invalid");
                }
        }
-       
-       
+
+
        private CollectionField getCollectionField(PersistentCollection pc) {
                if(pc != null) {
                        if(pc instanceof PersistentSet) {
@@ -1296,12 +1354,12 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                }
                return null;
        }
-       
+
        private String getCollectionFieldName(PersistentCollection pc) {
                if(pc != null) {
                        if(pc instanceof PersistentSet || pc instanceof PersistentSortedSet) {
                                return "set";
-                       }                       
+                       }
                        if(pc instanceof PersistentList) {
                                return "list";
                        }
@@ -1311,59 +1369,36 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
                }
                return null;
        }
-       
+
        private class CollectionField {
-               private Object col;
-               private String fieldName;
+               private final Object col;
+               private final String fieldName;
                public CollectionField(Object col, String fieldName) {
                        this.col = col;
                        this.fieldName = fieldName;
                }
-               
+
                public Object getCollection() {
                        return this.col;
                }
-               
+
                public String getFieldName() {
                        return this.fieldName;
                }
        }
-       
+
        public static boolean isInitialized(List list) {
                return ((AbstractPersistentCollection)list).initialized;
        }
-       
+
        public static boolean isInitialized(Map map) {
                return ((AbstractPersistentCollection)map).initialized;
        }
-       
+
        public static boolean isInitialized(Set set) {
                return ((AbstractPersistentCollection)set).initialized;
        }
-       
-       //FIXME:Remoting These methods may no longer be required since we are 
-       //               initialising collections as default behaviour
-       private int remoteSize() {
-               int size = configuration.getCommonService().size(this);
-               log.debug("--> Remote Lazy Initializing size of " + getRole() + " to " + size);
-               if(size == -1) {
-                       throw new HibernateException("size of " + getClass() + " could not be retrieved from remote service");
-               }
-               return size;
-       }
-       
-       private Object remoteReadElementByIndex(int index) {
-               Object element = configuration.getCommonService().get(this,index);
-               log.debug("--> Remote Lazy Initializing element from " + getRole() + " at index " + index);
-               return element;
-       }
-       
-       private boolean remoteReadElementExistence(Object element) {
-               return configuration.getCommonService().contains(this,element);
-       }
-       
-       private boolean remoteReadIndexExistence(Object index) {
-               return false;
-       }
+
+
 }
 
index 6c58613f19fb7cdb32520fdd96370038c84f22f1..ebf95dae8982b87b937e0cfec5543c6c17563912 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Editor Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
 Bundle-Vendor: %Bundle-Vendor.0
 Bundle-Localization: OSGI-INF/l10n/plugin
index 040ab38666d80375e9fb48d284b1acd681214f56..d2014d3a99fa82ce8295c00db4ca66dbc7f4ed5f 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
        <groupId>eu.etaxonomy</groupId>
        <artifactId>taxeditor-parent</artifactId>
-    <version>3.6.1</version>
+    <version>3.7.0</version>
   </parent>
   
   <modelVersion>4.0.0</modelVersion>
index 4d92e047d995a46409f4df9ea2c85a64db9dbd29..796d19aa3a396b98f5f8b01f11b4480755c2f44f 100644 (file)
@@ -13,7 +13,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.ui.PartInitException;
 
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
@@ -31,11 +30,8 @@ public class EditorCdmViewer implements ICdmViewer {
 
     private final Logger logger = Logger.getLogger(EditorCdmViewer.class);
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
-     */
     @Override
-    public void show(Object input, Class<?> viewerClass, ExecutionEvent event) {
+    public void show(Object input, Class<?> viewerClass) {
         try {
             if(viewerClass.equals(MultiPageTaxonEditor.class)){
                 if(input instanceof TaxonBase){
@@ -54,9 +50,6 @@ public class EditorCdmViewer implements ICdmViewer {
         }
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
-     */
     @Override
     public Map<Class<?>, String> getViewerClasses(Object input) {
         Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
index 5452a0458934f0005106036673d3807183766aed..d0a7b205caa42da4894b53c89c0fb1db7ec9b52c 100644 (file)
@@ -196,7 +196,7 @@ public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPe
                TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference());
 
                // add the new taxon to the editors persistence context
-               UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode);
+               UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid();
 
                return new TaxonEditorInput(newTaxonNode, conversation);
     }
index e73e355a8fccf4f0e72de98a3ab8a8798b1c31ab..d32db52ea2a316343727fc4326136a255ed69064 100644 (file)
@@ -88,7 +88,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
                NameDeletionConfigurator nameConfig = new NameDeletionConfigurator();
                nameConfig.setRemoveAllNameRelationships(true);
                config.setNameDeletionConfig(nameConfig);
-               service.deleteTaxon(misapplication, config, null);
+               service.deleteTaxon(misapplication.getUuid(), config, null);
                monitor.worked(40);
 
                return postExecute(null);
index 136dcf7f4ff1ead991087e748173666a02d0fe02..8c51e6668ce76e28b8280aeee42a13a4fdcca6b2 100644 (file)
@@ -65,7 +65,7 @@ public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{
                                ITaxonService service = controller.getTaxonService();\r
 \r
 \r
-                               DeleteResult result =   service.deleteTaxon(element, configurator, classification);\r
+                               DeleteResult result =   service.deleteTaxon(element.getUuid(), configurator, classification.getUuid());\r
                                if (result.isError()){\r
                                        MessageDialog.openError(null, "Delete failed", result.toString());\r
                                } else if (!result.getUpdatedObjects().isEmpty()){\r
index a604e1bbd30c392326a3aec66ba2efcbcf606891..d3e4b123157f3f31a884686ceab7fda9bfb081ef 100644 (file)
@@ -60,7 +60,7 @@ import eu.etaxonomy.cdm.strategy.merge.MergeException;
  */
 public class TransientAgentService implements IAgentService {
 
-    private IAgentService defaultService;
+    private final IAgentService defaultService;
 
     /**
      * @param defaultAgentService
@@ -665,7 +665,7 @@ public class TransientAgentService implements IAgentService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(AgentBase newInstance) {
+    public AgentBase save(AgentBase newInstance) {
         return null;
     }
 
@@ -770,4 +770,26 @@ public class TransientAgentService implements IAgentService {
                return defaultService.convertTeam2Person(arg0);
        }
 
+
+       @Override
+       public DeleteResult delete(UUID arg0) {
+               return defaultService.delete(arg0);
+       }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<AgentBase> merge(List<AgentBase> arg0) {
+       return defaultService.merge(arg0);
+    }
+
 }
index 5e33668e57a1e86744a9c0a8e23b71c23bab8058..9459d7799f9fdfe5181c62f31fd2f922f27e7e78 100644 (file)
@@ -778,7 +778,7 @@ public class TransientClassificationService implements IClassificationService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(Classification newInstance) {
+    public Classification save(Classification newInstance) {
         return null;
     }
 
@@ -942,5 +942,28 @@ public class TransientClassificationService implements IClassificationService {
        return defaultService.createHierarchyInClassification(arg1, arg2);
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+     */
+    @Override
+    public DeleteResult delete(UUID arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<Classification> merge(List<Classification> arg0) {
+        return defaultService.merge(arg0);
+    }
 
 }
index 310c39c99000755cb7b24caf67d1d33eb5f2c4a6..64936020cd132d6288bea48dfbfb66d588988cfa 100644 (file)
@@ -59,7 +59,7 @@ public class TransientCollectionService implements ICollectionService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(Collection newInstance) {
+    public Collection save(Collection newInstance) {
         return null;
     }
 
@@ -703,4 +703,27 @@ public class TransientCollectionService implements ICollectionService {
        public <S extends Collection>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
                return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
        }
+
+
+       @Override
+       public DeleteResult delete(UUID arg0) {
+               return defaultService.delete(arg0);
+       }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(java.util.Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<Collection> merge(List<Collection> arg0) {
+        return defaultService.merge(arg0);
+    }
+
 }
index f804d48ef6c39bdb59ebd1125ddacd03c987bffa..ebcd3128c38605bd094c12d1f99ad408e7b7f0fe 100644 (file)
@@ -23,6 +23,7 @@ import org.hibernate.envers.query.criteria.AuditCriterion;
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.DistributionTree;
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.api.service.dto.FindByIdentifierDTO;
@@ -731,7 +732,7 @@ public class TransientDescriptionService implements IDescriptionService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(DescriptionBase newInstance) {
+    public DescriptionBase save(DescriptionBase newInstance) {
         return null;
     }
 
@@ -1107,7 +1108,7 @@ public class TransientDescriptionService implements IDescriptionService {
        }
 
        @Override
-       public UUID deleteDescription(DescriptionBase description) {
+       public DeleteResult deleteDescription(DescriptionBase description) {
                return defaultService.deleteDescription(description);
        }
 
@@ -1118,4 +1119,64 @@ public class TransientDescriptionService implements IDescriptionService {
        public Pager<TermDto> pageNamedAreasInUse(boolean includeAllParents, Integer pageSize, Integer pageNumber) {
            return defaultService.pageNamedAreasInUse(includeAllParents, pageSize, pageNumber);
        }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+     */
+    @Override
+    public DeleteResult delete(UUID uuid) {
+        return defaultService.deleteDescription(uuid);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IDescriptionService#deleteDescription(java.util.UUID)
+     */
+    @Override
+    public DeleteResult deleteDescription(UUID uuid) {
+        return defaultService.delete(uuid);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IDescriptionService#deleteDescriptionElement(java.util.UUID)
+     */
+    @Override
+    public UUID deleteDescriptionElement(UUID uuid) {
+        return defaultService.deleteDescriptionElement(uuid);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveTaxonDescriptions(eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.model.taxon.Taxon)
+     */
+    @Override
+    public UpdateResult moveTaxonDescriptions(Taxon sourceTaxon, Taxon targetTaxon) {
+        return defaultService.moveTaxonDescriptions(sourceTaxon, targetTaxon);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveTaxonDescriptions(java.util.UUID, java.util.UUID)
+     */
+    @Override
+    public UpdateResult moveTaxonDescriptions(UUID sourceTaxonUuid, UUID targetTaxonUuid) {
+        return defaultService.moveTaxonDescriptions(sourceTaxonUuid, targetTaxonUuid);
+
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<DescriptionBase> merge(List<DescriptionBase> arg0) {
+        return defaultService.merge(arg0);
+    }
+
 }
index 7daa4e43f1a92ff5e3666b1d60bdd32b2f0caf1c..579e6fce7b19568b4c9973d97fcaf8f75755bd9d 100644 (file)
@@ -26,6 +26,7 @@ import org.hibernate.envers.query.criteria.AuditCriterion;
 
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
@@ -78,7 +79,7 @@ import eu.etaxonomy.cdm.strategy.merge.IMergeStrategy;
  */
 public class TransientNameService implements INameService {
 
-    private INameService defaultService;
+    private final INameService defaultService;
 
     /**
      *
@@ -220,8 +221,8 @@ public class TransientNameService implements INameService {
      * @see eu.etaxonomy.cdm.api.service.INameService#delete(eu.etaxonomy.cdm.model.name.TaxonNameBase, eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator)
      */
     @Override
-    public DeleteResult delete(TaxonNameBase name, NameDeletionConfigurator config)  {
-        return defaultService.delete(name, config);
+    public DeleteResult delete(UUID nameUuid, NameDeletionConfigurator config)  {
+        return defaultService.delete(nameUuid, config);
     }
 
     /**
@@ -795,7 +796,7 @@ public class TransientNameService implements INameService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(TaxonNameBase newInstance) {
+    public TaxonNameBase save(TaxonNameBase newInstance) {
         return null;
     }
 
@@ -1148,25 +1149,52 @@ public class TransientNameService implements INameService {
        public TaxonNameBase findWithoutFlush(UUID uuid) {
                return defaultService.findWithoutFlush(uuid);
        }
-       
-       
+
 
        @Override
        public <S extends TaxonNameBase>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
                return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
        }
 
-       
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.INameService#setAsGroupsBasionym(java.util.UUID)
+     */
+    @Override
+    public UpdateResult setAsGroupsBasionym(UUID nameUuid) {
+        return defaultService.delete(nameUuid);
+    }
+
 
        @Override
        public List<HashMap<String, String>> getNameRecords() {
-               
+
                return defaultService.getNameRecords();
        }
-       
-       
 
-       
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DeleteResult delete(UUID arg0) {
+        return defaultService.delete(arg0);
+    }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<TaxonNameBase> merge(List<TaxonNameBase> arg0) {
+        return defaultService.merge(arg0);
+    }
 }
index 40a46f02be7eb418a9e4595720f57330cf3f2546..e2a30d9226a6150fcb788ca67ff7c80003e9c6fc 100644 (file)
@@ -57,6 +57,7 @@ import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.media.Rights;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
 import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
@@ -761,7 +762,7 @@ public class TransientOccurenceService implements IOccurrenceService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(SpecimenOrObservationBase newInstance) {
+    public SpecimenOrObservationBase save(SpecimenOrObservationBase newInstance) {
         units.add(newInstance);
         return null;
     }
@@ -836,51 +837,25 @@ public class TransientOccurenceService implements IOccurrenceService {
         return defaultService.list(example, includeProperties, limit, start, orderHints, propertyPaths);
     }
 
-    /**
-     * @param clazz
-     * @param matchStrategy
-     * @param mergeStrategy
-     * @return
-     * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#deduplicate(java.lang.Class, eu.etaxonomy.cdm.strategy.match.IMatchStrategy, eu.etaxonomy.cdm.strategy.merge.IMergeStrategy)
-     */
     @Override
     public int deduplicate(Class<? extends SpecimenOrObservationBase> clazz, IMatchStrategy matchStrategy, IMergeStrategy mergeStrategy) {
         return defaultService.deduplicate(clazz, matchStrategy, mergeStrategy);
     }
 
-    /**
-     * @param clazz
-     * @param queryString
-     * @param pageSize
-     * @param pageNumber
-     * @param orderHints
-     * @param matchMode
-     * @return
-     * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#findTitleCache(java.lang.Class, java.lang.String, java.lang.Integer, java.lang.Integer, java.util.List, eu.etaxonomy.cdm.persistence.query.MatchMode)
-     */
     @Override
     public Pager<SpecimenOrObservationBase> findTitleCache(Class<? extends SpecimenOrObservationBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, MatchMode matchMode) {
         return defaultService.findTitleCache(clazz, queryString, pageSize, pageNumber, orderHints, matchMode);
     }
 
-    /**
-     * @return
-     */
     public Collection<SpecimenOrObservationBase<?>> getUnits() {
         return units;
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getFieldUnits(java.util.UUID)
-     */
     @Override
     public Collection<FieldUnit> getFieldUnits(UUID derivedUnitUuid) {
         return defaultService.getFieldUnits(derivedUnitUuid);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#pageByAssociatedTaxon(java.lang.Class, java.util.Set, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
-     */
     @Override
     public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type,
             Set<TaxonRelationshipEdge> includeRelationships, String taxonUUID, Integer maxDepth, Integer pageSize,
@@ -889,17 +864,11 @@ public class TransientOccurenceService implements IOccurrenceService {
                 maxDepth, pageSize, pageNumber, orderHints, propertyPaths);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveDerivate(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
-     */
     @Override
     public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate) {
         return defaultService.moveDerivate(from, to, derivate);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveSequence(eu.etaxonomy.cdm.model.molecular.DnaSample, eu.etaxonomy.cdm.model.molecular.DnaSample, eu.etaxonomy.cdm.model.molecular.Sequence)
-     */
     @Override
     public boolean moveSequence(DnaSample from, DnaSample to, Sequence sequence) {
         return defaultService.moveSequence(from, to, sequence);
@@ -911,9 +880,6 @@ public class TransientOccurenceService implements IOccurrenceService {
                return defaultService.isDeletable(object, config);
        }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#countDeterminations(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.taxon.TaxonBase)
-     */
     @Override
     public int countDeterminations(SpecimenOrObservationBase occurence, TaxonBase taxonbase) {
         return defaultService.countDeterminations(occurence, taxonbase);
@@ -938,17 +904,11 @@ public class TransientOccurenceService implements IOccurrenceService {
        }
 
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#assembleFieldUnitDTO(eu.etaxonomy.cdm.model.occurrence.FieldUnit, java.util.UUID)
-        */
        @Override
        public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid) {
            return defaultService.assembleFieldUnitDTO(fieldUnit, associatedTaxonUuid);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#assemblePreservedSpecimenDTO(eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
-        */
        @Override
        public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit) {
            return defaultService.assemblePreservedSpecimenDTO(derivedUnit);
@@ -959,43 +919,28 @@ public class TransientOccurenceService implements IOccurrenceService {
         return defaultService.getNonCascadedAssociatedElements(specimen);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#deleteDerivateHierarchy(eu.etaxonomy.cdm.model.common.ICdmBase)
-     */
     @Override
     public DeleteResult deleteDerivateHierarchy(CdmBase from, SpecimenDeleteConfigurator config) {
         return defaultService.deleteDerivateHierarchy(from, config);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#delete(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator)
-     */
     @Override
     public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config) {
         return defaultService.delete(specimen, config);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listIndividualsAssociations(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
-     */
     @Override
     public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen,
             Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
         return defaultService.listIndividualsAssociations(specimen, limit, start, orderHints, propertyPaths);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listTypeDesignations(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
-     */
     @Override
     public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen,
             Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
         return defaultService.listTypeDesignations(specimen, limit, start, orderHints, propertyPaths);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listDescriptionsWithDescriptionSpecimen(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
-     */
     @Override
     public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(
             SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints,
@@ -1008,33 +953,21 @@ public class TransientOccurenceService implements IOccurrenceService {
                return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getCharacterDataForSpecimen(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase)
-        */
        @Override
        public Collection<DescriptionElementBase> getCharacterDataForSpecimen(SpecimenOrObservationBase<?> arg0) {
            return defaultService.getCharacterDataForSpecimen(arg0);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getCharacterDataForSpecimen(java.util.UUID)
-        */
        @Override
        public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID arg0) {
            return getCharacterDataForSpecimen(arg0);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getMostSignificantIdentifier(eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
-        */
        @Override
        public String getMostSignificantIdentifier(DerivedUnit derivedUnit) {
            return defaultService.getMostSignificantIdentifier(derivedUnit);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#countOccurrences(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
-        */
        @Override
        public int countOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> config) {
            return defaultService.countOccurrences(config);
@@ -1056,4 +989,32 @@ public class TransientOccurenceService implements IOccurrenceService {
            return defaultService.getAllHierarchyDerivatives(specimen);
        }
 
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+     */
+    @Override
+    public DeleteResult delete(UUID uuid) {
+        return defaultService.delete(uuid);
+    }
+
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    @Override
+    public DeleteResult deleteSingleRead(SingleRead singleRead, Sequence sequence){
+        return defaultService.deleteSingleRead(singleRead, sequence);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<SpecimenOrObservationBase> merge(List<SpecimenOrObservationBase> arg0) {
+        return defaultService.merge(arg0);
+    }
+
+
 }
index 1cb2f4869f65e0377fef7b1dd7c81a9226d9280c..550642d65cf02c00c8fd40c2b5cda77a1a68721e 100644 (file)
@@ -55,7 +55,7 @@ import eu.etaxonomy.cdm.strategy.merge.IMergeStrategy;
  */
 public class TransientReferenceService implements IReferenceService {
 
-    private IReferenceService defaultService;
+    private final IReferenceService defaultService;
 
     /**
      * @param defaultReferenceService
@@ -617,7 +617,7 @@ public class TransientReferenceService implements IReferenceService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(Reference newInstance) {
+    public Reference save(Reference newInstance) {
         return null;
     }
 
@@ -704,10 +704,33 @@ public class TransientReferenceService implements IReferenceService {
        public Reference findWithoutFlush(UUID uuid) {
                return defaultService.findWithoutFlush(uuid);
        }
-       
+
        @Override
        public <S extends Reference>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
                return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+     */
+    @Override
+    public DeleteResult delete(UUID uuid) {
+        return defaultService.delete(uuid);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<Reference> merge(List<Reference> arg0) {
+        return defaultService.merge(arg0);
+    }
 }
index b26a6e84f23db90bdb13fbc18c89311c9cd4e0aa..b191647d838a123ed117900bf00d401a175a643e 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
-* Copyright (C) 2013 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.
-*/
+ * Copyright (C) 2013 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.taxeditor.editor.view.dataimport.transientServices;
 
 import java.io.IOException;
@@ -27,6 +27,7 @@ import org.hibernate.envers.query.criteria.AuditCriterion;
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.TaxaAndNamesSearchMode;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -502,14 +503,14 @@ public class TransientTaxonService implements ITaxonService {
         return defaultService.searchTaxaByName(name, sec);
     }
 
+
     /**
-     * @param synonym
-     * @param acceptedTaxon
-     * @see eu.etaxonomy.cdm.api.service.ITaxonService#swapSynonymAndAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)
+     * {@inheritDoc}
      */
     @Override
-    public void swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon) {
-        defaultService.swapSynonymAndAcceptedTaxon(synonym, acceptedTaxon);
+    public UpdateResult swapSynonymAndAcceptedTaxon(Synonym arg0, Taxon arg1) {
+        return defaultService.swapSynonymAndAcceptedTaxon(arg0, arg1);
+
     }
 
     /**
@@ -717,7 +718,7 @@ public class TransientTaxonService implements ITaxonService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(TaxonBase newInstance) {
+    public TaxonBase save(TaxonBase newInstance) {
         return null;
     }
 
@@ -1087,7 +1088,7 @@ public class TransientTaxonService implements ITaxonService {
             String queryString, Classification classification, Set<NamedArea> namedAreas,
             Set<PresenceAbsenceTerm> distributionStatus, List<Language> languages, boolean highlightFragments,
             Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
-            throws CorruptIndexException, IOException, ParseException, LuceneMultiSearchException {
+                    throws CorruptIndexException, IOException, ParseException, LuceneMultiSearchException {
         return defaultService.findTaxaAndNamesByFullText(searchModes, queryString, classification, namedAreas, distributionStatus, languages, highlightFragments, pageSize, pageNumber, orderHints, propertyPaths);
     }
 
@@ -1339,24 +1340,19 @@ public class TransientTaxonService implements ITaxonService {
         return defaultService.deleteSynonym(arg0, arg1, arg2);
     }
 
-    @Override
-    public DeleteResult deleteTaxon(Taxon arg0, TaxonDeletionConfigurator arg1, Classification arg2) {
-        return defaultService.deleteTaxon(arg0, arg1, arg2);
-    }
-
     @Override
     public List<List<Synonym>> getSynonymsByHomotypicGroup(Taxon taxon, List<String> propertyPaths) {
         return defaultService.getSynonymsByHomotypicGroup(taxon, propertyPaths);
     }
 
-       @Override
-       public Synonym changeRelatedTaxonToSynonym(Taxon fromTaxon, Taxon toTaxon,
-                       TaxonRelationshipType oldRelationshipType,
-                       SynonymRelationshipType synonymRelationshipType)
-                       throws DataChangeNoRollbackException {
+    @Override
+    public Synonym changeRelatedTaxonToSynonym(Taxon fromTaxon, Taxon toTaxon,
+            TaxonRelationshipType oldRelationshipType,
+            SynonymRelationshipType synonymRelationshipType)
+                    throws DataChangeNoRollbackException {
 
-               return defaultService.changeRelatedTaxonToSynonym(fromTaxon, toTaxon, oldRelationshipType, synonymRelationshipType);
-       }
+        return defaultService.changeRelatedTaxonToSynonym(fromTaxon, toTaxon, oldRelationshipType, synonymRelationshipType);
+    }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.cdm.api.service.ITaxonService#pageAcceptedTaxaFor(java.util.UUID, java.util.UUID, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
@@ -1376,24 +1372,24 @@ public class TransientTaxonService implements ITaxonService {
         return defaultService.listAcceptedTaxaFor(synonymUuid, classificationUuid, pageSize, pageNumber, orderHints, propertyPaths);
     }
 
-       @Override
-       public DeleteResult isDeletable(TaxonBase object,
-                       DeleteConfiguratorBase config) {
-               // TODO Auto-generated method stub
-               return null;
-       }
+    @Override
+    public DeleteResult isDeletable(TaxonBase object,
+            DeleteConfiguratorBase config) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-       @Override
-       public IncludedTaxaDTO listIncludedTaxa(UUID taxonUuid,
-                       IncludedTaxonConfiguration configuration) {
-               // TODO Auto-generated method stub
-               return null;
-       }
+    @Override
+    public IncludedTaxaDTO listIncludedTaxa(UUID taxonUuid,
+            IncludedTaxonConfiguration configuration) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-       @Override
-       public TaxonBase findWithoutFlush(UUID uuid) {
-               return defaultService.findWithoutFlush(uuid);
-       }
+    @Override
+    public TaxonBase findWithoutFlush(UUID uuid) {
+        return defaultService.findWithoutFlush(uuid);
+    }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.cdm.api.service.ITaxonService#findTaxaByName(eu.etaxonomy.cdm.api.service.config.MatchingTaxonConfigurator)
@@ -1403,39 +1399,101 @@ public class TransientTaxonService implements ITaxonService {
         return defaultService.findTaxaByName(config);
     }
 
-       @Override
-       public <S extends TaxonBase>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
-               return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
-       }
+    @Override
+    public <S extends TaxonBase>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
+        return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
+    }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.service.ITaxonService#findByIdentifier(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.model.common.DefinedTerm, eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.persistence.query.MatchMode, boolean, java.lang.Integer, java.lang.Integer, java.util.List)
-        */
-       @Override
-       public <S extends TaxonBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier,
-               DefinedTerm identifierType, TaxonNode subtreeFilter, MatchMode matchmode, boolean includeEntity,
-               Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
-           return defaultService.findByIdentifier(clazz, identifier, identifierType, subtreeFilter, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
-       }
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.ITaxonService#findByIdentifier(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.model.common.DefinedTerm, eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.persistence.query.MatchMode, boolean, java.lang.Integer, java.lang.Integer, java.util.List)
+     */
+    @Override
+    public <S extends TaxonBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier,
+            DefinedTerm identifierType, TaxonNode subtreeFilter, MatchMode matchmode, boolean includeEntity,
+            Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
+        return defaultService.findByIdentifier(clazz, identifier, identifierType, subtreeFilter, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
+    }
 
-       
 
-       
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(java.util.UUID, java.util.UUID, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
+     */
+    @Override
+    public DeleteResult deleteSynonym(UUID synonymUuid, UUID taxonUuid, SynonymDeletionConfigurator config) {
+        return defaultService.deleteSynonym(synonymUuid, taxonUuid, config);
+    }
+
+
+    /**
+     * {@inheritDoc}
+
+     */
+    @Override
+    public UpdateResult swapSynonymAndAcceptedTaxon(UUID synonymUUid, UUID acceptedTaxonUuid) {
+        return defaultService.swapSynonymAndAcceptedTaxon(synonymUUid, acceptedTaxonUuid);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteTaxon(java.util.UUID, eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator, java.util.UUID)
+     */
+    @Override
+    public DeleteResult deleteTaxon(UUID taxonUuid, TaxonDeletionConfigurator config, UUID classificationUuid) {
+        return defaultService.deleteTaxon(taxonUuid, config, classificationUuid);
+    }
 
 
        @Override
-       public SynonymRelationship moveSynonymToAnotherTaxon(
-                       SynonymRelationship oldSynonymRelation, UUID newTaxonUUID,
-                       boolean moveHomotypicGroup,
-                       SynonymRelationshipType newSynonymRelationshipType,
-                       Reference reference, String referenceDetail, boolean keepReference)
-                       throws HomotypicalGroupChangeException {
-               
-               return defaultService.moveSynonymToAnotherTaxon(oldSynonymRelation, newTaxonUUID, moveHomotypicGroup, newSynonymRelationshipType, reference, referenceDetail, keepReference);
+       public UpdateResult moveFactualDateToAnotherTaxon(UUID arg0, UUID arg1) {
+               return defaultService.moveFactualDateToAnotherTaxon(arg0, arg1);
        }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SynonymRelationship moveSynonymToAnotherTaxon(
+            SynonymRelationship oldSynonymRelation, UUID newTaxonUUID,
+            boolean moveHomotypicGroup,
+            SynonymRelationshipType newSynonymRelationshipType,
+            Reference reference, String referenceDetail, boolean keepReference)
+                    throws HomotypicalGroupChangeException {
+
+        return defaultService.moveSynonymToAnotherTaxon(oldSynonymRelation, newTaxonUUID, moveHomotypicGroup, newSynonymRelationshipType, reference, referenceDetail, keepReference);
+    }
 
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+     */
+    @Override
+    public DeleteResult delete(UUID uuid) {
+        return defaultService.delete(uuid);
+
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<TaxonBase> merge(List<TaxonBase> arg0) {
+        return defaultService.merge(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(java.util.UUID, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
+     */
+    @Override
+    public DeleteResult deleteSynonym(UUID arg0, SynonymDeletionConfigurator arg1) {
+        return defaultService.deleteSynonym(arg0, arg1);
+    }
 }
index 4ade2430575cc4461698e941fb55970045e80384..ec9867549b3a24e7700ee8931411f936eac742a3 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
-* Copyright (C) 2013 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.
-*/
+ * Copyright (C) 2013 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.taxeditor.editor.view.dataimport.transientServices;
 
 import java.net.URI;
@@ -749,7 +749,7 @@ public class TransientTermService implements ITermService {
      * @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public UUID save(DefinedTermBase newInstance) {
+    public DefinedTermBase save(DefinedTermBase newInstance) {
         return null;
     }
 
@@ -846,11 +846,11 @@ public class TransientTermService implements ITermService {
         return defaultService.findByIdInVocabulary(id, vocabularyUuid, clazz);
     }
 
-       @Override
-       public DeleteResult isDeletable(DefinedTermBase object,
-                       DeleteConfiguratorBase config) {
-               return defaultService.isDeletable(object, config);
-       }
+    @Override
+    public DeleteResult isDeletable(DefinedTermBase object,
+            DeleteConfiguratorBase config) {
+        return defaultService.isDeletable(object, config);
+    }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.cdm.api.service.ITermService#listByTermType(eu.etaxonomy.cdm.model.common.TermType, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
@@ -861,15 +861,46 @@ public class TransientTermService implements ITermService {
         return defaultService.listByTermType(termType, limit, start, orderHints, propertyPaths);
     }
 
-       @Override
-       public DefinedTermBase findWithoutFlush(UUID uuid) {
-               return defaultService.findWithoutFlush(uuid);
-       }
-       
+    @Override
+    public DefinedTermBase findWithoutFlush(UUID uuid) {
+        return defaultService.findWithoutFlush(uuid);
+    }
+
+
+    @Override
+    public <S extends DefinedTermBase>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
+        return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+     */
+    @Override
+    public DeleteResult delete(UUID uuid) {
+        return defaultService.delete(uuid);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+     */
+    @Override
+    public DeleteResult delete(Collection<UUID> arg0) {
+        return defaultService.delete(arg0);
+    }
 
-       @Override
-       public <S extends DefinedTermBase>  Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
-               return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
-       }
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+     */
+    @Override
+    public List<DefinedTermBase> merge(List<DefinedTermBase> arg0) {
+        return defaultService.merge(arg0);
+    }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.ITermService#delete(java.util.UUID, eu.etaxonomy.cdm.api.service.config.TermDeletionConfigurator)
+     */
+    @Override
+    public DeleteResult delete(UUID arg0, TermDeletionConfigurator arg1) {
+        return defaultService.delete(arg0, arg1);
+    }
 }
index e5148ff67db0b187cbdd377c87d89f87205265e8..55b2f77520e58795c8e91288fd7a4c61e482d366 100644 (file)
@@ -13,6 +13,8 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.util.LocalSelectionTransfer;
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
 import org.eclipse.swt.dnd.TransferData;
 
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
@@ -64,4 +66,13 @@ public class DerivateDropListener extends ViewerDropAdapter {
         return LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && target instanceof TreeNode;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void dragOver(DropTargetEvent event) {
+        super.dragOver(event);
+        event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
+    }
+
 }
index 70de10d2d8028ae54ca6bb3178e4265d39da7734..1f429451b3cd0f2842b1b4e4bc9f1f408f245f3d 100644 (file)
@@ -72,7 +72,7 @@ public class DeleteDerivateHandler extends AbstractHandler {
                         boolean deepDelete = event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivate.deepDelete");
                         config.setDeleteChildren(deepDelete);
                         config.setDeleteMolecularData(deepDelete);
-                        DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, postOperationEnabled, config);
+                        DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, (TreeNode) object, postOperationEnabled, config);
                         AbstractUtility.executeOperation(deleteDerivateOperation);
                     }
                 }
index b13c0cf35fc8708fc4a88b6034de8f655fc5e363..c467a943e007f923330bb62fdee50b8681b1a0c4 100644 (file)
@@ -15,12 +15,15 @@ import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.ui.ISaveablePart;
 
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
@@ -38,26 +41,21 @@ import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDia
 public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
 
     private final SpecimenDeleteConfigurator deleteConfigurator;
+    private final TreeNode treeNode;
 
-    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
+    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element, TreeNode treeNode,
             IPostOperationEnabled postOperationEnabled) {
-        this(label, undoContext, element, postOperationEnabled, new SpecimenDeleteConfigurator());
+        this(label, undoContext, element, treeNode, postOperationEnabled, new SpecimenDeleteConfigurator());
     }
 
-    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
+    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element, TreeNode treeNode,
             IPostOperationEnabled postOperationEnabled, SpecimenDeleteConfigurator config) {
         super(label, undoContext, element, postOperationEnabled);
         this.deleteConfigurator = config;
+        this.treeNode = treeNode;
     }
 
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse
-     * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-     */
     /** {@inheritDoc} */
     @Override
     public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
@@ -75,7 +73,16 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
                 return Status.CANCEL_STATUS;
             }
         }
-        DeleteResult deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
+        DeleteResult deleteResult;
+        if(element instanceof SingleRead && treeNode!=null
+                && treeNode.getValue().equals(element)
+                && treeNode.getParent()!=null
+                && treeNode.getParent().getValue() instanceof Sequence){
+            deleteResult = CdmStore.getService(IOccurrenceService.class).deleteSingleRead((SingleRead)element, (Sequence) treeNode.getParent().getValue());
+        }
+        else{
+            deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
+        }
         if(deleteResult.isOk()){
             if(getPostOperationEnabled() instanceof DerivateView){
                 DerivateView derivateView = (DerivateView) getPostOperationEnabled();
@@ -96,13 +103,6 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
         return Status.OK_STATUS;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
-     * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-     */
     /** {@inheritDoc} */
     @Override
     public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
@@ -110,13 +110,6 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
         return Status.CANCEL_STATUS ;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
-     * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-     */
     /** {@inheritDoc} */
     @Override
     public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
index e522c94c7a8d81b58f921ccdc4a9e090abee6802..703d3121876fabdcddd1c1fe29074cd2b72fadd7 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="eu.etaxonomy.taxeditor.feature.platform"
       label="Taxeditor Dependencies"
-      version="3.6.1"
+      version="3.7.0"
       os="linux,macosx,win32"
       ws="cocoa,gtk,win32"
       arch="x86,x86_64">
index 4faf304ae2b4d08a260c848d8546133cd151d407..1f83292b088c4e3df32c9cde340b81d3150f2e83 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.6.1</version>
+               <version>3.7.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
index 26fe7a2613d6728eed7e750286b383883587a4a2..92d7ebe7c71900b09d598fe30b62ba24773c79d1 100644 (file)
@@ -2,7 +2,11 @@
 <feature
       id="eu.etaxonomy.taxeditor.feature"
       label="Taxonomic Editor"
+<<<<<<< HEAD
       version="3.6.1"
+=======
+      version="3.7.0"
+>>>>>>> refs/heads/release/3.7.0
       provider-name="EDIT"
       plugin="eu.etaxonomy.taxeditor.application"
       os="linux,macosx,win32"
index 4c92868f7c67073f0dd580f948585aa6a92b97fc..dd303a7179d2a99c2734b676baabdd065ba20f73 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>3.6.1</version>
+    <version>3.7.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
index b3f1f591f83b1d29eb9c160efee9d24d6e62584c..2672d3cc34aed668e6d4d8cb73a0a38d2b31dcb3 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Help
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
 Bundle-Vendor: EDIT
 Require-Bundle: org.eclipse.ui,
index 74747fcd9409623f1ca59b9c214e56785963446b..f78ca020824b106f3828add2d4c5cb628e3e37d2 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.6.1</version>
+               <version>3.7.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 0c1392d3e4a994c9585c3986ba1e697c6cba0731..cd549a57fbd284b0392d8f77b649cabf90138b94 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Navigation Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.navigation,
index 27da5feba6a62044f99b2ae7d1079ab3d312e5ff..e6582f7fdca4d5a3d50b9af91e5472f112a09343 100644 (file)
@@ -38,7 +38,7 @@ command.name.7 = Edit Polytomous Key nodes
 command.name.8 = Refresh Polytomous Key list\r
 command.name.9 = Refresh Polytomous Key nodes\r
 command.name.10 = Fix Classification Hierarchy\r
-\r
+command.name.11 = Delete \r
 view.name.2 = Taxonomic Tree\r
 navigatorContent.name = Classification\r
 navigatorContent.name.0 = TaxonNode\r
index 12b1f1376a8b6d5865472a865a6fb9183bbce29e..a561d9e4305e37a7cc897676ee8a1041cde7f9db 100644 (file)
@@ -25,7 +25,7 @@ command.label.fixClassificationHierarchy = Erzeuge Taxon-Hierarchie
 \r
 menu.label.0 = Aktualisieren\r
 command.label.17 = Liste\r
-command.label.18 = Schlsselknoten\r
+command.label.18 = Schl\u00fcsselknoten\r
 command.label.19 = L\u00F6schen\r
 command.name = Neuer Taxonknoten\r
 command.name.0 = Neue Klassifikation\r
@@ -34,11 +34,12 @@ command.name.2 = Verschiebe Taxon
 command.name.3 = Aktualisieren\r
 command.name.4 = Kopieren\r
 command.name.5 = Verschiebe akzeptiertes Taxon in Synonymie\r
-command.name.6 = Neuer Polytomer Schlssel\r
-command.name.7 = Bearbeite Schlssel-Knoten\r
-command.name.8 = Aktualisiere Schlssel-Liste\r
-command.name.9 = Aktualisiere Schlssel-Knoten\r
+command.name.6 = Neuer Polytomer Schl\u00fcssel\r
+command.name.7 = Bearbeite Schl\u00fcssel-Knoten\r
+command.name.8 = Aktualisiere Schl\u00fcssel-Liste\r
+command.name.9 = Aktualisiere Schl\u00fcssel-Knoten\r
 command.name.10 = Erzeuge Taxon-Hierarchie\r
+command.name.11 = L\u00F6schen\r
 view.name.2 = Taxonomiebaum\r
 navigatorContent.name = Klassifikation\r
 navigatorContent.name.0 = Taxonknoten\r
index c935307f6a1cef4dabbbdfa329ab016bbc051585..86609245a3571b0d1283dfd2b75e6977e441a567 100644 (file)
       <command
             defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.DeleteHandler"
             id="eu.etaxonomy.taxeditor.navigation.command.delete"
-            name="delete">
+            name="%command.name.11">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.DeleteHandler"
+            id="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete"
+            name="%command.name.11">
       </command>
    </extension>
    <extension
index ed81dc650dc9c62b17c38a33b7f2c4f4a6a9ea66..aacca8d12596c4c8d59cd33884f9ce2fe647bc29 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.6.1</version>
+               <version>3.7.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 9784c9a7650a34f7702f85e9dbf9af9520494131..8ba357df8781070b8363067366cd67a3c874bd89 100644 (file)
@@ -4,9 +4,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.PlatformUI;
 
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
@@ -18,26 +17,20 @@ public class NavigationCdmViewer implements ICdmViewer {
     @SuppressWarnings("unused")
     private final Logger logger = Logger.getLogger(NavigationCdmViewer.class);
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
-     */
     @Override
-    public void show(Object input, Class<?> viewerClass, ExecutionEvent event) {
+    public void show(Object input, Class<?> viewerClass) {
         if(viewerClass.equals(NewClassificationWizard.class)){
             if(input instanceof Classification){
                 Classification classification = (Classification)input;
                 NewClassificationWizard classificationWizard = new NewClassificationWizard();
                 classificationWizard.init(null, null);
                 classificationWizard.setEntity(classification);
-                WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
+                WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
                 dialog.open();
             }
         }
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
-     */
     @Override
     public Map<Class<?>, String> getViewerClasses(Object input) {
         Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
index 3913e0a2922c3eec1cc9e992e54b697fa4413d30..813701c91f55f4c041d29d407b69d3f6bd54f40e 100644 (file)
@@ -32,8 +32,9 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch;
+
 import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeComparator;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.model.DataChangeBridge;
 import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
@@ -83,9 +84,9 @@ public class TaxonNavigator extends CommonNavigator implements
                if (PreferencesUtil.getSortNodesNaturally()){
                        comparator = new TaxonNaturalComparator();
                } else{
-                       comparator = new TaxonComparatorSearch();
+                       comparator = new TaxonNodeComparator();
                }
-               TaxonNodeComparator viewerComparator = new TaxonNodeComparator(comparator);
+               TaxonNodeNavigatorComparator viewerComparator = new TaxonNodeNavigatorComparator(comparator);
                this.getCommonViewer().setComparator(viewerComparator);
         setLinkingEnabled(true);
 //             this.getCommonViewer().addSelectionChangedListener(new ISelectionChangedListener() {
@@ -1,40 +1,40 @@
-package eu.etaxonomy.taxeditor.navigation.navigator;\r
-\r
-import java.util.Arrays;\r
-import java.util.Comparator;\r
-\r
-\r
-import org.eclipse.jface.viewers.Viewer;\r
-import org.eclipse.jface.viewers.ViewerComparator;\r
-\r
-\r
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;\r
-import eu.etaxonomy.cdm.model.taxon.Classification;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;\r
-\r
-public class TaxonNodeComparator extends ViewerComparator{\r
-\r
-       \r
-       public TaxonNodeComparator(Comparator<TaxonBase> comparator){\r
-               super(comparator);\r
-       }\r
-\r
-       \r
-       \r
-       @Override\r
-       public int compare(Viewer viewer, Object e1, Object e2){\r
-               if (e1 instanceof Classification && e2 instanceof Classification){\r
-                       return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache());\r
-               } else{\r
-                       if (this.getComparator() instanceof TaxonNaturalComparator){\r
-                               return this.getComparator().compare((TaxonNode)e1, (TaxonNode)e2);\r
-                       }else{\r
-                               return this.getComparator().compare(((TaxonNode)e1).getTaxon(),((TaxonNode)e2).getTaxon());\r
-                       }\r
-               }\r
-       }\r
-}\r
+package eu.etaxonomy.taxeditor.navigation.navigator;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+
+
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
+
+public class TaxonNodeNavigatorComparator extends ViewerComparator{
+
+       
+       public TaxonNodeNavigatorComparator(Comparator<TaxonBase> comparator){
+               super(comparator);
+       }
+
+       
+       
+       @Override
+       public int compare(Viewer viewer, Object e1, Object e2){
+               if (e1 instanceof Classification && e2 instanceof Classification){
+                       return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache());
+               } else{
+                       if (this.getComparator() instanceof TaxonNaturalComparator){
+                               return this.getComparator().compare((TaxonNode)e1, (TaxonNode)e2);
+                       }else{
+                               return this.getComparator().compare(e1,e2);
+                       }
+               }
+       }
+}
index dc8eb7be992423dad071154b51fa5185ec3d7b58..da0217ffd3c637c3a0944c1b1f4f474c126f41c5 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Printpublisher Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Require-Bundle: org.eclipse.osgi,
  org.eclipse.ui,
  eu.etaxonomy.taxeditor.cdmlib,
index a9a8afc66a258ec3d9fa76ed7c4a2635ff2ad2cc..c77414a43127eb0841231229c35cc38a82bd5493 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <artifactId>taxeditor-parent</artifactId>
                <groupId>eu.etaxonomy</groupId>
-               <version>3.6.1</version>
+               <version>3.7.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 5225d0045bd621c7e76d27661f8bc191eecb908d..ad6e472eac9cdbd86d76e1aa7c14cc935b34c339 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: DataStore Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
 Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.cdm,
index 937ba69a60ea2f138d315405c0c462d405905430..28fb041ac8601f9408ed20a1a97425661483ef05 100644 (file)
@@ -15,7 +15,7 @@ page.name.11 = Marker
 page.name.12 = Erweiterungen
 page.name.13 = Typusarten (Namen)
 page.name.14 = Gebiete
-page.name.15 = Matching (experimentel)
+page.name.15 = Matching (experimentell)
 page.name.16 = Taxonnamen Matching-Strategie
 page.name.17 = Referenz Matching-Strategie
 page.name.18 = Team oder Personen Matching-Strategie
diff --git a/eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.png b/eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.png
new file mode 100644 (file)
index 0000000..53ced0e
Binary files /dev/null and b/eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.png differ
index 9c15669e4e4d43383d1e5fd405e278e89d308a90..b53451f9ba320a82745cfa49a1c81371944ca18a 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
        <groupId>eu.etaxonomy</groupId>
        <artifactId>taxeditor-parent</artifactId>
-       <version>3.6.1</version>
+       <version>3.7.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
index eecb24ba985bc32c311ad1b90fb48be78d63d8ab..e6e8dc6d86422fb25c1e86b66a35a198fbef1aef 100644 (file)
@@ -9,6 +9,14 @@ import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.taxeditor.view.CdmViewerChooser;
 
+/**
+ * Opens the (first) currently selected element in a viewer. Opens a list of
+ * possible viewers if more than one are registered for this element.
+ *
+ * @author pplitzner
+ * @date Jul 6, 2015
+ *
+ */
 public class OpenHandler extends AbstractHandler {
 
     @Override
@@ -17,7 +25,7 @@ public class OpenHandler extends AbstractHandler {
         if(currentSelection instanceof IStructuredSelection){
             Object firstElement = ((IStructuredSelection) currentSelection).getFirstElement();
             CdmViewerChooser viewerChooser = new CdmViewerChooser(HandlerUtil.getActiveShell(event));
-            viewerChooser.chooseViewer(firstElement, event);
+            viewerChooser.chooseViewer(firstElement);
         }
         return null;
     }
index 51dcd8413270ab709099fb4e023837983396c784..336f39eb8bb75ba4d4f52a1a6ab6a1c9e9d67020 100644 (file)
@@ -134,6 +134,9 @@ public class ImageResources {
        /** Constant <code>COLLAPSE_ALL="collapse_all"</code> */
        public static final String COLLAPSE_ALL = "collapse_all";
 
+       public static final String SWITCH_VIEW_TYPE = "switch_view_type";
+
+       //derivative icons
        public static final String TISSUE_SAMPLE_DERIVATE = "tissue_sample_derivate";
        public static final String TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA = "tissue_sample_derivate_character_data";
        public static final String DNA_SAMPLE_DERIVATE = "dna_sample_derivate";
@@ -333,6 +336,8 @@ public class ImageResources {
                        "lock.png");
                registerImage(registry, LOCK_OPEN_ICON,
                        "lock_open.png");
+               registerImage(registry, SWITCH_VIEW_TYPE,
+                       "switch_view_type-16x16-32.png");
                registerImage(registry, DNA_SAMPLE_DERIVATE,
                        "dna_derivate-16x16-32.png");
                registerImage(registry, DNA_SAMPLE_DERIVATE_CHARACTER_DATA,
index 63407272bdb6621aebb744ad8bf736605223c2fd..57ee2e499e17077af965914bb3b6b186232bf5ba 100644 (file)
@@ -67,10 +67,10 @@ public class MatchStrategyConfigurator {
                IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(NonViralName.class);
                
                strategy.setMatchMode("nomenclaturalReference", MatchMode.IGNORE);
-               strategy.setMatchMode("combinationAuthorTeam", MatchMode.IGNORE);
-               strategy.setMatchMode("exCombinationAuthorTeam", MatchMode.IGNORE);
-               strategy.setMatchMode("basionymAuthorTeam", MatchMode.IGNORE);
-               strategy.setMatchMode("exBasionymAuthorTeam", MatchMode.IGNORE);
+               strategy.setMatchMode("combinationAuthorship", MatchMode.IGNORE);
+               strategy.setMatchMode("exCombinationAuthorship", MatchMode.IGNORE);
+               strategy.setMatchMode("basionymAuthorship", MatchMode.IGNORE);
+               strategy.setMatchMode("exBasionymAuthorship", MatchMode.IGNORE);
                
                return strategy;
        }
index df90397af4c901336471623a5ae1f7ac5fc24536..48a56f518ae00f2d6e96d95e8d6cbaba7fd8a303 100644 (file)
@@ -35,10 +35,10 @@ public class ParseHandler{
                List<INomenclaturalReference> duplicateReferences = new ArrayList<INomenclaturalReference>();
                List<INomenclaturalReference> duplicateInReferences = new ArrayList<INomenclaturalReference>();
 
-               List<TeamOrPersonBase> duplicateCombinationAuthorTeams = new ArrayList<TeamOrPersonBase>();
-               List<TeamOrPersonBase> duplicateExCombinationAuthorTeams = new ArrayList<TeamOrPersonBase>();
-               List<TeamOrPersonBase> duplicateBasionymAuthorTeams = new ArrayList<TeamOrPersonBase>();
-               List<TeamOrPersonBase> duplicateExBasionymAuthorTeams = new ArrayList<TeamOrPersonBase>();
+               List<TeamOrPersonBase> duplicateCombinationAuthorships = new ArrayList<TeamOrPersonBase>();
+               List<TeamOrPersonBase> duplicateExCombinationAuthorships = new ArrayList<TeamOrPersonBase>();
+               List<TeamOrPersonBase> duplicateBasionymAuthorships = new ArrayList<TeamOrPersonBase>();
+               List<TeamOrPersonBase> duplicateExBasionymAuthorships = new ArrayList<TeamOrPersonBase>();
        }
 
        private static NonViralNameParserImpl nonViralNameParser = NonViralNameParserImpl.NewInstance();
@@ -234,27 +234,27 @@ public class ParseHandler{
         */
        private void resolveAllDuplicateAuthors(NonViralName name, MatchMatrix matchMatrix) {
 
-               if(matchMatrix.duplicateCombinationAuthorTeams.size() > 0){
-                       name.setCombinationAuthorTeam(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
+               if(matchMatrix.duplicateCombinationAuthorships.size() > 0){
+                       name.setCombinationAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next());
                        Reference reference = (Reference) name.getNomenclaturalReference();
                        if(reference != null){
-                               reference.setAuthorship(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
+                               reference.setAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next());
                        }
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
 
-               if(matchMatrix.duplicateExCombinationAuthorTeams.size() > 0){
-                       name.setExCombinationAuthorTeam(matchMatrix.duplicateExCombinationAuthorTeams.iterator().next());
+               if(matchMatrix.duplicateExCombinationAuthorships.size() > 0){
+                       name.setExCombinationAuthorship(matchMatrix.duplicateExCombinationAuthorships.iterator().next());
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
 
-               if(matchMatrix.duplicateBasionymAuthorTeams.size() > 0){
-                       name.setBasionymAuthorTeam(matchMatrix.duplicateBasionymAuthorTeams.iterator().next());
+               if(matchMatrix.duplicateBasionymAuthorships.size() > 0){
+                       name.setBasionymAuthorship(matchMatrix.duplicateBasionymAuthorships.iterator().next());
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
 
-               if(matchMatrix.duplicateExBasionymAuthorTeams.size() > 0){
-                       name.setExBasionymAuthorTeam(matchMatrix.duplicateExBasionymAuthorTeams.iterator().next());
+               if(matchMatrix.duplicateExBasionymAuthorships.size() > 0){
+                       name.setExBasionymAuthorship(matchMatrix.duplicateExBasionymAuthorships.iterator().next());
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
        }
@@ -271,10 +271,10 @@ public class ParseHandler{
 
                matchMatrix.duplicateNames = findMatchingLatinNames(name);
 
-               matchMatrix.duplicateCombinationAuthorTeams = findMatchingAuthors(name.getCombinationAuthorTeam());
-               matchMatrix.duplicateExCombinationAuthorTeams = findMatchingAuthors(name.getExCombinationAuthorTeam());
-               matchMatrix.duplicateBasionymAuthorTeams = findMatchingAuthors(name.getBasionymAuthorTeam());
-               matchMatrix.duplicateExBasionymAuthorTeams = findMatchingAuthors(name.getExBasionymAuthorTeam());
+               matchMatrix.duplicateCombinationAuthorships = findMatchingAuthors(name.getCombinationAuthorship());
+               matchMatrix.duplicateExCombinationAuthorships = findMatchingAuthors(name.getExCombinationAuthorship());
+               matchMatrix.duplicateBasionymAuthorships = findMatchingAuthors(name.getBasionymAuthorship());
+               matchMatrix.duplicateExBasionymAuthorships = findMatchingAuthors(name.getExBasionymAuthorship());
 
                INomenclaturalReference nomenclaturalReference = name.getNomenclaturalReference();
 
index 8c5f2b21daca5e3b1cd5bfd787517f4246658fb1..fb46d4fa2361e62e8d020c8412a483db84874963 100644 (file)
@@ -14,14 +14,13 @@ import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
 import org.eclipse.ui.forms.widgets.Section;
 
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
- * <p>Abstract AbstractCdmFormElement class.</p>
- *
  * @author n.hoffmann
  * @version $Id: $
  */
@@ -41,23 +40,11 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
        private Color persistentBackgroundColor;
 
 
-       /**
-        * <p>Constructor for AbstractCdmFormElement.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param layoutComposite a {@link org.eclipse.swt.widgets.Composite} object.
-        */
        protected AbstractCdmFormElement(CdmFormFactory formFactory, Composite layoutComposite){
                this.layoutComposite = layoutComposite;
                this.formFactory = formFactory;
        }
 
-       /**
-        * <p>Constructor for AbstractCdmFormElement.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
-        */
        public AbstractCdmFormElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
                this(formFactory, formElement.getLayoutComposite());
                this.parentElement = formElement;
@@ -95,11 +82,6 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
                controls.add(child);
        }
 
-       /**
-        * <p>removeControl</p>
-        *
-        * @param child a {@link org.eclipse.swt.widgets.Control} object.
-        */
        protected void removeControl(Control child){
                controls.remove(child);
        }
@@ -130,11 +112,6 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
                elements.add(element);
        }
 
-       /**
-        * <p>removeElement</p>
-        *
-        * @param element a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
-        */
        protected void removeElement(ICdmFormElement element){
                elements.remove(element);
        }
@@ -231,9 +208,6 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
                this.layoutComposite = layoutComposite;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#getPropertyChangeListeners()
-        */
        /**
         * <p>Getter for the field <code>propertyChangeListeners</code>.</p>
         *
@@ -244,21 +218,12 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
                return propertyChangeListeners;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#setPropertyChangeListeners(org.eclipse.core.runtime.ListenerList)
-        */
        /** {@inheritDoc} */
        @Override
     public void setPropertyChangeListeners(List<IPropertyChangeListener> propertyChangeListeners){
                this.propertyChangeListeners = propertyChangeListeners;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent()
-        */
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#firePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent)
-        */
        /** {@inheritDoc} */
        @Override
     public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
@@ -329,13 +294,18 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
                }
        }
 
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.ICdmFormElement#refresh()
-        */
-       /**
-        * <p>refresh</p>
-        */
+       protected void reflowParentScrolledForm(boolean flushCashes){
+           ScrolledForm scrolledForm = null;
+           Composite parent = getLayoutComposite().getParent();
+           while(parent!=null && !(parent instanceof ScrolledForm)){
+               parent = parent.getParent();
+           }
+           scrolledForm = (ScrolledForm)parent;
+           if(scrolledForm!=null){
+               scrolledForm.reflow(flushCashes);
+           }
+       }
+
        @Override
     public void refresh() {
                // empty default implementation
index 6373d42ae2170711e3d21cfa675e108057e3efab..f44a4373b407d2b2a28714ee2ea585313e60e27a 100644 (file)
@@ -255,6 +255,8 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
@@ -321,6 +323,7 @@ import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollection
 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
 import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
 
@@ -1660,6 +1663,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
+    public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
     public DnaQualityDetailSection createDnaQualityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         DnaQualityDetailSection section = new DnaQualityDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
@@ -2010,6 +2019,12 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+    public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
+        DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
     public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
         DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
@@ -2602,6 +2617,48 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+    /**
+     * <p>
+     * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
+     * </p>
+     * <p>
+     * <strong>Selection elements not handled by this method:</strong>
+     * <ul>
+     * <li>{@link TaxonNodeSelectionElement} see
+     * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
+     * </li>
+     * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
+     * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
+     * </li>
+     * </ul>
+     * </p>
+     *
+     * @param clazz
+     *            a {@link Class} object of the type that you want the selection
+     *            element to handle
+     * @param parentElement
+     *            a {@link ICdmFormElement} object.
+     * @param labelString
+     *            a {@link String} object.
+     * @param selectionType
+     * @param selection
+     *            a {@link ICdmBase} object.
+     * @param style
+     *            a int.
+     * @param conversation
+     *            a {@link ConversationHolder} object.
+     * @return a {@link EntitySelectionElement} object.
+     */
+    public <T extends ICdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
+            Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
+            T selection, int mode, int style) {
+        EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
+                labelString, selection, mode, style);
+        adapt(element);
+        parentElement.addElement(element);
+        return element;
+    }
+
     public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
             ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
         TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
index 5d666156c32630211fc70da4ae64f38e54874edf..d5f7b310542dc1212a42e43036f53a09078d8417 100644 (file)
@@ -3,7 +3,6 @@
  */
 package eu.etaxonomy.taxeditor.ui.element;
 
-import org.apache.commons.lang.StringUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyAdapter;
 import org.eclipse.swt.events.KeyEvent;
@@ -152,11 +151,7 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
      * @return a {@link java.lang.String} object.
      */
     public String getText() {
-       if (StringUtils.isBlank(text.getText())){
-               return null;
-       }else{
-               return text.getText();
-       }
+        return text.getText();
     }
 
     /**
index a4309ae9e46fbdd4f7d6dad6f254c4804da4bf28..ee6867db2b3a57827f7e4f552affc3713903b1bc 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.
 */
@@ -11,9 +11,9 @@
 package eu.etaxonomy.taxeditor.ui.element;
 
 import java.net.URI;
-import java.net.URISyntaxException;
-
 
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
 
 /**
  * @author n.hoffmann
@@ -22,32 +22,33 @@ import java.net.URISyntaxException;
  */
 public class UriWithLabelElement extends TextWithLabelElement {
 
-       /**
-        * @param formFactory
-        * @param parentElement
-        * @param labelString
-        * @param initialText
-        * @param textHeight
-        * @param style
-        */
+    private final Label labelException;
+
        protected UriWithLabelElement(CdmFormFactory formFactory,
                        ICdmFormElement parentElement, String labelString,
                        URI initialUri, Integer textHeight, int style) {
                super(formFactory, parentElement, labelString, null, textHeight, style);
+
+               labelException = formFactory.createLabel(getLayoutComposite(), "", SWT.WRAP);
+               labelException.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+               addControl(labelException);
                setUri(initialUri);
        }
-       
-       /**
-        * 
-        */
+
        public void setUri(URI uri) {
                if(uri != null){
                        super.setText(uri.toString());
                }
        }
-       
-       public URI getUri() throws URISyntaxException{
-               return new URI(super.getText());
+
+       public URI getUri(){
+        try {
+            labelException.setText("");
+            return new URI(super.getText());
+        } catch (Exception e) {
+            labelException.setText(e.getMessage());
+            return null;
+        }
        }
-       
+
 }
index 9d3a362b4b2ef7a9ae6fd25d99e94c9067379c47..f8f73861da0d5749bcc10a3b3429461550155413 100644 (file)
@@ -39,9 +39,6 @@ import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
 
 /**
- * <p>
- * Abstract AbstractCdmDetailElement class.
- * </p>
  *
  * @author n.hoffmann
  * @created Feb 26, 2010
@@ -57,20 +54,6 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
 
        private EnumSet<CRUD> requiredCrud = null;
 
-       /**
-        * <p>
-        * Constructor for AbstractCdmDetailElement.
-        * </p>
-        *
-        * @param formFactory
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-        *            object.
-        * @param formElement
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-        *            object.
-        * @param <T>
-        *            a T object.
-        */
        public AbstractCdmDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement) {
                super(formFactory, formElement);
@@ -106,18 +89,6 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
         updateContent();
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity()
-        */
-       /**
-        * <p>
-        * Getter for the field <code>entity</code>.
-        * </p>
-        *
-        * @return a T object.
-        */
        @Override
     public T getEntity() {
                return entity;
@@ -129,19 +100,12 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
        protected void updateContent() {
                removeElements();
                createControls(this, entity, SWT.WRAP);
-               getLayoutComposite().layout();
+               reflowParentScrolledForm(true);
 
                updateControlStates();
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.forms.ISelectableComposite#setSelected(boolean)
-        */
-       /** {@inheritDoc} */
-       @Override
+    @Override
     public void setSelected(boolean selected) {
                Composite section = getLayoutComposite().getParent();
                section.setBackground(selected ? SELECTED : getPersistentBackground());
@@ -171,9 +135,6 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
                }
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
-        */
        @Override
        public boolean isEnabled() {
            return enabled;
@@ -283,6 +244,7 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
                if (getParentElement() instanceof AbstractCdmDetailSection) {
                        ((AbstractCdmDetailSection) getParentElement()).updateTitle();
                }
+               reflowParentScrolledForm(true);
        }
 
        /**
@@ -294,40 +256,15 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
         */
        public abstract void handleEvent(Object eventSource);
 
-       /**
-        * <p>
-        * handleException
-        * </p>
-        *
-        * @param event
-        *            a
-        *            {@link eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent}
-        *            object.
-        */
        public void handleException(CdmPropertyChangeEvent event) {
                // override this in subclasses if you want to deal with the error
                MessagingUtils.error(event.getSource().getClass(), event.getException());
        }
 
-       /**
-        * <p>
-        * isIrrelevant
-        * </p>
-        *
-        * @return a boolean.
-        */
        public boolean isIrrelevant() {
                return irrelevant;
        }
 
-       /**
-        * <p>
-        * getConversationHolder
-        * </p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
-        *         object.
-        */
        @Override
     public ConversationHolder getConversationHolder() {
                if (getParentElement() instanceof IConversationEnabled) {
index 1060f986f725b795ee57650e37d4889344d7f52d..328b085939599c0a98963507aef0aa64a08d35e2 100644 (file)
@@ -52,6 +52,9 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
 
        private final Composite container;
 
+       /**
+        * Composite "around" the actual content. Is used for control action like e.g. remove button
+        */
        private final Composite box;
 
        private Button btnRemove;
@@ -59,26 +62,6 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
 
        private Color backgroundColor;
 
-       /**
-        * <p>
-        * Constructor for AbstractEntityCollectionElement.
-        * </p>
-        *
-        * @param style
-        *            a int.
-        * @param formFactory
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-        *            object.
-        * @param section
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-        *            object.
-        * @param entity
-        *            a ENTITY object.
-        * @param removeListener
-        *            a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param <ENTITY>
-        *            a ENTITY object.
-        */
        public AbstractEntityCollectionElement(CdmFormFactory formFactory,
                AbstractFormSection section, ENTITY entity,
                SelectionListener removeListener, Color backgroundColor, int style) {
@@ -97,7 +80,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                box.setBackgroundMode(SWT.INHERIT_DEFAULT);
                addControl(box);
 
-               TableWrapLayout boxLayout = LayoutConstants.LAYOUT(3, false);
+               TableWrapLayout boxLayout = LayoutConstants.LAYOUT(4, false);
                boxLayout.topMargin = 4;
                boxLayout.bottomMargin = 4;
                box.setLayout(boxLayout);
@@ -163,23 +146,8 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                // default implementation is empty
        }
 
-       /**
-        * <p>
-        * Setter for the field <code>entity</code>.
-        * </p>
-        *
-        * @param entity
-        *            a ENTITY object.
-        */
        public abstract void setEntity(ENTITY entity);
 
-       /**
-        * <p>
-        * Getter for the field <code>entity</code>.
-        * </p>
-        *
-        * @return a ENTITY object.
-        */
        @Override
     public ENTITY getEntity() {
                return entity;
@@ -196,17 +164,6 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
            return null;
        }
 
-       /**
-        * <p>
-        * createControls
-        * </p>
-        *
-        * @param element
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-        *            object.
-        * @param style
-        *            a int.
-        */
        public abstract void createControls(ICdmFormElement element, int style);
 
        /**
@@ -223,13 +180,6 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                setBackground(selected ? SELECTED : getPersistentBackground());
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org
-        * .eclipse.jface.util.PropertyChangeEvent)
-        */
        /** {@inheritDoc} */
        @Override
        public void propertyChange(PropertyChangeEvent event) {
@@ -242,14 +192,6 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                }
        }
 
-       /**
-        * <p>
-        * handleEvent
-        * </p>
-        *
-        * @param eventSource
-        *            a {@link java.lang.Object} object.
-        */
        public abstract void handleEvent(Object eventSource);
 
        /** {@inheritDoc} */
@@ -282,25 +224,14 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                return container;
        }
 
-       /**
-        * <p>
-        * Getter for the field <code>backgroundColor</code>.
-        * </p>
-        *
-        * @return the backgroundColor
-        */
        public Color getBackgroundColor() {
                return backgroundColor;
        }
 
-       /**
-        * <p>
-        * getConversationHolder
-        * </p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
-        *         object.
-        */
+    public Composite getBox() {
+        return box;
+    }
+
        @Override
     public ConversationHolder getConversationHolder() {
                if (getParentElement() instanceof IConversationEnabled) {
index d349a64eed00b0506616e692277a58aa18a9e4ac..482b9455ea46ab3de5a81d718770047a79672f49 100644 (file)
@@ -55,9 +55,6 @@ import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 
 public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends AbstractFormSection<ENTITY> implements IExpansionListener, Observer {
 
-       /**
-     *
-     */
     private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
 
     protected Composite container;
@@ -66,17 +63,8 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
 
        private String title;
 
-       /**
-        * <p>Constructor for AbstractEntityCollectionSection.</p>
-        *
-        * @param conversation
-        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
-        * @param style a int.
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param title a {@link java.lang.String} object.
-        * @param <ENTITY> a ENTITY object.
-        * @param <ELEMENT> a ELEMENT object.
-        */
+    private AbstractEntityCollectionElement entityCollectionElement;
+
        public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
                super(formFactory, parentElement, ExpandableComposite.CLIENT_INDENT | style);
                this.title = title;
@@ -98,9 +86,6 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
 
                Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
-                       /* (non-Javadoc)
-                        * @see org.eclipse.jface.action.Action#run()
-                        */
                        @Override
                        public void run() {
                                ELEMENT element = createNewElement();
@@ -141,11 +126,6 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                setTextClient(null);
        }
 
-       /**
-        * <p>setEntity</p>
-        *
-        * @param entity a ENTITY object.
-        */
        @Override
        public void setEntity(ENTITY entity) {
                if(entity != null){
@@ -217,9 +197,6 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                reflow();
        }
 
-       /**
-        * <p>createEmptyContent</p>
-        */
        protected void createEmptyContent(){
                label_empty = formFactory.createLabel(getLayoutComposite(), getEmptyString());
        }
@@ -254,12 +231,9 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
         */
        protected void createElementComposite(ELEMENT element, SelectionListener removeListener, Color backgroundColor){
-               formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
+               entityCollectionElement = formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground(org.eclipse.swt.graphics.Color)
-        */
        /** {@inheritDoc} */
        @Override
        public void setBackground(Color color) {
@@ -319,9 +293,6 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                internalUpdateSection(true);
        }
 
-       /* (non-Javadoc)
-        * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
-        */
        @Override
     public void update(Observable o, Object arg){
            if(o instanceof LoginManager){
@@ -337,6 +308,10 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         }
     }
 
+    public AbstractEntityCollectionElement getEntityCollectionElement() {
+        return entityCollectionElement;
+    }
+
        /**
         * Get the specific collection of this entity
         *
index ac7bb0494f5d18a91339a5e193e30b65aa6040db..8e8e1e64489eff3f9b82ab21e0e48c068161b667 100644 (file)
@@ -13,6 +13,7 @@ package eu.etaxonomy.taxeditor.ui.section.agent;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
@@ -21,10 +22,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
- * <p>
- * TeamMemberElement class.
- * </p>
- *
  * @author n.hoffmann
  * @created Apr 30, 2010
  * @version 1.0
@@ -33,37 +30,12 @@ public class TeamMemberElement extends AbstractEntityCollectionElement<Person> {
 
        private EntitySelectionElement<Person> selection_person;
 
-       /**
-        * <p>
-        * Constructor for TeamMemberElement.
-        * </p>
-        *
-        * @param cdmFormFactory
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-        *            object.
-        * @param section
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-        *            object.
-        * @param entity
-        *            a {@link eu.etaxonomy.cdm.model.agent.Person} object.
-        * @param removeListener
-        *            a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style
-        *            a int.
-        */
        public TeamMemberElement(CdmFormFactory cdmFormFactory,
                        AbstractFormSection section, Person entity,
                        SelectionListener removeListener, int style) {
                super(cdmFormFactory, section, entity, removeListener, null, style);
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
-        * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
-        */
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
@@ -74,13 +46,6 @@ public class TeamMemberElement extends AbstractEntityCollectionElement<Person> {
                                                style);
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
-        * (eu.etaxonomy.cdm.model.common.VersionableEntity)
-        */
        /** {@inheritDoc} */
        @Override
        public void setEntity(Person entity) {
@@ -94,7 +59,19 @@ public class TeamMemberElement extends AbstractEntityCollectionElement<Person> {
         if (eventSource == selection_person) {
             if (getParentElement() instanceof TeamMemberSection) {
                 TeamMemberSection teamMemberSection = (TeamMemberSection) getParentElement();
-                teamMemberSection.getEntity().addTeamMember(selection_person.getEntity());
+                Team team = teamMemberSection.getEntity();
+
+                int index = team.getTeamMembers().indexOf(getEntity());
+
+                if(index==-1){
+                    team.addTeamMember(selection_person.getEntity());
+                }
+                else{
+                    //first remove the edited team member and then add it again
+                    //because the model allows the same person multiple time in on team
+                    team.removeTeamMember(getEntity());
+                    team.addTeamMember(selection_person.getEntity(), index);
+                }
                 firePropertyChangeEvent(new CdmPropertyChangeEvent(teamMemberSection, eventSource));
             }
             entity = selection_person.getEntity();
index c1fa5a60bfc87b23a067be7876b583f893d75d76..48131bf00dcccf6103067e67d16490a530ac1696 100644 (file)
@@ -82,6 +82,7 @@ public class DescriptionElementDetailSection extends
                        }
                };
                // TODO enable this once a proper icon has been found
+               // ticket #5043
 //             addAction.setImageDescriptor(new ImageDescriptor() {
 //
 //                     @Override
index 10608b3b000f88dc24ec6805e2e15b6e293981c1..d39f91432a92fc1eca6e2033189dfadfa296d781 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.
 */
@@ -29,20 +29,12 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
  */
 public class DescriptionElementMediaSection extends
                AbstractEntityCollectionSection<DescriptionElementBase, Media> {
-       
-       /**
-        * <p>Constructor for DescriptionElementMediaSection.</p>
-        *
-        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
-        * @param style a int.
-        */
+
        public DescriptionElementMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
                        ICdmFormElement parentElement, int style) {
                super(cdmFormFactory, conversation, parentElement, "Media", style);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void setEntity(DescriptionElementBase entity) {
@@ -87,5 +79,6 @@ public class DescriptionElementMediaSection extends
        public void removeElement(Media element) {
                getEntity().removeMedia(element);
        }
-       
+
+
 }
index a4aca0cdea6031c80fa91da4dda52329cd7096d7..502ceaae5a578299e990c3880db20df9d533795e 100644 (file)
 
 package eu.etaxonomy.taxeditor.ui.section.description;
 
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.ToolBarManager;
 import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.media.Media;
@@ -36,88 +30,32 @@ import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
  */
 public class MediaDetailsSection extends AbstractCdmDetailSection<Media> {
 
-       private MediaMetaElement element_media;
+    private MediaMetaElement mediaMetaElement;
 
-       /**
-        * <p>Constructor for MediaDetailsSection.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
-        * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
-        * @param style a int.
-        */
        public MediaDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
                        ICdmFormElement parentElement,
                        ISelectionProvider selectionProvider, int style) {
                super(formFactory, conversation, parentElement, selectionProvider, style);
        }
 
-       /** {@inheritDoc} */
-       @Override
-       protected void createControls(AbstractCdmDetailSection formElement,
-                       int style) {
-               TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout();
-               layout.topMargin = 10;
-               layout.numColumns = 2;
-
-               getLayoutComposite().setLayout(layout);
-
-
-       }
-
-       @Override
-    protected Control createToolbar() {
-        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-
-        //FIXME: duplicate code (see #4598)
-        final String label = "Change View Type";
-
-        Action addAction = new Action(label, IAction.AS_PUSH_BUTTON) {
-            /* (non-Javadoc)
-             * @see org.eclipse.jface.action.Action#run()
-             */
-            @Override
-            public void run() {
-                element_media.toggleAdvancedMediaView();
-            }
-        };
-        addAction.setToolTipText(label);
-
-        toolBarManager.add(addAction);
-
-        return toolBarManager.createControl(this);
-    }
-
-       /**
-        * <p>setEntity</p>
-        *
-        * @param entity a {@link eu.etaxonomy.cdm.model.media.Media} object.
-        */
        @Override
     public void setEntity(Media entity) {
-               if(element_media != null){
+               if(mediaMetaElement != null){
                        this.removeElements();
                }
-               element_media = (MediaMetaElement) formFactory.createEntityCollectionElement(this, entity, null, null, ExpandableComposite.EXPANDED);
+               mediaMetaElement = (MediaMetaElement) formFactory.createEntityCollectionElement(this, entity, null, null, ExpandableComposite.EXPANDED);
                super.setEntity(entity);
                setSectionTitle();
         setTextClient(createToolbar());
                layout();
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
-        */
        /** {@inheritDoc} */
        @Override
        public String getHeading() {
                return "Image";
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
-        */
        @Override
        protected AbstractCdmDetailElement<Media> createCdmDetailElement(AbstractCdmDetailSection<Media> parentElement, int style) {
            return null;
index 30aa76de0429418b90d227a7a009f92036a9f705..7da47bb4c2b0742ac5ffbe3a10ee30c48c7f726e 100644 (file)
@@ -109,8 +109,14 @@ public class FeatureDistributionDetailElement extends AbstractCdmDetailElement<F
 
                List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
 
-               String parameter = CdmStore.getGeoService().getDistributionServiceRequestParameterString(getTaxonDescriptions(),
-                false, false, null, presenceAbsenceTermColors, languages);
+               String parameter = CdmStore.getGeoService().getDistributionServiceRequestParameterString(
+                               getTaxonDescriptions(),
+                false, 
+                false, 
+                null,
+                null,
+                presenceAbsenceTermColors, 
+                languages);
 
                String mapUriString = String.format("%s?%s&ms=1000&bbox=-180,-90,180,90&l=earth", accessPoint, parameter);
                return mapUriString;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/ITogglableMediaElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/ITogglableMediaElement.java
new file mode 100644 (file)
index 0000000..80d664b
--- /dev/null
@@ -0,0 +1,21 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.taxeditor.ui.section.media;
+
+/**
+ * @author pplitzner
+ * @date Jun 27, 2015
+ *
+ */
+public interface ITogglableMediaElement {
+
+    public void toggleAdvancedMediaView();
+
+}
index 098620fd70d003c00b96a7bc129492c53277f732..fbde0b7e0ed056e51d0b6d809db9aa24e4a535ac 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.
 */
@@ -14,13 +14,12 @@ import java.io.IOException;
 import java.net.URI;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
 import org.apache.http.HttpException;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.common.media.ImageInfo;
 import eu.etaxonomy.cdm.model.media.ImageFile;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
@@ -30,8 +29,6 @@ import eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement;
 import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
 
 /**
- * <p>ImageFileElement class.</p>
- *
  * @author n.hoffmann
  * @created Mar 26, 2010
  * @version 1.0
@@ -42,36 +39,28 @@ public class ImageFileElement extends MediaRepresentationPartElement<ImageFile>
        private NumberWithLabelElement text_width;
        private KeyValueViewerElement element_keyValue;
        private ImageElement element_image;
-       
-       
-       private Runnable postRunnable = new Runnable(){
-               public void run() {
-                       StoreUtil.reflowDetailsViewer();
-                       StoreUtil.reflowSupplementalViewer();
+
+
+       private final Runnable postRunnable = new Runnable(){
+               @Override
+        public void run() {
+                       AbstractUtility.reflowDetailsViewer();
+                       AbstractUtility.reflowSupplementalViewer();
                }
        };
-       
-       
-       /**
-        * <p>Constructor for ImageFileElement.</p>
-        *
-        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param element a {@link eu.etaxonomy.cdm.model.media.ImageFile} object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        */
+
+
        public ImageFileElement(CdmFormFactory cdmFormFactory,
                        AbstractFormSection section, ImageFile element,
                        SelectionListener removeListener, int style) {
                super(cdmFormFactory, section, element, removeListener, style);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement formElement, int style) {
                super.createControls(formElement, style);
-               
+
                text_height = formFactory.createNumberTextWithLabelElement(formElement, "Height", null, style);
                text_height.setEnabled(false);
                text_width = formFactory.createNumberTextWithLabelElement(formElement, "Width", null, style);
@@ -79,7 +68,7 @@ public class ImageFileElement extends MediaRepresentationPartElement<ImageFile>
                element_image = formFactory.createImageElement(formElement, null, style);
                element_keyValue = formFactory.createKeyValueViewerElement(formElement, "Key", "Value", null);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void setEntity(ImageFile entity) {
@@ -87,78 +76,72 @@ public class ImageFileElement extends MediaRepresentationPartElement<ImageFile>
                text_height.setNumber(entity.getHeight());
                text_width.setNumber(entity.getWidth());
                try {
-                       loadImage(entity.getUri(), false);              
+                       loadImage(entity.getUri(), false);
                } catch (Exception e) {
                        handleException(e);
                }
        }
-       
+
        private void loadImage(URI uri, boolean updateDimensions) throws IOException, HttpException{
                element_image.initImageUri(uri);
-               
+
                element_image.loadImage(postRunnable );
-               
-               
+
+
                if(uri == null){
                        return;
                }
-               
+
                ImageInfo imageInfo = ImageInfo.NewInstanceWithMetaData(uri, 10000);
-                               
+
                element_keyValue.setInput(imageInfo.getMetaData());
-               
+
                if(updateDimensions){
                        text_size.setText(FileUtils.byteCountToDisplaySize(imageInfo.getLength()));
-                       // KLUDGE this is not save for very large files, because of the int cast. 
+                       // KLUDGE this is not save for very large files, because of the int cast.
                        // But then, I don't think we will handle such large files in the near future
                        getEntity().setSize((int) imageInfo.getLength());
-                       
+
                        text_height.setNumber(imageInfo.getHeight());
                        getEntity().setHeight(imageInfo.getHeight());
-                               
+
                        text_width.setNumber(imageInfo.getWidth());
                        getEntity().setWidth(imageInfo.getWidth());
                }
-               
-               
-               element_messages.setText("");
+
+
        }
 
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
-        */
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource) {
                if(eventSource == text_uri){
                        try {
-                               String uriString = text_uri.getText();
-                               URI uri = StringUtils.isNotEmpty(uriString) ? new URI(uriString) : null;
+                           URI uri = text_uri.getUri();
                                getEntity().setUri(uri);
-                               
-                               
+
+
                                loadImage(getEntity().getUri(), true);
-                               
+
                                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
                        } catch (Exception e) {
                                handleException(e);
-                       } finally {                             
+                       } finally {
                                firePropertyChangeEvent(this);
                        }
                }
        }
 
        protected void handleException(Exception e) {
-               super.handleException(e);
                element_image.unloadImage(postRunnable);
                text_height.setNumber(0);
                text_width.setNumber(0);
-               
+
                element_image.loadImage(new Runnable(){
-                       public void run() {
-                               StoreUtil.reflowDetailsViewer();
-                               StoreUtil.reflowSupplementalViewer();
+                       @Override
+            public void run() {
+                               AbstractUtility.reflowDetailsViewer();
+                               AbstractUtility.reflowSupplementalViewer();
                        }
                });
        }
index e5e90cc801bbc9a9d93d3a251815825959cd80d7..e05ed4064260e68d770df99dec3a5c11e950a8bd 100644 (file)
@@ -9,7 +9,6 @@
 */
 package eu.etaxonomy.taxeditor.ui.section.media;
 
-import java.net.URISyntaxException;
 import java.util.List;
 import java.util.Set;
 
@@ -19,7 +18,6 @@ import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
 import eu.etaxonomy.cdm.model.media.MediaUtils;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
@@ -41,26 +39,16 @@ public class MediaDetailElement extends AbstractCdmDetailElement<Media>{
     private ICdmFormElement parentFormElement;
     private int style;
 
-    /**
-     * @param formFactory
-     * @param formElement
-     */
     public MediaDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
         super(formFactory, formElement);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, java.lang.Object, int)
-     */
     @Override
     protected void createControls(ICdmFormElement formElement, Media entity, int style) {
         this.parentFormElement = formElement;
         this.style = style;
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#setEntity(java.lang.Object)
-     */
     @Override
     public void setEntity(Media entity) {
         super.setEntity(entity);
@@ -71,29 +59,20 @@ public class MediaDetailElement extends AbstractCdmDetailElement<Media>{
         showAdvancedView();
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
-     */
     @Override
-    public void handleEvent(Object eventSource) {
+    public void handleEvent(Object eventSource){
         if(eventSource==textUri){
             textUri.setBackground(getPersistentBackground());
-            try {
-                singleMediaRepresentationPart.setUri(textUri.getUri());
-            } catch (URISyntaxException e) {
-                textUri.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
-            }
+            singleMediaRepresentationPart.setUri(textUri.getUri());
         }
     }
 
     public void toggleAdvancedMediaView(){
         isAdvancedMediaView = !isAdvancedMediaView;
         showAdvancedView();
+        reflowParentScrolledForm(true);
     }
 
-    /**
-     * @param showAdvancedView
-     */
     private void showAdvancedView() {
         if(isAdvancedMediaView){
             if(textUri!=null){
@@ -133,9 +112,6 @@ public class MediaDetailElement extends AbstractCdmDetailElement<Media>{
         isAdvancedMediaView =  false;
     }
 
-    /**
-     * @return
-     */
     public boolean isAdvancedMediaView() {
         return isAdvancedMediaView;
     }
index 689ba614669830c906c656175e38ef7fb31fd7b7..517e9cfd36504917d02a711a9d1e9535d3a1b8fb 100644 (file)
@@ -3,13 +3,18 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.media;
 
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
 
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
@@ -21,56 +26,36 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
- * <p>
- * MediaElement class.
- * </p>
- *
  * @author n.hoffmann
  * @created Nov 17, 2009
  * @version 1.0
  */
-public class MediaMetaElement extends AbstractEntityCollectionElement<Media> {
+public class MediaMetaElement extends AbstractEntityCollectionElement<Media> implements ITogglableMediaElement{
 
     private EntitySelectionElement<AgentBase> selection_artist;
     private LanguageStringWithLabelElement text_description;
     private LanguageStringWithLabelElement text_title;
     private MediaDetailElement mediaDetailElement;
 
-    /**
-     * <p>
-     * Constructor for MediaElement.
-     * </p>
-     *
-     * @param formElement
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-     *            object.
-     * @param element
-     *            a {@link eu.etaxonomy.cdm.model.media.Media} object.
-     * @param removeListener
-     *            a {@link org.eclipse.swt.events.SelectionListener} object.
-     * @param style
-     *            a int.
-     * @param cdmFormFactory
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-     *            object.
-     */
     public MediaMetaElement(CdmFormFactory cdmFormFactory,
             AbstractFormSection<?> formElement, Media element,
             SelectionListener removeListener, boolean isChoosableEntity, int style) {
         super(cdmFormFactory, formElement, element, removeListener, isChoosableEntity, null, style);
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite
-     * #createControls(org.eclipse.swt.widgets.Composite, int)
-     */
     /** {@inheritDoc} */
     @Override
     public void createControls(ICdmFormElement element, int style) {
-
+        final IAction switchAction = MediaViewSwitch.createSwitch(MediaMetaElement.this);
+        Button btnToggleAdvancedMediaView = new Button(getBox(), style);
+        btnToggleAdvancedMediaView.setToolTipText(switchAction.getText());
+        btnToggleAdvancedMediaView.setImage(ImageResources.getImage(ImageResources.SWITCH_VIEW_TYPE));
+        btnToggleAdvancedMediaView.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                switchAction.run();
+            }
+        });
         text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
         selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style);
         text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
@@ -98,25 +83,16 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> {
         text_title.setLanguageString(title);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#selectFromDialog()
-     */
     @Override
     protected Media selectFromDialog() {
         return MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
     }
 
+    @Override
     public void toggleAdvancedMediaView(){
         mediaDetailElement.toggleAdvancedMediaView();
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
-     * (java.lang.Object)
-     */
     /** {@inheritDoc} */
     @Override
     public void handleEvent(Object eventSource) {
@@ -132,10 +108,4 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> {
         }
     }
 
-    /**
-     * @return
-     */
-    public boolean isAdvancedMediaView() {
-        return mediaDetailElement.isAdvancedMediaView();
-    }
 }
index 6a7b2f2832d701b872558711e02d2e0971b49922..348b472ea9fdbeb3729504a3c753289999e72d5e 100644 (file)
@@ -42,15 +42,6 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement<
        private TextWithLabelElement text_mimeType;
        private TextWithLabelElement text_suffix;
 
-       /**
-        * <p>Constructor for MediaRepresentationElement.</p>
-        *
-        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param element a {@link eu.etaxonomy.cdm.model.media.MediaRepresentation} object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        */
        public MediaRepresentationElement(CdmFormFactory cdmFormFactory,
                        AbstractFormSection section,
                        MediaRepresentation element, SelectionListener removeListener,
@@ -58,9 +49,6 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement<
                super(cdmFormFactory, section, element, removeListener, null, style);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
-        */
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
@@ -79,10 +67,6 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement<
                text_suffix.setText(element.getSuffix());
        }
 
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
-        */
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource) {
index a5ef673414987ed2965ce762c3d0cc092dd6459b..5a295254788c851528ec31c0a1eb5e141f4d2b17 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.
 */
@@ -13,16 +13,14 @@ package eu.etaxonomy.taxeditor.ui.section.media;
 import java.net.URI;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.LabelElement;
 import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 
 /**
@@ -35,36 +33,22 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 public class MediaRepresentationPartElement<T extends MediaRepresentationPart> extends
                AbstractEntityCollectionElement<T> {
 
-       protected TextWithLabelElement text_uri;
+       protected UriWithLabelElement text_uri;
        protected NumberWithLabelElement text_size;
 
-       protected LabelElement element_messages;
-       
-       /**
-        * <p>Constructor for AbstractMediaRepresentationPartElement.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param element a T object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        * @param <T> a T object.
-        */
        public MediaRepresentationPartElement(CdmFormFactory formFactory,
                        AbstractFormSection section,
                        T element, SelectionListener removeListener,
                        int style) {
                super(formFactory, section, element, removeListener, null, style);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
-               text_uri = formFactory.createTextWithLabelElement(element, "URI", null, style);
+               text_uri = formFactory.createUriWithLabelElement(element, "URI", null, style);
                text_size = formFactory.createNumberTextWithLabelElement(element, "Size", null, style);
                text_size.setEnabled(false);
-               
-               element_messages = formFactory.createLabel(element, "");
        }
 
        @Override
@@ -76,27 +60,15 @@ public class MediaRepresentationPartElement<T extends MediaRepresentationPart> e
                if(entity.getUri() != null){
                        text_uri.setText(entity.getUri().toString());
                }
-               element_messages.setText("We currrently do not know how to display this generic MediaRepresentationPart to you.");
        }
 
        @Override
        public void handleEvent(Object eventSource) {
                if(eventSource == text_uri){
-                       try {
-                               String uriString = text_uri.getText();
-                               URI uri = StringUtils.isNotEmpty(uriString) ? new URI(uriString) : null;
-                               getEntity().setUri(uri);
-                       } catch (Exception e) {
-                               handleException(e);
-                       } finally {                             
-                               firePropertyChangeEvent(this);
-                       }
-               } 
-       }
-       
-       protected void handleException(Exception e) {
-               element_messages.setText(e.getMessage());
-               text_size.setText("");
+                   URI uri = text_uri.getUri();
+                   getEntity().setUri(uri);
+                   firePropertyChangeEvent(this);
+               }
        }
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java
new file mode 100644 (file)
index 0000000..ce598fb
--- /dev/null
@@ -0,0 +1,45 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.taxeditor.ui.section.media;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+
+import eu.etaxonomy.taxeditor.model.ImageResources;
+
+/**
+ * Adds a switch to a section with an {@link ITogglableMediaElement}
+ * to allow switching between simple and advanced media view
+ * @author pplitzner
+ * @date Jun 29, 2015
+ *
+ */
+public class MediaViewSwitch {
+
+    /**
+     * Creates an {@link IAction} for the given {@link ITogglableMediaElement}
+     * that switches between the two states of the element.
+     */
+    public static IAction createSwitch(final ITogglableMediaElement togglableMediaElement) {
+        final String label = "Change View Type";
+
+        Action switchAction = new Action(label, ImageResources.getImageDescriptor(ImageResources.SWITCH_VIEW_TYPE)) {
+            @Override
+            public void run() {
+                if(togglableMediaElement!=null){
+                    togglableMediaElement.toggleAdvancedMediaView();
+                }
+            }
+        };
+        switchAction.setToolTipText(label);
+
+        return switchAction;
+    }
+}
index 38b14a29cc8b4946762908aa1bdffe1407605d54..9e672a485ac361830c7c647b95f06918d24bdd08 100644 (file)
@@ -69,24 +69,24 @@ public class AuthorshipDetailElement extends
                if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
                        toggleable_cache.setVisible(false);
                }
-               selectionCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
+               selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
                                getConversationHolder(),
                                formElement, "Author",
-                               entity.getCombinationAuthorTeam(),
+                               entity.getCombinationAuthorship(),
                                EntitySelectionElement.ALL, style);
                addElement(selectionCombinationAuthor);
-               selectionExCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
+               selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
                                getConversationHolder(),
                                formElement, "Ex Author",
-                               entity.getExCombinationAuthorTeam(),
+                               entity.getExCombinationAuthorship(),
                                EntitySelectionElement.ALL, style);
                addElement(selectionExCombinationAuthor);
-               selectionBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
-                formElement, "Basionym Author", entity.getBasionymAuthorTeam(),
+               selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+                formElement, "Basionym Author", entity.getBasionymAuthorship(),
                 EntitySelectionElement.ALL, style);
                addElement(selectionBasionymAuthor);
-               selectionExBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
-                       formElement, "Ex Basionym Author", entity.getExBasionymAuthorTeam(),
+               selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+                       formElement, "Ex Basionym Author", entity.getExBasionymAuthorship(),
                        EntitySelectionElement.ALL, style);
 
                addElement(selectionExBasionymAuthor);
@@ -121,16 +121,16 @@ public class AuthorshipDetailElement extends
                                                Arrays.asList(new Object[] { toggleable_cache }));
                        }
                } else if (eventSource == selectionCombinationAuthor) {
-                       getEntity().setCombinationAuthorTeam(
+                       getEntity().setCombinationAuthorship(
                                        selectionCombinationAuthor.getSelection());
                } else if (eventSource == selectionExCombinationAuthor) {
-                       getEntity().setExCombinationAuthorTeam(
+                       getEntity().setExCombinationAuthorship(
                                        selectionExCombinationAuthor.getSelection());
                } else if (eventSource == selectionBasionymAuthor) {
-                       getEntity().setBasionymAuthorTeam(
+                       getEntity().setBasionymAuthorship(
                                        selectionBasionymAuthor.getSelection());
                } else if (eventSource == selectionExBasionymAuthor) {
-                       getEntity().setExBasionymAuthorTeam(
+                       getEntity().setExBasionymAuthorship(
                                        selectionExBasionymAuthor.getSelection());
                }
 
index a11e8e43bb55e870e4f6de962e502564edeabd07..aa7a3ef6b84a3e12599efb74d08028327ac6d30d 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.
 */
@@ -11,7 +11,6 @@
 package eu.etaxonomy.taxeditor.ui.section.name;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 
 import org.eclipse.swt.events.SelectionListener;
 
@@ -22,14 +21,13 @@ import eu.etaxonomy.cdm.model.media.MediaRepresentation;
 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
 import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 
@@ -42,9 +40,9 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
  */
 public class ProtologueElement extends AbstractEntityCollectionElement<DescriptionElementBase> implements ISelectableElement, IOpenUrlEnabled{
 
-       private SelectionArbitrator selectionArbitrator;
+       private final SelectionArbitrator selectionArbitrator;
 
-       private TextWithLabelElement protologueUriText;
+       private UriWithLabelElement protologueUriText;
        private MediaRepresentationPart mediaRepresentationPart;
        private Media media;
        private MediaRepresentation mediaRepresentation;
@@ -64,104 +62,79 @@ public class ProtologueElement extends AbstractEntityCollectionElement<Descripti
                selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
-        */
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
-               protologueUriText = formFactory.createTextWithLabelElement(this, "Protologue URI", "", style);
+               protologueUriText = formFactory.createUriWithLabelElement(element, "Protologue URI", null, style);
 
                formFactory.createOpenUrlSelectorElement(element, "Query BHL for Reference Image", this, style);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
-        */
        /** {@inheritDoc} */
        @Override
        public void setEntity(DescriptionElementBase element) {
                this.entity = element;
-                               
+
                if(element.getMedia().size() == 0){
                        element.addMedia(Media.NewInstance());
                }
                media = element.getMedia().iterator().next();
-               
+
                if(media.getRepresentations().size() == 0){
                        media.addRepresentation(MediaRepresentation.NewInstance());
-               }               
+               }
                mediaRepresentation = media.getRepresentations().iterator().next();
-               
+
                if(mediaRepresentation.getParts().size() == 0){
                        mediaRepresentation.addRepresentationPart(MediaRepresentationPart.NewInstance(null, null));
                }
-               
+
                mediaRepresentationPart = mediaRepresentation.getParts().iterator().next();
-               
+
                if(mediaRepresentationPart.getUri() != null){
                        protologueUriText.setText(mediaRepresentationPart.getUri().toString());
                }
        }
-       
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#getSelectionArbitrator()
-        */
+
        /**
         * <p>Getter for the field <code>selectionArbitrator</code>.</p>
         *
         * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} object.
         */
-       public SelectionArbitrator getSelectionArbitrator() {
+       @Override
+    public SelectionArbitrator getSelectionArbitrator() {
                return selectionArbitrator;
        }
-       
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
-        */
+
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource) {
-               if(eventSource == protologueUriText){
-                       try {
-                               mediaRepresentationPart.setUri(new URI(protologueUriText.getText()));
-                       } catch (URISyntaxException e) {
-                               MessagingUtils.warningDialog("Could not parse URI", getClass(), e.getMessage());
-                       }
-               }       
+               if(eventSource == protologueUriText && protologueUriText.getText()!=null){
+                   mediaRepresentationPart.setUri(protologueUriText.getUri());
+               }
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.openurl.IOpenUrlEnabled#setOpenUrl(java.net.URI)
-        */
        @Override
        public void setOpenUrl(URI uri) {
                protologueUriText.setText(uri.toString());
                firePropertyChangeEvent(new CdmPropertyChangeEvent(protologueUriText, null));
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.openurl.IOpenUrlEnabled#getReference()
-        */
        @Override
        public Reference getReference() {
                return (Reference) getName().getNomenclaturalReference();
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.openurl.IOpenUrlEnabled#getDetail()
-        */
        @Override
        public String getDetail() {
                return getName().getNomenclaturalMicroReference();
        }
-       
+
        private TaxonNameBase getName(){
                TaxonNameDescription description = (TaxonNameDescription) entity.getInDescription();
-               
+
                TaxonNameBase taxonName = description.getTaxonName();
-               
+
                return taxonName;
        }
 }
index 99e0951c3d3fe292dac00e8d7baae5c7bfb26328..1e8d0f10ff3f686e7a6e057d47954d2ff5331e7e 100644 (file)
@@ -9,8 +9,8 @@
 */
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
@@ -67,7 +67,7 @@ public abstract class AbstractUnboundEntityCollectionSection<ENTITY, ELEMENT> ex
         Collection<ELEMENT> elements = getEntityCollection(entity);
         if(addUnboundElement){
             //cloning to avoid saving the dummy element
-            Collection<ELEMENT> clonedElements = new HashSet<ELEMENT>();
+            Collection<ELEMENT> clonedElements = new ArrayList<ELEMENT>();
             clonedElements.addAll(elements);
             clonedElements.add(createNewElement()); //add dummy element which is not bound to entity
             return clonedElements;
index 2cbf45f6bee259a6eac4a1096ad76c94a78d630d..677252846b6e1e3e3518b51c84fb08dd6d532364 100644 (file)
@@ -9,20 +9,12 @@
 */
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
-import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.agent.Institution;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.common.TermType;
-import eu.etaxonomy.cdm.model.common.TimePeriod;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
-import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
+import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
@@ -33,100 +25,37 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
-    private EntitySelectionElement<Institution> selectionInstitution;
-    private EntitySelectionElement<AgentBase> selectionStaff;
-    private TimePeriodElement datePreparationDate;
-    private NumberWithLabelElement numberPreservationTemperature;
-    private TermComboElement<DefinedTerm> comboMaterialOrMethods;
+
+    private EntitySelectionElement<Collection> selection_collection;
     private TextWithLabelElement textBarcode;
     private CheckboxElement checkIsPublish;
 
-    /**
-     * @param formFactory
-     * @param formElement
-     */
     public DnaSampleGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
         super(formFactory, formElement);
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-     */
     @Override
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
-        Institution institution = null;
-        AgentBase<?> staff = null;
-        TimePeriod preparationDate = null;
-        if(entity.getDerivedFrom()!=null){
-            institution = entity.getDerivedFrom().getInstitution();
-            staff = entity.getDerivedFrom().getActor();
-            preparationDate = entity.getDerivedFrom().getTimeperiod();
-        }
-
-        Double temperature = null;
-        DefinedTerm definedMaterialOrMethod = null;
-        if(entity.getPreservation()!=null){
-            temperature = entity.getPreservation().getTemperature();
-            definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
-        }
-        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", institution, EntitySelectionElement.ALL, style);
-        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
-        datePreparationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
-        numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
-        comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
+        selection_collection = formFactory
+                .createSelectionElement(Collection.class,
+                        getConversationHolder(), formElement, "Collection",
+                        entity.getCollection(),
+                        EntitySelectionElement.ALL, style);
         textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
         checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.isPublish(), style);
 
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-     * .lang.Object)
-     */
     @Override
     public void handleEvent(Object eventSource) {
-        if(eventSource==datePreparationDate){
-            if(getEntity().getDerivedFrom()!=null){
-                getEntity().getDerivedFrom().setTimeperiod(datePreparationDate.getTimePeriod());
-            }
-        }
-        else if(eventSource==selectionInstitution){
-            if(getEntity().getDerivedFrom()!=null){
-                getEntity().getDerivedFrom().setInstitution(selectionInstitution.getSelection());
-            }
-        }
-        else if(eventSource==selectionStaff){
-            if(getEntity().getDerivedFrom()!=null){
-                getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
-            }
-        }
-        else if(eventSource==numberPreservationTemperature){
-            addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
-        }
-        else if(eventSource==comboMaterialOrMethods){
-            addPreservationMethod().setDefinedMaterialOrMethod(comboMaterialOrMethods.getSelection());
-        }
-        else if(eventSource==textBarcode){
+        if(eventSource==textBarcode){
             getEntity().setBarcode(textBarcode.getText());
         }
         else if(eventSource==checkIsPublish){
             getEntity().setPublish(checkIsPublish.getSelection());
+        } else if (eventSource == selection_collection) {
+            getEntity().setCollection(selection_collection.getSelection());
         }
     }
 
-    private PreservationMethod addPreservationMethod(){
-        PreservationMethod preservationMethod = getEntity().getPreservation();
-        if(preservationMethod==null){
-            preservationMethod = PreservationMethod.NewInstance();
-            getEntity().setPreservation(preservationMethod);
-        }
-        return preservationMethod;
-    }
 }
index f9b48e1784147b43e4752e8f9eac718467a35b40..d78b363ba2f5c267b0cea2b97fd823d7a98723e5 100644 (file)
@@ -25,13 +25,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
  */
 public class DnaSampleGeneralDetailSection extends AbstractCdmDetailSection<DnaSample> {
 
-    /**
-     * @param formFactory
-     * @param conversation
-     * @param parentElement
-     * @param selectionProvider
-     * @param style
-     */
     public DnaSampleGeneralDetailSection(CdmFormFactory formFactory,
             ConversationHolder conversation, ICdmFormElement parentElement,
             ISelectionProvider selectionProvider, int style) {
@@ -39,17 +32,11 @@ public class DnaSampleGeneralDetailSection extends AbstractCdmDetailSection<DnaS
     }
 
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
-     */
     @Override
     public String getHeading() {
         return "General";
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
-     */
     @Override
     protected AbstractCdmDetailElement<DnaSample> createCdmDetailElement(AbstractCdmDetailSection<DnaSample> parentElement, int style) {
         return formFactory.createDnaSampleGeneralDetailElement(parentElement);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSamplePreparationPreservationDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSamplePreparationPreservationDetailElement.java
new file mode 100644 (file)
index 0000000..f31ad03
--- /dev/null
@@ -0,0 +1,121 @@
+
+// $Id$
+/**
+ * Copyright (C) 2013 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.taxeditor.ui.section.occurrence.dna;
+
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
+import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 16.12.2013
+ *
+ */
+public class DnaSamplePreparationPreservationDetailElement extends AbstractCdmDetailElement<DnaSample> {
+
+    private EntitySelectionElement<Institution> selectionInstitution;
+    private EntitySelectionElement<AgentBase> selectionStaff;
+    private TimePeriodElement datePreparationDate;
+    private NumberWithLabelElement numberPreservationTemperature;
+    private TextWithLabelElement txtMaterialOrMethods;
+
+    /**
+     * @param formFactory
+     * @param formElement
+     */
+    public DnaSamplePreparationPreservationDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+        super(formFactory, formElement);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
+     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
+     */
+    @Override
+    protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
+        Institution institution = null;
+        AgentBase<?> staff = null;
+        TimePeriod preparationDate = null;
+        if(entity.getDerivedFrom()!=null){
+            institution = entity.getDerivedFrom().getInstitution();
+            staff = entity.getDerivedFrom().getActor();
+            preparationDate = entity.getDerivedFrom().getTimeperiod();
+        }
+
+        Double temperature = null;
+        String materialOrMethodText = null;
+        if(entity.getPreservation()!=null){
+            temperature = entity.getPreservation().getTemperature();
+        }
+        if(entity.getDerivedFrom()!=null){
+            materialOrMethodText = entity.getDerivedFrom().getDescription();
+        }
+        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", institution, EntitySelectionElement.ALL, style);
+        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
+        datePreparationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
+        numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
+        txtMaterialOrMethods = formFactory.createTextWithLabelElement(formElement, "Materials && Methods", materialOrMethodText, style);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+     * .lang.Object)
+     */
+    @Override
+    public void handleEvent(Object eventSource) {
+        if(eventSource==datePreparationDate){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setTimeperiod(datePreparationDate.getTimePeriod());
+            }
+        }
+        else if(eventSource==selectionInstitution){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setInstitution(selectionInstitution.getSelection());
+            }
+        }
+        else if(eventSource==selectionStaff){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
+            }
+        }
+        else if(eventSource==numberPreservationTemperature && numberPreservationTemperature.getText()!=null){
+            addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
+        }
+        else if(eventSource==txtMaterialOrMethods && getEntity().getDerivedFrom()!=null){
+            getEntity().getDerivedFrom().setDescription(txtMaterialOrMethods.getText());
+        }
+    }
+
+    private PreservationMethod addPreservationMethod(){
+        PreservationMethod preservationMethod = getEntity().getPreservation();
+        if(preservationMethod==null){
+            preservationMethod = PreservationMethod.NewInstance();
+            getEntity().setPreservation(preservationMethod);
+        }
+        return preservationMethod;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSamplePreparationPreservationSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSamplePreparationPreservationSection.java
new file mode 100644 (file)
index 0000000..92de412
--- /dev/null
@@ -0,0 +1,44 @@
+// $Id$
+/**
+* Copyright (C) 2013 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.taxeditor.ui.section.occurrence.dna;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 12.12.2013
+ *
+ */
+public class DnaSamplePreparationPreservationSection extends AbstractCdmDetailSection<DnaSample> {
+
+    public DnaSamplePreparationPreservationSection(CdmFormFactory formFactory,
+            ConversationHolder conversation, ICdmFormElement parentElement,
+            ISelectionProvider selectionProvider, int style) {
+        super(formFactory, conversation, parentElement, selectionProvider, style);
+    }
+
+
+    @Override
+    public String getHeading() {
+        return "Preparation/Preservation";
+    }
+
+    @Override
+    protected AbstractCdmDetailElement<DnaSample> createCdmDetailElement(AbstractCdmDetailSection<DnaSample> parentElement, int style) {
+        return formFactory.createDnaSamplePreparationPreservationDetailElement(parentElement);
+    }
+}
index a2bd6682895f9d67a23a098204c862a69eaf85f4..0b6e10994d7067703c0577ffe08a6a1d32b54553 100644 (file)
@@ -31,39 +31,12 @@ public class SequenceReferenceCollectionDetailElement extends AbstractEntityColl
     protected EntitySelectionElement<Reference> selection_reference;
     protected TextWithLabelElement text_referenceDetail;
 
-    /**
-     * <p>
-     * Constructor for AbstractReferencedEntityElement.
-     * </p>
-     *
-     * @param formFactory
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-     *            object.
-     * @param section
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-     *            object.
-     * @param entity
-     *            a T object.
-     * @param removeListener
-     *            a {@link org.eclipse.swt.events.SelectionListener} object.
-     * @param style
-     *            a int.
-     * @param <T>
-     *            a T object.
-     */
     public SequenceReferenceCollectionDetailElement(CdmFormFactory formFactory,
             AbstractFormSection<?> section, Reference<?> entity,
             SelectionListener removeListener, int style) {
         super(formFactory, section, entity, removeListener, null, style);
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#
-     * createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
-     */
     /** {@inheritDoc} */
     @Override
     public void createControls(ICdmFormElement formElement, int style) {
@@ -75,14 +48,6 @@ public class SequenceReferenceCollectionDetailElement extends AbstractEntityColl
                 formElement, "Reference Detail", null, SWT.NULL);
     }
 
-    /**
-     * <p>
-     * setEntity
-     * </p>
-     *
-     * @param entity
-     *            a T object.
-     */
     @Override
     public void setEntity(Reference<?> entity) {
         this.entity = entity;
@@ -90,9 +55,6 @@ public class SequenceReferenceCollectionDetailElement extends AbstractEntityColl
         text_referenceDetail.setText(entity.getReferenceAbstract());
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
-     */
     @Override
     public void handleEvent(Object eventSource) {
         if(eventSource==selection_reference){
index 0f6000b34a90e585d58d10cdddfe896ddcb65be1..840631c75643c6a50e5558efa115d0a5dd977484 100644 (file)
@@ -32,6 +32,7 @@ import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.media.ITogglableMediaElement;
 import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
@@ -40,7 +41,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  * @date 16.12.2013
  *
  */
-public class MediaSpecimenGeneralDetailElement extends AbstractCdmDetailElement<MediaSpecimen> {
+public class MediaSpecimenGeneralDetailElement extends AbstractCdmDetailElement<MediaSpecimen> implements ITogglableMediaElement{
 
     private final TermVocabulary mediaSpecimenVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.MediaSpecimenKindOfUnit.getUuid());
 
@@ -63,13 +64,6 @@ public class MediaSpecimenGeneralDetailElement extends AbstractCdmDetailElement<
         super(formFactory, formElement);
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-     */