From 7e65b3688ac56cf1921da11257b456feec279f6c Mon Sep 17 00:00:00 2001
From: Patrick Plitzner
Date: Mon, 20 Jun 2016 18:25:12 +0200
Subject: [PATCH] Add identifer section to supplemental data view #5898
---
.../identifier/IdentifierDetailElement.java | 49 +----------
.../identifier/IdentifierDetailSection.java | 86 ++-----------------
.../SupplementalDataViewer.java | 6 ++
3 files changed, 15 insertions(+), 126 deletions(-)
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/identifier/IdentifierDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/identifier/IdentifierDetailElement.java
index 9171b031b..e1796bcfd 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/identifier/IdentifierDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/identifier/IdentifierDetailElement.java
@@ -23,13 +23,9 @@ import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
- *
- * CollectionDetailElement class.
- *
+ *
+ * @author pplitzner
*
- * @author n.hoffmann
- * @created Oct 13, 2010
- * @version 1.0
*/
public class IdentifierDetailElement extends AbstractEntityCollectionElement {
@@ -37,37 +33,12 @@ public class IdentifierDetailElement extends AbstractEntityCollectionElement comboIdentifierType;
- /**
- *
- * Constructor for CollectingAreasDetailElement.
- *
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- */
public IdentifierDetailElement(CdmFormFactory formFactory,
AbstractFormSection section, Identifier entity,
SelectionListener removeListener, int style) {
super(formFactory, section, entity, removeListener, null, style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
- * (java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void setEntity(Identifier entity) {
@@ -76,14 +47,6 @@ public class IdentifierDetailElement extends AbstractEntityCollectionElement
- * CollectingAreasDetailSection class.
- *
+ *
+ * @author pplitzner
*
- * @author n.hoffmann
- * @created Oct 14, 2010
- * @version 1.0
*/
-public class IdentifierDetailSection extends AbstractEntityCollectionSection {
+public class IdentifierDetailSection extends AbstractEntityCollectionSection {
- /**
- * Constructor for CollectingAreasDetailSection.
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public IdentifierDetailSection(CdmFormFactory formFactory,
ConversationHolder conversation, ICdmFormElement parentElement, int style) {
super(formFactory, conversation, parentElement, "Identifiers", style);
}
- @Override
- protected Control createToolbar() {
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-
- Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- Identifier element = createNewElement();
- if(element != null){
- if(! getSection().isExpanded()) {
- getSection().setExpanded(true);
- }
- internalUpdateSection(true);
- }
- }
- };
- addAction.setImageDescriptor(new ImageDescriptor() {
-
- @Override
- public ImageData getImageData() {
- return ImageResources.getImage(ImageResources.ADD_ICON).getImageData();
- }
- });
- addAction.setToolTipText(getTooltipString());
-
- toolBarManager.add(addAction);
-
- return toolBarManager.createControl(this);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
- public Collection getCollection(DerivedUnitFacade entity) {
+ public Collection getCollection(IdentifiableEntity entity) {
return entity.getIdentifiers();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
/** {@inheritDoc} */
@Override
public Identifier createNewElement() {
- return Identifier.NewInstance(getEntity().baseUnit(), null, null);
+ return Identifier.NewInstance(null, null);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
/** {@inheritDoc} */
@Override
public void addElement(Identifier element) {
getEntity().addIdentifier(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
/** {@inheritDoc} */
@Override
public void removeElement(Identifier element) {
- getEntity().removeIdentifier(getEntity().getIdentifiers().get(0));
+ getEntity().removeIdentifier(element);
getConversationHolder().commit();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
/** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No identifiers yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
/** {@inheritDoc} */
@Override
protected String getTooltipString() {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java
index f48949c18..b3190cd09 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java
@@ -27,6 +27,7 @@ import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
+import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailSection;
import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
@@ -163,10 +164,15 @@ public class SupplementalDataViewer extends AbstractCdmDataViewer implements ISe
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ IdentifierDetailSection identifierSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
addPart(creditSection);
addPart(extensionSection);
addPart(rightsSection);
addPart(sourceSection);
+ addPart(identifierSection);
}
--
2.34.1