-// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.TableWrapData;
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.taxon.TaxonBase;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
*
* @author n.hoffmann
* @created Mar 3, 2010
- * @version 1.0
*/
-public class ParsingMessagesSection extends AbstractCdmDetailSection<NonViralName> implements ITaxonBaseDetailSection {
+public class ParsingMessagesSection
+ extends AbstractCdmDetailSection<INonViralName>
+ implements ITaxonBaseDetailSection {
/** Constant <code>HEADING_SUCCESS=""</code> */
public static final String HEADING_SUCCESS = "";
/** Constant <code>HEADING_PROBLEM="The name has problems."</code> */
public static final String HEADING_PROBLEM = "The name has problems.";
private TaxonBase taxonBase;
-
+
/**
* <p>Constructor for ParsingMessagesSection.</p>
*
ISelectionProvider selectionProvider, int style) {
super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
}
-
+
/** {@inheritDoc} */
@Override
protected void createControls(AbstractCdmDetailSection formElement, int style) {
// we do it differently here
}
-
+
/** {@inheritDoc} */
- public void setTaxonBase(TaxonBase entity) {
+ @Override
+ public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
- setEntity((NonViralName) HibernateProxyHelper.deproxy(entity.getName()));
+ setEntity(HibernateProxyHelper.deproxy(entity.getName()));
destroyParsingProblemComposites();
if(getEntity().hasProblem()){
displayParsingProblems();
}
}
-
+
private void destroyParsingProblemComposites() {
setText(HEADING_SUCCESS);
for(Control control : getLayoutComposite().getChildren()){
control.dispose();
control = null;
}
+ TableWrapData layoutData = (TableWrapData) getLayoutData();
+ layoutData.heightHint = 0;
+ setLayoutData(layoutData);
+ this.layout();
}
private void displayParsingProblems() {
+ TableWrapData layoutData = (TableWrapData) getLayoutData();
+ layoutData.heightHint = -1;
+ setLayoutData(layoutData);
setText(HEADING_PROBLEM);
for(Object parserProblem : getEntity().getParsingProblems()){
formFactory.createParsingMessageElement(this, (ParserProblem) parserProblem, SWT.NULL);
return HEADING_SUCCESS;
}
- /** {@inheritDoc} */
@Override
- protected DetailType getDetailType() {
- return DetailType.PARSINGMESSAGE;
+ public TaxonBase getTaxonBase() {
+ return taxonBase;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#getTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
- */
@Override
- public TaxonBase getTaxonBase() {
- return taxonBase;
+ protected AbstractCdmDetailElement<INonViralName> createCdmDetailElement(
+ AbstractCdmDetailSection<INonViralName> parentElement, int style) {
+ //no detail element
+ return null;
}
}