- used original label info from facade instead of from the derived unit (fixes ...
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 26 Feb 2015 10:56:44 +0000 (10:56 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 26 Feb 2015 10:56:44 +0000 (10:56 +0000)
.gitattributes
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/OriginalLabelDataElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java [deleted file]

index cc539fac25226a638ca93a8749ffc34333514825..fcbb12d05dd24da386bfd3b6aaed3521497ed302 100644 (file)
@@ -1493,7 +1493,6 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/group/grant
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/AbstractCdmComposite.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/DerivedUnitGeneralDetailElementMVC.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/GeographicPointElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermCombo.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermComboController.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElement.java -text
index 48c30ed7df9380d53bc4b4f078bf2a9d0c2a5e85..67031071347706b763ede006640c21634f7fa25c 100644 (file)
@@ -10,7 +10,6 @@
 package eu.etaxonomy.taxeditor.ui.element;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.mvc.OriginalLabelDataField;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 
 /**
@@ -20,6 +19,8 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class OriginalLabelDataElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
 
+    private TextWithLabelElement textOriginalLabel;
+
     /**
      * @param formFactory
      * @param formElement
@@ -39,8 +40,7 @@ public class OriginalLabelDataElement extends AbstractCdmDetailElement<DerivedUn
     @Override
     protected void createControls(ICdmFormElement formElement,
             DerivedUnitFacade entity, int style) {
-        OriginalLabelDataField originalLabelDataField = new OriginalLabelDataField(formElement.getLayoutComposite(), style, entity.innerDerivedUnit(), getFormFactory());
-        originalLabelDataField.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+        textOriginalLabel = formFactory.createTextWithLabelElement(formElement, "Original Label Info", entity.getOriginalLabelInfo(), style);
     }
 
     /*
@@ -52,6 +52,9 @@ public class OriginalLabelDataElement extends AbstractCdmDetailElement<DerivedUn
      */
     @Override
     public void handleEvent(Object eventSource) {
+        if(eventSource==textOriginalLabel){
+            getEntity().setOriginalLabelInfo(textOriginalLabel.getText());
+        }
     }
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java
deleted file mode 100644 (file)
index 3603e4d..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2014 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.mvc;
-
-import java.util.List;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.beans.BeansObservables;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.jface.databinding.swt.SWTObservables;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
-
-/**
- * @author pplitzner
- * @date 23.06.2014
- *
- */
-public class OriginalLabelDataField extends Composite {
-
-    private DataBindingContext m_bindingContext;
-    private DerivedUnit derivedUnit = null;
-    private final Text originalLabelInfoText;
-    private CdmFormFactory formFactory;
-
-    public OriginalLabelDataField(Composite parent, int style, DerivedUnit newDerivedUnit, CdmFormFactory formFactory) {
-        this(parent, style);
-        setDerivedUnit(newDerivedUnit);
-        this.formFactory = formFactory;
-    }
-
-    public OriginalLabelDataField(Composite parent, int style) {
-        super(parent, style);
-        setLayout(new GridLayout(2, false));
-
-        new Label(this, SWT.NONE).setText("Original Label Data");
-
-        originalLabelInfoText = new Text(this, SWT.BORDER | SWT.WRAP | SWT.MULTI);
-        originalLabelInfoText.addModifyListener(new ModifyListener() {
-            @Override
-            public void modifyText(ModifyEvent e) {
-                if(formFactory!=null){
-                    List<IPropertyChangeListener> propertyChangeListeners = formFactory.getPropertyChangeListeners();
-                    for (IPropertyChangeListener iPropertyChangeListener : propertyChangeListeners) {
-                        iPropertyChangeListener.propertyChange(new CdmPropertyChangeEvent(OriginalLabelDataField.this, e));
-                    }
-                }
-            }
-        });
-        originalLabelInfoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
-        if (derivedUnit != null) {
-            m_bindingContext = initDataBindings();
-        }
-    }
-
-    @Override
-    protected void checkSubclass() {
-        // Disable the check that prevents subclassing of SWT components
-    }
-
-    private DataBindingContext initDataBindings() {
-        IObservableValue originalLabelInfoObserveWidget = SWTObservables.observeText(originalLabelInfoText, SWT.Modify);
-        IObservableValue originalLabelInfoObserveValue = BeansObservables
-                .observeValue(derivedUnit, "originalLabelInfo");
-        //
-        DataBindingContext bindingContext = new DataBindingContext();
-        //
-        bindingContext.bindValue(originalLabelInfoObserveWidget, originalLabelInfoObserveValue, null, null);
-        //
-        return bindingContext;
-    }
-
-    public DerivedUnit getDerivedUnit() {
-        return derivedUnit;
-    }
-
-    public void setDerivedUnit(DerivedUnit newDerivedUnit) {
-        setDerivedUnit(newDerivedUnit, true);
-    }
-
-    public void setDerivedUnit(DerivedUnit newDerivedUnit, boolean update) {
-        derivedUnit = newDerivedUnit;
-        if (update) {
-            if (m_bindingContext != null) {
-                m_bindingContext.dispose();
-                m_bindingContext = null;
-            }
-            if (derivedUnit != null) {
-                m_bindingContext = initDataBindings();
-            }
-        }
-    }
-
-}