// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.
+ */
package eu.etaxonomy.taxeditor.ui.section.classification;
-import org.apache.log4j.Logger;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>ClassificationDetailElement class.</p>
- *
+ * <p>
+ * ClassificationDetailElement class.
+ * </p>
+ *
* @author n.hoffmann
* @created Sep 27, 2010
* @version 1.0
*/
-public class ClassificationDetailElement extends AbstractCdmDetailElement<Classification> {
-
-
- private static final Logger logger = Logger
- .getLogger(ClassificationDetailElement.class);
+public class ClassificationDetailElement extends
+ AbstractCdmDetailElement<Classification> {
private TextWithLabelElement text_treeLabel;
- private ReferenceSelectionElement selection_reference;
+ private EntitySelectionElement<Reference> selection_reference;
private TextWithLabelElement text_microReference;
-
+
/**
- * <p>Constructor for ClassificationDetailElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
+ * <p>
+ * Constructor for ClassificationDetailElement.
+ * </p>
+ *
+ * @param formFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param formElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
*/
public ClassificationDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
+ * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
*/
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
Classification entity, int style) {
- text_treeLabel = formFactory.createTextWithLabelElement(formElement, "Label", entity != null ? entity.getTitleCache() : null, SWT.NULL);
- selection_reference = (ReferenceSelectionElement) formFactory.createSelectionElement(SelectionType.REFERENCE, getConversationHolder(), formElement, "Reference", entity != null ? entity.getReference() : null, SWT.NULL);
- text_microReference = formFactory.createTextWithLabelElement(formElement, "Reference Detail", entity != null ? entity.getMicroReference() : null, SWT.NULL);
+ text_treeLabel = formFactory.createTextWithLabelElement(formElement,
+ "Label", entity != null ? entity.getTitleCache() : null,
+ SWT.NULL);
+ selection_reference = formFactory
+ .createSelectionElement(Reference.class,
+ getConversationHolder(), formElement, "Reference",
+ entity != null ? entity.getReference() : null,
+ EntitySelectionElement.ALL, SWT.NULL);
+ text_microReference = formFactory.createTextWithLabelElement(
+ formElement, "Reference Detail",
+ entity != null ? entity.getMicroReference() : null, SWT.NULL);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+ * .lang.Object)
*/
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource == text_treeLabel){
- LanguageString languageString = LanguageString.NewInstance(text_treeLabel.getText(), CdmStore.getDefaultLanguage());
+ if (eventSource == text_treeLabel) {
+ LanguageString languageString = LanguageString.NewInstance(
+ text_treeLabel.getText(), CdmStore.getDefaultLanguage());
getEntity().setName(languageString);
- }
- else if(eventSource == selection_reference){
+ } else if (eventSource == selection_reference) {
getEntity().setReference(selection_reference.getEntity());
- }
- else if(eventSource == text_microReference){
+ } else if (eventSource == text_microReference) {
getEntity().setMicroReference(text_microReference.getText());
}
}