X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/c3efc10a8ccfc08ef6fe227b58b22842bcc5ae69..d58b8e3f77a8664b300c738c9678edb6024edf17:/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java index 0a7ef1750..6a407358a 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailSection.java @@ -1,4 +1,3 @@ -// $Id$ /** * Copyright (C) 2007 EDIT * European Distributed Institute of Taxonomy @@ -7,91 +6,69 @@ * 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.name; import org.eclipse.jface.viewers.ISelectionProvider; -import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; -import eu.etaxonomy.cdm.model.name.NonViralName; +import eu.etaxonomy.cdm.model.name.INonViralName; +import eu.etaxonomy.cdm.model.name.TaxonName; import eu.etaxonomy.cdm.model.taxon.TaxonBase; -import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; +import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection; /** - *

AuthorshipDetailSection class.

- * * @author n.hoffmann * @created 05.06.2009 - * @version 1.0 */ -public class AuthorshipDetailSection extends AbstractCdmDetailSection implements ITaxonBaseDetailSection { +public class AuthorshipDetailSection extends AbstractCdmDetailSection implements ITaxonBaseDetailSection { - private TaxonBase taxonBase; + private TaxonBase taxonBase; - /** - *

Constructor for AuthorshipDetailSection.

- * - * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. - * @param style a int. - * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object. - */ - public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, + public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) { - super(cdmFormFactory, conversation, parentElement, selectionProvider, style); - } - - /** - * {@inheritDoc} - * - * Author title is not in titleCache field - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#setSectionTitle() - */ - @Override - protected void setSectionTitle() { - if(getEntity() != null){ - this.setText(getHeading() + ": " + getEntity().getAuthorshipCache()); - } + super(cdmFormFactory, parentElement, selectionProvider, style); } - /** {@inheritDoc} */ @Override public void setTaxonBase(TaxonBase entity) { this.taxonBase = entity; - NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName()); + INonViralName name = HibernateProxyHelper.deproxy(entity.getName()); setEntity(name); } - /* - * (non-Javadoc) - * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailSection#getHeading() - */ - /** {@inheritDoc} */ @Override public String getHeading() { return "Authorship"; } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase) - */ @Override public TaxonBase getTaxonBase() { return taxonBase; } - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int) - */ @Override - protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection parentElement, int style) { + protected void setSectionTitle() { + String title = ""; + String label = ""; + if (getEntity() != null && (getEntity() instanceof TaxonName) ) { + label =((TaxonName) getEntity()).getAuthorshipCache(); + title = ": " + label; + } + this.setText(String.format("%s%s", getHeading(), title)); + setTextClient(createToolbar()); + } + + @Override + protected AbstractCdmDetailElement createCdmDetailElement( + AbstractCdmDetailSection parentElement, int style) { return formFactory.createAuthorshipDetailElement(parentElement, style); } -} + public void updateContent(){ + ((AuthorshipDetailElement)this.detailElement).updateContent(); + } +} \ No newline at end of file