3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.section
.taxon
;
13 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
14 import org
.eclipse
.swt
.SWT
;
15 import org
.eclipse
.swt
.widgets
.Control
;
17 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
18 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
19 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
21 import eu
.etaxonomy
.cdm
.strategy
.parser
.ParserProblem
;
22 import eu
.etaxonomy
.taxeditor
.forms
.CdmFormFactory
;
23 import eu
.etaxonomy
.taxeditor
.forms
.CdmFormFactory
.DetailType
;
24 import eu
.etaxonomy
.taxeditor
.forms
.ICdmFormElement
;
25 import eu
.etaxonomy
.taxeditor
.section
.AbstractCdmDetailSection
;
26 import eu
.etaxonomy
.taxeditor
.section
.ITaxonDetailSection
;
29 * <p>ParsingMessagesSection class.</p>
32 * @created Mar 3, 2010
35 public class ParsingMessagesSection
extends AbstractCdmDetailSection
<NonViralName
> implements ITaxonDetailSection
{
37 /** Constant <code>HEADING_SUCCESS=""</code> */
38 public static final String HEADING_SUCCESS
= "";
39 /** Constant <code>HEADING_PROBLEM="The name has problems."</code> */
40 public static final String HEADING_PROBLEM
= "The name has problems.";
43 * <p>Constructor for ParsingMessagesSection.</p>
45 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.forms.CdmFormFactory} object.
46 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
47 * @param parentElement a {@link eu.etaxonomy.taxeditor.forms.ICdmFormElement} object.
48 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
51 public ParsingMessagesSection(CdmFormFactory cdmFormFactory
, ConversationHolder conversation
, ICdmFormElement parentElement
,
52 ISelectionProvider selectionProvider
, int style
) {
53 super(cdmFormFactory
, conversation
, parentElement
, selectionProvider
, style
);
58 protected void createControls(AbstractCdmDetailSection formElement
, int style
) {
59 // we do it differently here
63 public void setTaxon(TaxonBase taxon
) {
64 setEntity((NonViralName
) HibernateProxyHelper
.deproxy(taxon
.getName()));
65 destroyParsingProblemComposites();
66 if(getEntity().hasProblem()){
67 displayParsingProblems();
71 private void destroyParsingProblemComposites() {
72 setText(HEADING_SUCCESS
);
73 for(Control control
: getLayoutComposite().getChildren()){
79 private void displayParsingProblems() {
80 setText(HEADING_PROBLEM
);
81 for(Object parserProblem
: getEntity().getParsingProblems()){
82 formFactory
.createParsingMessageElement(this, (ParserProblem
) parserProblem
, SWT
.NULL
);
89 public String
getHeading() {
90 return HEADING_SUCCESS
;
95 protected DetailType
getDetailType() {
96 return DetailType
.PARSINGMESSAGE
;