// $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.occurrence;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
-import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.CheckboxElement;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
-import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement;
-import eu.etaxonomy.taxeditor.ui.term.DeterminationModifierComboElement;
+import eu.etaxonomy.cdm.model.occurrence.DeterminationModifier;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
+import eu.etaxonomy.taxeditor.ui.section.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>DeterminationEventDetailElement class.</p>
- *
+ * <p>
+ * DeterminationEventDetailElement class.
+ * </p>
+ *
* @author n.hoffmann
* @created Oct 13, 2010
* @version 1.0
*/
public class DeterminationEventDetailElement extends
- AbstractEventDetailElement<DeterminationEvent> {
+ AbstractEventDetailElement<DeterminationEvent> {
- private DeterminationModifierComboElement combo_determinationModifier;
+ private TermComboElement<DeterminationModifier> combo_determinationModifier;
private CheckboxElement checkbox_preferredFlag;
- private TaxonSelectionElement selection_taxon;
-// private TODO a set of references
-
+ private EntitySelectionElement<TaxonBase> selection_taxonBase;
+
+ // private TODO a set of references
+
/**
- * <p>Constructor for DeterminationEventDetailElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
- * @param section a {@link eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.occurrence.DeterminationEvent} object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
+ * <p>
+ * Constructor for DeterminationEventDetailElement.
+ * </p>
+ *
+ * @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.occurrence.DeterminationEvent}
+ * object.
+ * @param removeListener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ * @param style
+ * a int.
*/
public DeterminationEventDetailElement(CdmFormFactory formFactory,
AbstractFormSection section, DeterminationEvent entity,
super(formFactory, section, entity, removeListener, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
+ * (eu.etaxonomy.cdm.model.common.IVersionableEntity)
*/
/** {@inheritDoc} */
@Override
public void setEntity(DeterminationEvent entity) {
this.entity = entity;
+ combo_determinationModifier.setSelection(entity.getModifier());
+ selection_taxonBase.setEntity(entity.getTaxon());
super.setEntity(entity);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
*/
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
-
- combo_determinationModifier = (DeterminationModifierComboElement) formFactory.createTermComboElement(TermComboType.DETERMINATION_MODIFIER, element, "Determination Modifier", null, style);
- checkbox_preferredFlag = formFactory.createCheckbox(element, "Preferred", false, style);
- selection_taxon = (TaxonSelectionElement) formFactory.createSelectionElement(SelectionType.TAXON, getConversationHolder(), element, "Taxon", null, style);
+ selection_taxonBase = formFactory
+ .createSelectionElement(TaxonBase.class,
+ getConversationHolder(), element, "Taxon", null,
+ EntitySelectionElement.NOTHING, style);
+
// TODO set of references
-
+
super.createControls(element, style);
+
+ element_timePeriod.setLabel("Determined When");
selection_agent.setLabel("Determined by");
+
+
+ combo_determinationModifier = formFactory.createTermComboElement(DeterminationModifier.class,
+ element, "Modifier", null, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
+ * (java.lang.Object)
*/
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource == combo_determinationModifier){
+ if (eventSource == combo_determinationModifier) {
getEntity().setModifier(combo_determinationModifier.getSelection());
- }
- else if(eventSource == checkbox_preferredFlag){
+ } else if (eventSource == checkbox_preferredFlag) {
getEntity().setPreferredFlag(checkbox_preferredFlag.getSelection());
+ } else if (eventSource == selection_taxonBase) {
+ getEntity().setTaxon(selection_taxonBase.getSelection());
}
- else if(eventSource == selection_taxon){
- getEntity().setTaxon(selection_taxon.getSelection());
- }
-// else if(eventSource == TODO set of references){
-//
-// }
- else if(eventSource == selection_agent){
+ // else if(eventSource == TODO set of references){
+ //
+ // }
+ else if (eventSource == selection_agent) {
getEntity().setDeterminer(selection_agent.getSelection());
- }
- else if(eventSource == text_description){
+ } else if (eventSource == text_description) {
getEntity().setDescription(text_description.getText());
- }
- else if(eventSource == element_timePeriod){
+ } else if (eventSource == element_timePeriod) {
getEntity().setTimeperiod(element_timePeriod.getTimePeriod());
}
}