add media bulk editor see #4730
authorKatja Luther <k.luther@bgbm.org>
Thu, 10 Mar 2016 12:02:24 +0000 (13:02 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 10 Mar 2016 12:02:24 +0000 (13:02 +0100)
12 files changed:
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages.properties
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/messages_de.properties
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorLables.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorPropertyTester.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/BulkEditorInputType.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/MediaEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/Messages.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/MediaCreator.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.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/media/MediaMetaElement.java

index 816633c1755ba03a9e51dcf117952e161ddb20e5..2250072f6e6ce7ae774be79a11d1b57234f1f32e 100644 (file)
@@ -6,3 +6,4 @@ BulkEditorInputType_4=Specimen and Observations
 BulkEditorInputType_5=Users\r
 BulkEditorInputType_6=Groups\r
 BulkEditorInputType_7=Taxa\r
+BulkEditorInputType_8=Media\r
index 56a3c86fcbdf9e5c9b2e8d8249b68fee61ccd16b..4bf7416ffc36876518d48d4d323cd148c2922b75 100644 (file)
@@ -6,3 +6,4 @@ BulkEditorInputType_4=Belege und Beobachtungen
 BulkEditorInputType_5=Nutzer\r
 BulkEditorInputType_6=Nutzergruppen\r
 BulkEditorInputType_7=Taxa\r
+BulkEditorInputType_8=Medien
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorLables.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorLables.java
new file mode 100644 (file)
index 0000000..7a230c5
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+       * Copyright (C) 2016 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.bulkeditor;
+/**
+ * @author kluther
+ * @date 29 Feb 2016
+ *
+ */
+public interface BulkEditorLables {
+       
+
+
+           public static final String CONVERT_TEAM_2_PERSON_LABEL = "Convert Team to Person";
+           public static final String CONVERT_PERSON_2_TEAM_LABEL = "Convert Person to Team";
+           public static final String DELETE_LABEL = "Delete";
+           public static final String MERGE_GROUP_LABEL = "Merge Group";
+           public static final String REMOVE_MERGE_CANDIDATE_LABEL = "Remove from Merge Group";
+           public static final String SET_MERGE_CANDIDATE_LABEL = "Set as Merge Candidate";
+           public static final String SET_MERGE_TARGET_LABEL = "Set as Merge Target";
+
+           public static final String NO_CONVERT_PERSON_TO_TEAM_MESSAGE = "Can not convert Person into a Team.";
+           public static final String TRANSFORMATION_NOT_POSSIBLE_PERSON_PART_OF_TEAM_MESSAGE = "Person can not be transformed into team as it is already part of a team.";
+           public static final String NO_CONVERT_TEAM_TO_PERSON_MESSAGE = "Can not convert Team to Person";
+          
+          
+           public static final String UNSAVED_CHANGES_MESSAGE = "There are unsaved changes in the source taxon. Please save first.";
+               public static final String SINGLE_PERSON_SELECTION_MESSAGE = "The chosen operation is available only for a single person";
+               public static final String SINGLE_TEAM_SELECTION_MESSAGE = "The chosen operation is available only for a single team";
+               public static final String NO_PERSON_SELECTION_MESSAGE = "No person selected for conversion";
+               public static final String ONLY_PERSON_SELECTION_MESSAGE = "Only a person can be converted into a team.";
+               public static final String NO_TEAM_SELECTION_MESSAGE = "No team selected for conversion";
+               public static final String ONLY_TEAM_SELECTION_MESSAGE = "Only a team can be converted into a person.";
+               public static final String ONLY_FOR_BULKEDITOR_MESSAGE = "You have to choose a line in the bulkeditor to perform this operation.";
+
+
+
+       
+
+}
index bd8494c00e191d78ae57d11ed21123cd58d5c243..bbfe04df5fd667756cad809a46a1dec119c85e39 100644 (file)
@@ -17,6 +17,7 @@ import org.eclipse.ui.IEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.MediaEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
 
@@ -41,6 +42,7 @@ public class BulkEditorPropertyTester extends PropertyTester {
     public static final String IS_CONVERT_ENABLED = "isConvertingEnabled";
     public static final String IS_PERSON = "isPerson";
     public static final String IS_TEAM = "isTeam";
+    public static final String IS_MEDIA_EDITOR = "isMediaEditor";
        /* (non-Javadoc)
         * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
         */
@@ -72,6 +74,8 @@ public class BulkEditorPropertyTester extends PropertyTester {
                }
         else if(IS_TAXON_EDITOR.equals(property)){
             return bulkEditor.getEditorInput() instanceof TaxonEditorInput;
+        } else if(IS_MEDIA_EDITOR.equals(property)){
+            return bulkEditor.getEditorInput() instanceof MediaEditorInput;
         }
 
 //             if (("isPublishFlagEditingEnabled").equals(property)) {
index 4cb892e67eb9c4f0e08f57343c0149aaf5231d6f..6af7651f756f3239b77eaccdfdd335c1e77824f2 100644 (file)
@@ -81,7 +81,7 @@ public class OpenBulkEditorContributionItem extends CompoundContributionItem {
         contributionItems.add(new Separator(groupName));
         contributionItems.add(BulkEditorInputType.USER.createContributionItem());
         contributionItems.add(BulkEditorInputType.GROUP.createContributionItem());
-        
+        contributionItems.add(BulkEditorInputType.MEDIA.createContributionItem());
         return contributionItems.toArray(new IContributionItem[contributionItems.size()]);
     }
 
index cb7020b31117300c060f6101c4e07fecb1344f01..a509aecbddfa4e436d9563d672c08961f26275f0 100644 (file)
@@ -1,7 +1,6 @@
 package eu.etaxonomy.taxeditor.bulkeditor.input;
 
 import java.util.HashMap;
-import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
 
@@ -14,6 +13,7 @@ import org.eclipse.ui.menus.CommandContributionItemParameter;
 
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
@@ -22,38 +22,38 @@ import eu.etaxonomy.cdm.api.service.IUserService;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.name.NameRelationship;
 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.Taxon;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 public enum BulkEditorInputType {
-       AGENT(Messages.BulkEditorInputType_0, AgentEditorInput.ID), 
-       REFERENCE(Messages.BulkEditorInputType_1, ReferenceEditorInput.ID), 
-       NAME(Messages.BulkEditorInputType_2, NameEditorInput.ID), 
-       NAME_RELATIONSHIP(Messages.BulkEditorInputType_3, NameRelationshipEditorInput.ID), 
-       OCCURRENCE(Messages.BulkEditorInputType_4, OccurrenceEditorInput.ID), 
-       USER(Messages.BulkEditorInputType_5, UserEditorInput.ID), 
+       AGENT(Messages.BulkEditorInputType_0, AgentEditorInput.ID),
+       REFERENCE(Messages.BulkEditorInputType_1, ReferenceEditorInput.ID),
+       NAME(Messages.BulkEditorInputType_2, NameEditorInput.ID),
+       NAME_RELATIONSHIP(Messages.BulkEditorInputType_3, NameRelationshipEditorInput.ID),
+       OCCURRENCE(Messages.BulkEditorInputType_4, OccurrenceEditorInput.ID),
+       USER(Messages.BulkEditorInputType_5, UserEditorInput.ID),
        GROUP(Messages.BulkEditorInputType_6, GroupEditorInput.ID),
-       TAXON(Messages.BulkEditorInputType_7, TaxonEditorInput.ID);
+       TAXON(Messages.BulkEditorInputType_7, TaxonEditorInput.ID),
+       MEDIA(Messages.BulkEditorInputType_8, MediaEditorInput.ID);
 
        public String id;
        public String label;
-       public ResourceBundle resourceBundle; 
+       public ResourceBundle resourceBundle;
 
        BulkEditorInputType(String label, String id) {
                this.id = id;
                this.label = label;
        }
 
-       public IContributionItem createContributionItem(){ 
+       public IContributionItem createContributionItem(){
                return createContributionItem(label, id);
        }
-       
+
        /**
         * @param key
         * @param object
@@ -73,7 +73,7 @@ public enum BulkEditorInputType {
 
                return new CommandContributionItem(parameter);
        }
-       
+
        public static BulkEditorInputType getById(String id) {
 
                for (BulkEditorInputType type : values()) {
@@ -102,7 +102,9 @@ public enum BulkEditorInputType {
                        return USER;
                } else if (Taxon.class.isAssignableFrom(clazz)){
                        return TAXON;
-               }
+               } else if (Media.class.isAssignableFrom(clazz)){
+            return MEDIA;
+        }
                return null;
        }
 
@@ -123,7 +125,9 @@ public enum BulkEditorInputType {
                        return GROUP;
                } else if (input instanceof TaxonEditorInput){
                        return TAXON;
-               }
+               }else if (input instanceof MediaEditorInput){
+            return MEDIA;
+        }
                return null;
        }
 
@@ -146,12 +150,14 @@ public enum BulkEditorInputType {
                        return new GroupEditorInput();
                case TAXON:
                        return new TaxonEditorInput();
+               case MEDIA:
+            return new MediaEditorInput();
                default:
                        throw new IllegalStateException(
                                        "No input class for the given input type defined."); //$NON-NLS-1$
                }
        }
-       
+
        public static Class getServiceClass(
                        BulkEditorInputType inputType) {
                switch (inputType) {
@@ -171,6 +177,8 @@ public enum BulkEditorInputType {
                        return IGroupService.class;
                case TAXON:
                        return ITaxonService.class;
+               case MEDIA:
+            return IMediaService.class;
                default:
                        throw new IllegalStateException(
                                        "No input class for the given input type defined."); //$NON-NLS-1$
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/MediaEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/MediaEditorInput.java
new file mode 100644 (file)
index 0000000..6f3ccb2
--- /dev/null
@@ -0,0 +1,94 @@
+// $Id$
+/**
+* Copyright (C) 2016 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.bulkeditor.input;
+
+import java.util.List;
+
+import eu.etaxonomy.cdm.api.service.IMediaService;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.MediaCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 10.03.2016
+ *
+ */
+public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
+    public static final String ID = "bulkeditor.input.media";
+
+    private static MediaEditorInput instance;
+
+    public static String getID() {
+        return ID;
+    }
+
+    public static AbstractBulkEditorInput getInstance() {
+        if (instance == null) {
+            instance = new MediaEditorInput();
+        }
+        return instance;
+    }
+
+    @Override
+    public String getName() {
+        return BulkEditorInputType.MEDIA.label;
+    }
+
+    @Override
+    public String getToolTipText() {
+        return getName();
+    }
+
+    @Override
+    public Media save(Media entity) {
+        if(CdmStore.getCurrentSessionManager().isRemoting()) {
+            return CdmStore.getService(IMediaService.class).merge(entity, true).getMergedEntity();
+        } else {
+            CdmStore.getService(IMediaService.class).saveOrUpdate(entity) ;
+            return entity;
+        }
+    }
+
+    @Override
+    public boolean delete(Media entity) throws ReferencedObjectUndeletableException {
+        return CdmStore.getService(IMediaService.class).delete(entity) != null;
+    }
+
+    @Override
+    protected List<Media> listEntities(IIdentifiableEntityServiceConfigurator configurator) {
+        return CdmStore.getSearchManager().findMedia(configurator);
+    }
+
+    @Override
+    protected IEntityCreator<Media> createEntityCreator() {
+        return new MediaCreator();
+    }
+
+    @Override
+    public void merge() {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public List<IBulkEditorSortProvider<Media>> getSortProviders() {
+        List<IBulkEditorSortProvider<Media>> sortProviders = super.getSortProviders();
+
+        sortProviders.add(0, new IdentifiableEntitySortProvider<Media>());
+
+        return sortProviders;
+    }
+}
index 5d046af0ac45737d184e5868700d6f840a7d06f6..1f9f2727381220bd03575f35836311f85a59a200 100644 (file)
@@ -12,6 +12,7 @@ public class Messages extends NLS {
        public static String BulkEditorInputType_5;\r
        public static String BulkEditorInputType_6;\r
        public static String BulkEditorInputType_7;\r
+       public static String BulkEditorInputType_8;\r
        static {\r
                // initialize resource bundle\r
                NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/MediaCreator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/MediaCreator.java
new file mode 100644 (file)
index 0000000..8b28278
--- /dev/null
@@ -0,0 +1,67 @@
+// $Id$
+/**
+* Copyright (C) 2016 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.bulkeditor.input.entitycreator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+
+/**
+ * @author k.luther
+ * @date 10.03.2016
+ *
+ */
+public class MediaCreator implements IEntityCreator<Media> {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Media createEntity(String text) {
+        Media result = Media.NewInstance();
+        result.setTitleCache(text);
+        return result;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Media createEntity(Object key, String text) {
+        if (key.equals(Media.class)){
+            Media result = Media.NewInstance();
+            result.setTitleCache(text);
+            return result;
+        }
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Map<Object, String> getKeyLabelPairs() {
+        Map<Object, String> result = new HashMap<Object, String>();
+       result.put(Media.class, "Media");
+        return result;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean savesEntity() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}
index 40d53766eea518d85a85c9bad2ef757df2c6d506..91ae87e867d50664695c6b8b95667eeb4d01b9a8 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Display;
 
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
@@ -35,6 +36,7 @@ import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.RelationshipBase;
 import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.name.NameRelationship;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
@@ -244,5 +246,14 @@ public class SearchManager {
                return NO_RESULTS;
        }
 
+       public List findMedia(IIdentifiableEntityServiceConfigurator configurator) {
+        if(checkLargeResult(CdmStore.getService(IMediaService.class).countByTitle(configurator))){
+            List<Media> records = CdmStore.getService(IMediaService.class).findByTitle(configurator).getRecords();
+            addUuidSearchResults(records, configurator, IMediaService.class);
+            return records;
+        }
+        return NO_RESULTS;
+    }
+
 
 }
index 328b085939599c0a98963507aef0aa64a08d35e2..08e119acab58d43971d779105b407b49798fb316 100644 (file)
@@ -58,7 +58,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
        private final Composite box;
 
        private Button btnRemove;
-    private Button btnChooseEntity;
+    protected Button btnChooseEntity;
 
        private Color backgroundColor;
 
@@ -101,6 +101,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                if(isChoosableEntity){
                    btnChooseEntity = formFactory.createButton(box, null, SWT.PUSH);
                    addControl(btnChooseEntity);
+                   
                    btnChooseEntity.setLayoutData(LayoutConstants.RIGHT());
                    btnChooseEntity.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
                    btnChooseEntity.setToolTipText("Browse");
@@ -116,6 +117,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                                    ((AbstractEntityCollectionSection)getParentElement()).addElement(entity);
                                    ((AbstractEntityCollectionSection)getParentElement()).firePropertyChangeEvent(getParentElement());
                                }
+                               
                            }
                        }
                    });
@@ -187,7 +189,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                        return;
                }
                Object eventSource = event.getSource();
-               if (getElements().contains(eventSource)) {
+               if (getElements().contains(eventSource) || getControls().contains(eventSource)) {
                        handleEvent(eventSource);
                }
        }
index 361f149e2fc1841db317afc6c129e365345edbf5..706ceb4bcf76cf61b70674f352e7e86f992acd17 100644 (file)
@@ -3,11 +3,15 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.media;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.SWT;
 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 org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
 
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
@@ -25,6 +29,7 @@ import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -48,6 +53,8 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> imp
         if(cdmFormFactory.getSelectionProvider() != null){
             selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
         }
+       
+       
     }
 
     /** {@inheritDoc} */
@@ -65,8 +72,10 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> imp
         });
         text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
         selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style);
+        addElement(selection_artist);
         text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
         mediaDetailElement = formFactory.createMediaDetailElement(element);
+        addElement(mediaDetailElement);
     }
 
     /** {@inheritDoc} */
@@ -84,15 +93,18 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> imp
         LanguageString title = element.getTitle(CdmStore.getDefaultLanguage());
 
         if (title == null) {
-            title = LanguageString.NewInstance("", CdmStore.getDefaultLanguage());
+            title = LanguageString.NewInstance(element.getTitleCache(), CdmStore.getDefaultLanguage());
         }
 
         text_title.setLanguageString(title);
+        
     }
 
     @Override
     protected Media selectFromDialog() {
-        return MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
+       
+       setEntity(MediaSelectionDialog.select(AbstractUtility.getShell(), null, null));
+        return entity;
     }
 
     @Override
@@ -101,7 +113,7 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> imp
     }
 
     /** {@inheritDoc} */
-    @Override
+   @Override
     public void handleEvent(Object eventSource) {
         if (eventSource == selection_artist) {
             getEntity().setArtist(selection_artist.getSelection());