AT: committing Palm extension changes to the taxeditor
authora.theys <a.theys@localhost>
Fri, 13 Apr 2012 16:04:53 +0000 (16:04 +0000)
committera.theys <a.theys@localhost>
Fri, 13 Apr 2012 16:04:53 +0000 (16:04 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index 3e047e8b1a16b9de7993efc701edfa8d63ccaa4d..15603a6f321d518e76635956e8a0086e174fa41e 100644 (file)
@@ -45,6 +45,7 @@ import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;\r
 import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
 import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;\r
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;\r
 import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;\r
@@ -184,10 +185,10 @@ public class UsesViewPart extends AbstractCdmEditorViewPart implements IPartCont
                        return;\r
                }\r
                \r
-               /*if(part instanceof DefinedTermEditor){\r
+               if(part instanceof DefinedTermEditor){\r
                        showEmptyPage();\r
                        return;\r
-               }*/\r
+               }\r
                \r
                if(part instanceof MultiPageTaxonEditor){\r
                        if(! part.equals(this.part)){\r
index b65fdbe09187b3762c05943ef86d5a8542b7a703..e3aa9e8afc08a31ccf6888f3ac4fbd27ce73c21d 100644 (file)
@@ -186,9 +186,19 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                        createTeamOrPersonBaseDetailSection(rootElement);
 
                } else if (getInput() instanceof DescriptionBase) {
+                       Set<Marker> descriptionMarkers = ((DescriptionBase) getInput()).getMarkers();
+                       MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
+                       Boolean isUseDescription = false;
+                       for (Marker marker : descriptionMarkers) {
+                               if (marker.getMarkerType().equals(useMarkertype)) {
+                                       isUseDescription = true;
+                               }
+                       }
                        if (((DescriptionBase) getInput()).isImageGallery()) {
                                createImageGallerySection(rootElement);
 
+                       } else if (isUseDescription) { 
+                               createUseDescriptionSection(rootElement);
                        } else {
                                createDescriptionSection(rootElement);
 
@@ -246,6 +256,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                layout();
        }
 
+       
        /**
         * @param rootElement
         */
@@ -515,6 +526,28 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                addPart(descriptionSourceSection);
                addPart(scopeSection);
        }
+       
+       private void createUseDescriptionSection(RootElement parent) {
+               destroySections();
+               DescriptionDetailSection descriptionDetailSection = (DescriptionDetailSection) formFactory
+                               .createCdmDetailSection(DetailType.DESCRIPTION,
+                                               getConversationHolder(), parent, this, Section.TWISTIE
+                                                               | Section.EXPANDED);
+
+               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+               DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
+                               .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
+                                               getConversationHolder(), parent, Section.TWISTIE
+                                                               | Section.EXPANDED);
+
+               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+               addPart(descriptionDetailSection);
+               addPart(descriptionSourceSection);
+               
+       }
+
 
        /**
         * @param rootElement