Renaming MediaMetaData to MediaInfo
authorn.hoffmann <n.hoffmann@localhost>
Thu, 9 Jun 2011 09:23:35 +0000 (09:23 +0000)
committern.hoffmann <n.hoffmann@localhost>
Thu, 9 Jun 2011 09:23:35 +0000 (09:23 +0000)
13 files changed:
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedNameContainer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmFormElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractFormSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/ImageElement.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/media/ImageFileElement.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/reference/ReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/AbstractSelectionElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/TranslationWizardPage.java

index d4ccb89a7db249be8a66571074d71d8e4bd53cb4..755dd68acc11f4c3ba52353e20ddde19841148be 100644 (file)
@@ -203,7 +203,7 @@ Export-Package: com.google.api,
    org.aspectj.runtime.internal,
    eu.etaxonomy.cdm.model.common",
  eu.etaxonomy.cdm.common;uses:="org.jdom.output,org.jdom",
- eu.etaxonomy.cdm.common.mediaMetaData,
+ eu.etaxonomy.cdm.common.media,
  eu.etaxonomy.cdm.database;
   uses:="org.springframework.transaction,
    org.apache.log4j,
index 2e28b95ab08d1dc3eaee4d8bf2a5ab8501f9b3b0..4771ca313bbe67a47aa53cfabacf7bbdbdbfd56a 100644 (file)
@@ -10,10 +10,8 @@ package eu.etaxonomy.taxeditor.editor.name.container;
 
 import org.eclipse.swt.graphics.Font;
 
-import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 import eu.etaxonomy.taxeditor.preference.Resources;
 
 /**
index d372d15ff39fcb6e1d7be987ac64784d4a9a1cca..bbc1864b0ae550bdee5c7fd408cf03d4abed0c3d 100644 (file)
@@ -3,6 +3,7 @@
  */
 package eu.etaxonomy.taxeditor.ui.forms;
 
+import java.util.ConcurrentModificationException;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -13,7 +14,6 @@ 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.swt.widgets.Event;
 import org.eclipse.ui.forms.widgets.Section;
 
 import eu.etaxonomy.taxeditor.store.StoreUtil;
@@ -234,9 +234,17 @@ public abstract class AbstractCdmFormElement implements IPropertyChangeEmitter,
        /** {@inheritDoc} */
        public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
                Assert.isNotNull(propertyChangeListeners, "Property change listeners are not present");
-               
-               for(Object listener : propertyChangeListeners){
-                       ((IPropertyChangeListener)listener).propertyChange(event);
+
+               try{
+                       for(Object listener : propertyChangeListeners){
+                               ((IPropertyChangeListener)listener).propertyChange(event);
+                       }
+               }catch(ConcurrentModificationException e){
+                       // There are two cases that produce a CME. 
+                       // Described here: http://dev.e-taxonomy.eu/trac/ticket/2363#comment:2
+                       // and here: http://dev.e-taxonomy.eu/trac/ticket/2438
+                       // Ignoring the CME because nothing bad is happening
+                       StoreUtil.warn(getClass(), "ConcurrentModificationException. Can be ignored.");
                }
        }
        
index 311d7b0cfa64f2a43dcea45c11b1dd7ad70f6fd9..d1587708d4ca1a5956b1836e5e4179525257b971 100644 (file)
@@ -25,7 +25,6 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.TypedListener;
 import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.editors.text.EditorsUI;
 import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 import org.eclipse.ui.forms.widgets.ToggleHyperlink;
@@ -34,6 +33,9 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement;
+import eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement;
+import eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement;
 
 /**
  * <p>Abstract AbstractFormSection class.</p>
@@ -394,7 +396,7 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
                if(formElement == this){
                        return true;
                }else{
-                       for(ICdmFormElement element : getElements()){
+                       for(ICdmFormElement element : getElements()){                           
                                boolean contains = element.containsFormElement(formElement);
                                if(contains == true){
                                        return true;
index c39545b48168a6319210edb3471b726241c6fb59..73c96492bfdde739e64bf5a78189ff1aee6c0f06 100644 (file)
@@ -1481,6 +1481,9 @@ public class CdmFormFactory extends FormToolkit {
         *            object.
         */
        public void addPropertyChangeListener(IPropertyChangeListener listener) {
+               if(propertyChangeListeners.contains(listener)){
+                       return;
+               }
                propertyChangeListeners.add(0, listener);
        }
 
index b3ff73fd460475205f68d2716749ef4805148c2f..2eb8600916ec7294a5592d2cb8a82fb6141ab802 100644 (file)
@@ -156,7 +156,7 @@ public class ImageElement extends AbstractCdmFormElement implements PaintListene
                                        }
                                        monitor.done();                                 
                                }catch (Exception e) {
-                                       StoreUtil.warn(getClass(), e);
+                                       StoreUtil.warn(getClass(), e.getMessage());
                                } 
                        }                                       
                };
