ref #10135: add created and createdby to an extra section to keep it at the same...
authorKatja Luther <k.luther@bgbm.org>
Thu, 29 Sep 2022 11:59:18 +0000 (13:59 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 29 Sep 2022 11:59:18 +0000 (13:59 +0200)
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/section/supplemental/CdmBaseElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/CreateElement.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/CreateSection.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/VersionElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataViewerE4.java

index 063c075b7598e3cb0903f71dd4ea45da716d33fc..ba7e3e639c2cbbf1a8bc4276cd814a886034132a 100755 (executable)
@@ -356,6 +356,8 @@ import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CreateElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CreateSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditElement;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionElement;
@@ -1742,6 +1744,13 @@ public class CdmFormFactory extends FormToolkit {
         adapt(section);
         return section;
     }
+    
+    public CreateSection createCreateSection(ICdmFormElement parentElement, int style) {
+       CreateSection section = new CreateSection(this, parentElement, style);
+        parentElement.addElement(section);
+        adapt(section);
+        return section;
+    }
 
     /**
      * @param parent
@@ -2011,11 +2020,11 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public SecundumSourceSection createSecundumDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-       SecundumSourceSection section = new SecundumSourceSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
+//    public SecundumSourceSection createSecundumDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+//     SecundumSourceSection section = new SecundumSourceSection(this, conversation, parentElement, selectionProvider, style);
+//        addAndAdaptSection(parentElement, section);
+//        return section;
+//    }
 
     public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
@@ -2361,11 +2370,11 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public SecundumSourceDetailElement createSecundumSourceDetailElement(ICdmFormElement parentElement){
-       SecundumSourceDetailElement element = new SecundumSourceDetailElement(this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
+//    public SecundumSourceDetailElement createSecundumSourceDetailElement(ICdmFormElement parentElement){
+//     SecundumSourceDetailElement element = new SecundumSourceDetailElement(this, parentElement);
+//        addAndAdaptElement(parentElement, element);
+//        return element;
+//    }
 
     public SecundumSourceElement createSecundumSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity, String label){
         SecundumSourceElement element = new SecundumSourceElement(this, parentElement, cdmEntity, label);
@@ -3665,6 +3674,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
+    public CreateElement createCreateElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
+        CreateElement element = new CreateElement(this, parentElement, entity, style);
+        adapt(element);
+        parentElement.addElement(element);
+        return element;
+    }
 
 
 
index 8f88459964089234cf02c7c4caf5111f4abd77c5..9a3f09672332627c508a5556f9288f4d3fd2488f 100644 (file)
@@ -28,9 +28,6 @@ public class CdmBaseElement extends AbstractCdmFormElement implements IEntityEle
        private TextWithLabelElement text_uuid;\r
        private TextWithLabelElement text_objectId;\r
        \r
-       private Label label_created;\r
-       \r
-       \r
        private CdmBase entity;\r
        /**\r
         * @param formFactory\r
@@ -40,9 +37,6 @@ public class CdmBaseElement extends AbstractCdmFormElement implements IEntityEle
                        ICdmFormElement formElement, CdmBase entity, int style) {\r
 \r
                super(formFactory, formElement);\r
-               label_created = formFactory.createLabel(getLayoutComposite(), null, style);\r
-               label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());\r
-\r
                text_uuid = formFactory.createTextWithLabelElement(formElement, "UUID", null, style);\r
                text_uuid.setEditable(false);\r
                text_objectId = formFactory.createTextWithLabelElement(formElement, "Object ID", null, style);\r
@@ -70,17 +64,7 @@ public class CdmBaseElement extends AbstractCdmFormElement implements IEntityEle
        public void setEntity(CdmBase entity) {\r
 \r
                this.entity = entity;\r
-               String createdString = "";\r
-               String updatedString = "";\r
-               \r
-               if(entity != null){\r
-                       createdString = "Created "\r
-                                       + dateFormat(entity.getCreated())\r
-                                       + " by " + userFormat(entity.getCreatedBy());                   \r
-                       \r
-               }\r
-               \r
-               label_created.setText(createdString);\r
+                               \r
                text_uuid.setText(entity != null ? entity.getUuid().toString() : "");\r
                text_objectId.setText(entity != null ? entity.getId()+"" : "");\r
        }\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/CreateElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/CreateElement.java
new file mode 100755 (executable)
index 0000000..67477b4
--- /dev/null
@@ -0,0 +1,93 @@
+/**
+* Copyright (C) 2007 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.supplemental;
+
+import org.eclipse.swt.widgets.Label;
+import org.joda.time.DateTime;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.permission.User;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.VersionableEntity;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+
+/**
+ * <p>VersionElement class.</p>
+ *
+ * @author n.hoffmann
+ * @created Nov 5, 2009
+ * @version 1.0
+ */
+public class CreateElement extends AbstractCdmFormElement implements IEntityElement<CdmBase> {
+
+       private Label label_created;
+
+       private CdmBase entity;
+       
+       /**
+        * <p>Constructor for VersionElement.</p>
+        *
+        * @param style a int.
+        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+        * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
+        */
+       public CreateElement(CdmFormFactory formFactory, ICdmFormElement parentElement, CdmBase entity, int style) {
+               super(formFactory, parentElement);
+                       
+               label_created = formFactory.createLabel(getLayoutComposite(), null, style);
+               label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+               
+               setEntity(entity);
+       }
+       
+       /**
+        * <p>Setter for the field <code>entity</code>.</p>
+        *
+        * @param entity a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
+        */
+       public void setEntity(CdmBase entity){
+
+               this.entity = entity;
+               
+               String createdString = "";
+               String updatedString = "";
+               
+               if(entity != null){
+                       createdString = "Created "
+                                       + dateFormat(entity.getCreated())
+                                       + " by " + userFormat(entity.getCreatedBy());                   
+               }
+               
+               label_created.setText(createdString);
+       
+       }
+       
+       
+
+       /**
+        * <p>Getter for the field <code>entity</code>.</p>
+        *
+        * @return a {@link eu.etaxonomy.cdm.model.common.VersionableEntity} object.
+        */
+       public CdmBase getEntity() {
+               return entity;
+       }
+
+       @Override
+       public void setSelected(boolean selected) {
+               // this entity element is not likely to get selected
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/CreateSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/CreateSection.java
new file mode 100755 (executable)
index 0000000..09a7e26
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+* Copyright (C) 2007 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.supplemental;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.VersionableEntity;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+/**
+ * <p>VersionSection class.</p>
+ *
+ * @author n.hoffmann
+ * @created Mar 2, 2010
+ * @version 1.0
+ */
+public class CreateSection extends AbstractFormSection<CdmBase>{
+
+       private CreateElement createElement;
+       
+       
+       /**
+        * <p>Constructor for VersionSection.</p>
+        *
+        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+        * @param style a int.
+        */
+       public CreateSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
+                       int style) {
+               super(cdmFormFactory, parentElement, style);
+               createElement = cdmFormFactory.createCreateElement(this, null, style);
+       }
+       
+       
+       /** {@inheritDoc} */
+       @Override
+       public void setEntity(CdmBase entity) {
+               super.setEntity(entity);
+               createElement.setEntity(entity);
+       }
+}
index 14062d9fe25048b8a2101e579260989b19e16fc8..e0c013b570eb211edfc0e3ed84ad83d386474189 100644 (file)
@@ -31,7 +31,7 @@ import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
  */
 public class VersionElement extends AbstractCdmFormElement implements IEntityElement<VersionableEntity> {
 
-       private Label label_created;
+//     private Label label_created;
        private Label label_updated;
        
        
@@ -48,8 +48,8 @@ public class VersionElement extends AbstractCdmFormElement implements IEntityEle
        public VersionElement(CdmFormFactory formFactory, ICdmFormElement parentElement, VersionableEntity entity, int style) {
                super(formFactory, parentElement);
                        
-               label_created = formFactory.createLabel(getLayoutComposite(), null, style);
-               label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+//             label_created = formFactory.createLabel(getLayoutComposite(), null, style);
+//             label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
 
                label_updated = formFactory.createLabel(getLayoutComposite(), null, style);
                label_updated.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
@@ -79,7 +79,7 @@ public class VersionElement extends AbstractCdmFormElement implements IEntityEle
                                        + " by " + userFormat(entity.getUpdatedBy());
                }
                
-               label_created.setText(createdString);
+//             label_created.setText(createdString);
                label_updated.setText(updatedString);
        }
        
index 4e7a2134197aaa62d5d64c6167742c3baf7514e8..446dd2e73aa81f6c87b0d45b9d20f506c8c255b3 100644 (file)
@@ -34,6 +34,7 @@ import eu.etaxonomy.taxeditor.ui.element.RootElement;
 import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CreateSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
@@ -98,6 +99,7 @@ public class SupplementalDataViewerE4 extends AbstractCdmDataViewer {
                if(input instanceof IdentifiableMediaEntity){
                        createIdentifiableMediaSections(rootElement);
                }
+               createCreateSection(rootElement);
                //5. Versionable
                if(input instanceof VersionableEntity){
                                createVersionSection(rootElement);
@@ -176,6 +178,11 @@ public class SupplementalDataViewerE4 extends AbstractCdmDataViewer {
         addPart(mediaSection);
     }
 
+    private void createCreateSection(RootElement parent){
+               CreateSection createSection = formFactory.createCreateSection(parent, ExpandableComposite.NO_TITLE);
+               addPart(createSection);
+       }
+    
        private void createVersionSection(RootElement parent){
                VersionSection versionSection = formFactory.createVersionSection(parent, ExpandableComposite.NO_TITLE);
                addPart(versionSection);