index f20cd8780a9ed1cd16b200d0cb9f95331fcca692..ad6b985c04c367847c64db886b880eef9687d0df 100644 (file)
@@ -178,6 +178,7 @@ public abstract class AbstractCdmDetailElement<T> extends
                if(eventSource instanceof ICdmFormElement){
                        ICdmFormElement eventElement = (ICdmFormElement) eventSource;
                        ICdmFormElement eventElementContainer = eventElement.getParentElement();
+                       
                        if (eventElementContainer == this){
                                if(event instanceof CdmPropertyChangeEvent){
                                        if(((CdmPropertyChangeEvent) event).hasException()){
index df7949b5882cb1685cec513959bbcb9fd8a2bab1..c155efba1c09014f7a51bebb5ad9f1984f4d892e 100644 (file)
@@ -19,7 +19,7 @@ import org.apache.commons.lang.StringUtils;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.api.service.IMediaService;
-import eu.etaxonomy.cdm.common.mediaMetaData.ImageMetaData;
+import eu.etaxonomy.cdm.common.media.ImageInfo;
 import eu.etaxonomy.cdm.model.media.ImageFile;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
@@ -105,10 +105,9 @@ public class ImageFileElement extends AbstractMediaRepresentationPartElement<Ima
                        }
                        
                        
-                       ImageMetaData imageInfo;
                        try {
                                
-                               imageInfo = CdmStore.getService(IMediaService.class).getImageInfo(uri, 10000);
+                               ImageInfo imageInfo = ImageInfo.NewInstanceWithMetaData(uri, 10000);
                                        
                                text_height.setInteger(imageInfo.getHeight());
                                getEntity().setHeight(imageInfo.getHeight());
index 960fdf66b9a57cbb46c9c2a4e513a5945ef1e92f..248a07865c5998d904bc3e22971ca7380a5a8552 100644 (file)
@@ -19,7 +19,7 @@ import org.apache.http.HttpException;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.api.service.IMediaService;
-import eu.etaxonomy.cdm.common.mediaMetaData.ImageMetaData;
+import eu.etaxonomy.cdm.common.media.ImageInfo;
 import eu.etaxonomy.cdm.model.media.ImageFile;
 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
@@ -110,20 +110,15 @@ public class MediaRepresentationElement extends AbstractEntityCollectionElement<
                                return;
                        }
                        try {
-                               ImageMetaData imageInfo = CdmStore.getService(IMediaService.class).getImageInfo(uri, 10000);
+                               ImageInfo imageInfo = ImageInfo.NewInstance(uri, 10000);
                                String mimeType = imageInfo.getMimeType();
                                text_mimeType.setText(mimeType);
-                               
-                               
+                               text_suffix.setText(imageInfo.getSuffix());     
                        } catch (IOException e) {
                                StoreUtil.error(getClass(), e);
                        } catch (HttpException e) {
                                StoreUtil.error(getClass(), e);
                        }
-                       String path = uri.getPath();
-                       
-                       String suffix = path.substring(StringUtils.lastIndexOf(path, '.')+1);
-                       text_suffix.setText(suffix);
                }
        }
        
index 1e22c013d5393124f124d63dc3e146f74002972a..1b7beb78192df669cbc299f1364d375b890afb6e 100644 (file)
@@ -383,7 +383,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
        public void handleEvent(Object eventSource) {
                if (eventSource == combo_referenceType) {
                        getEntity().setType(combo_referenceType.getSelection());
-                       getParentElement().refresh();
+                       updateContent();
                } else if (eventSource == element_timePeriod) {
                        getEntity().setDatePublished(element_timePeriod.getTimePeriod());
                        clearException();
index b0d5b881d345cb6158897bed69fa56cb073dd67c..23a7d1db25742a01f5337b9550de04a6e5f5a4fa 100644 (file)
@@ -131,7 +131,5 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                } else if (eventSource == checkbox_unplaced) {
                        ((Taxon) getEntity()).setUnplaced(checkbox_unplaced.getSelection());
                }
-
-               firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
 }
index b7d1e6443cd3d1c19fc9b3ab44a7018d86d4aa75..4513158e60097c785872ff365b1c4e8f7413eb03 100644 (file)
@@ -222,7 +222,7 @@ public abstract class AbstractSelectionElement<T> extends
        protected void setSelectionInternal(T selection) {
                if (selection != null && !selection.equals(this.entity)) {
                        setEntity(selection);
-                       firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
+                       getParentElement().firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
                }
        }
 
index 4206a8949c05876468663f00dc0510d421c06c08..1113625a0e73215530db43a7c7cdf928188db58d 100644 (file)
@@ -16,6 +16,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.eclipse.core.runtime.Assert;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -30,11 +31,11 @@ import eu.etaxonomy.cdm.model.common.MultilanguageTextHelper;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.forms.LanguageStringWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement;
 import eu.etaxonomy.taxeditor.ui.forms.RootElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
 import eu.etaxonomy.taxeditor.ui.term.EmptyComboElement;
 import eu.etaxonomy.taxeditor.ui.term.LanguageComboElement;
 
@@ -70,6 +71,7 @@ public class TranslationWizardPage extends WizardPage{
         */
        protected TranslationWizardPage(Map<Language, LanguageString> multilanguageText) {
                super("TranslationWizardPage");
+               Assert.isNotNull(multilanguageText, "Multilanguage text may not be null");
                setTitle("Add or edit translations.");
                this.multilanguageText = multilanguageText;
                formFactory = new CdmFormFactory(Display.getCurrent());