eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/EntitySelectionField.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/EntitySelectionFieldController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/LanguageTextFieldController.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/NamedAreaFieldController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/NumberFieldController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/PointField.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/campanula/basicFields/PointFieldController.java -text
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
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.key.PolytomousKeyDetailElement;
* @param <T>
* a T object.
*/
- public EntitySelectionFieldController(EntitySelectionField entitySelectionField, CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T entity, int mode, int style) {
+ public EntitySelectionFieldController(EntitySelectionField entitySelectionField, CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T entity, int mode) {
super(formFactory, parentElement);
setPropertyChangeListeners(formFactory.getPropertyChangeListeners());
setEntity(entity);
}
- public EntitySelectionFieldController(EntitySelectionField entitySelectionField, CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz, String labelString, T entity, int mode, int style) {
- this(entitySelectionField, formFactory, conversation, parentElement, labelString, entity, mode, style);
+ public EntitySelectionFieldController(EntitySelectionField entitySelectionField, CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, Class<T> clazz, String labelString, T entity, int mode) {
+ this(entitySelectionField, formFactory, conversation, parentElement, labelString, entity, mode);
this.clazz = clazz;
}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2013 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.campanula.basicFields;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 15.08.2013
+ *
+ */
+public class NamedAreaFieldController extends AbstractEntityCollectionElement<NamedArea> {
+
+ private EntitySelectionFieldController<NamedArea> selection_namedArea;
+
+ /**
+ * <p>
+ * Constructor for CollectingAreasDetailElement.
+ * </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.location.NamedArea} object.
+ * @param removeListener
+ * a {@link org.eclipse.swt.events.SelectionListener} object.
+ * @param style
+ * a int.
+ */
+ public NamedAreaFieldController(CdmFormFactory formFactory, AbstractFormSection section, NamedArea entity, SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, null, style);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
+ * (java.lang.Object)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setEntity(NamedArea entity) {
+ selection_namedArea.setEntity(entity);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
+ * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void createControls(ICdmFormElement formElement, int style) {
+ selection_namedArea = new EntitySelectionFieldController<NamedArea>(new EntitySelectionField(formElement.getLayoutComposite(), SWT.NONE), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, "", null, EntitySelectionElement.NOTHING);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
+ * (java.lang.Object)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == selection_namedArea) {
+ setEntity(selection_namedArea.getSelection());
+ }
+ }
+}
formToolkit.paintBordersFor(gatheringEventDetailsElement);
xpndblcmpstNewExpandablecomposite_1.setClient(gatheringEventDetailsElement);
- ExpandableComposite xpndblcmpstNewExpandablecomposite_2 = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
- TableWrapData twd_xpndblcmpstNewExpandablecomposite_2 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
- twd_xpndblcmpstNewExpandablecomposite_2.grabHorizontal = true;
- xpndblcmpstNewExpandablecomposite_2.setLayoutData(twd_xpndblcmpstNewExpandablecomposite_2);
- formToolkit.paintBordersFor(xpndblcmpstNewExpandablecomposite_2);
- xpndblcmpstNewExpandablecomposite_2.setText("Collecting Areas");
-
ExpandableComposite xpndblcmpstFieldObservationDetails = formToolkit.createExpandableComposite(this, ExpandableComposite.TWISTIE);
TableWrapData twd_xpndblcmpstFieldObservationDetails = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
twd_xpndblcmpstFieldObservationDetails.grabHorizontal = true;
xpndblcmpstFieldObservationDetails.setLayoutData(twd_xpndblcmpstFieldObservationDetails);
formToolkit.paintBordersFor(xpndblcmpstFieldObservationDetails);
xpndblcmpstFieldObservationDetails.setText("Field Observation Details");
+ xpndblcmpstFieldObservationDetails.setExpanded(true);
+
+ FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(xpndblcmpstFieldObservationDetails, SWT.NONE);
+ formToolkit.adapt(fieldObservationDetailsElement);
+ formToolkit.paintBordersFor(fieldObservationDetailsElement);
+ xpndblcmpstFieldObservationDetails.setClient(fieldObservationDetailsElement);
}
protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
toggleableText_titleCache = new ToggleableTextFieldController(fieldObservationGeneralElement.getToggleableTextField(), getFormFactory(), formElement, entity.getTitleCache(), entity.isProtectedTitleCache(), style);
- selection_country = new EntitySelectionFieldController<NamedArea>(fieldObservationGeneralElement.getCountrySelectionField(), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, "Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
+ selection_country = new EntitySelectionFieldController<NamedArea>(fieldObservationGeneralElement.getCountrySelectionField(), getFormFactory(), getConversationHolder(), formElement, NamedArea.class, "Country", entity.getCountry(), EntitySelectionElement.NOTHING);
languageText_locality = new LanguageTextFieldController(fieldObservationGeneralElement.getTextLocality(), getFormFactory(), formElement, entity.getLocality());
element_point = new PointFieldController(fieldObservationGeneralElement.getPointField(),getFormFactory(), formElement, entity.getExactLocation(), style);
number_elevation = new NumberFieldController(fieldObservationGeneralElement.getTextElevation(), getFormFactory(), formElement, entity.getAbsoluteElevation());
// element_date = formFactory.createTimePeriodElement(formElement, "Date", entity.getGatheringPeriod(), style);
- selection_collector = new EntitySelectionFieldController<AgentBase>(fieldObservationGeneralElement.getCollectorSelectionField(), getFormFactory(), getConversationHolder(), formElement, AgentBase.class, "Collector", entity.getCollector(), EntitySelectionElement.ALL, style);
+ selection_collector = new EntitySelectionFieldController<AgentBase>(fieldObservationGeneralElement.getCollectorSelectionField(), getFormFactory(), getConversationHolder(), formElement, AgentBase.class, "Collector", entity.getCollector(), EntitySelectionElement.ALL);
text_collectingNumber = new TextFieldController(fieldObservationGeneralElement.getTextCollectingNumber(), getFormFactory(), formElement, entity.getFieldNumber(), null);
}
*/
package eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
/**
* @author pplitzner
private TextFieldController text_gatheringEventDescription;
- // private CollectingAreasDetailSection section_collectingAreas;
+ private CollectingAreasDetailSection section_collectingAreas;
/**
* <p>
number_distanceToGround = new NumberFieldController(gatheringEventDetailsElement.getText_DistanceToGround(), formFactory, this, (Integer)null);
number_distanceToWaterSurface = new NumberFieldController(gatheringEventDetailsElement.getText_DistanceToWaterSurface(), formFactory, this, (Integer)null);
text_gatheringEventDescription = new TextFieldController(gatheringEventDetailsElement.getText_GatheringEventDescription(), formFactory, this, null, null);
-// section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
-// section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// section_collectingAreas.setEntity(entity);
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+ section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_collectingAreas.setEntity(entity);
}
/** {@inheritDoc} */
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NamedAreaFieldController;
import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElement;
import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElementController;
return element;
}
+ public void createNamedAreaFieldController(AbstractFormSection parentElement, NamedArea namedArea, SelectionListener removeListener){
+// Object entity = HibernateProxyHelper.deproxy(versionableEntity); TODO deproxy necessary??
+ NamedAreaFieldController element = new NamedAreaFieldController(this, parentElement, namedArea, removeListener, SWT.NONE);
+ adapt(element);
+ parentElement.addElement(element);
+ }
+
/**
* <p>
* Creates a selection element for the given type T.
import java.util.Collection;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.location.NamedArea;
return "Add a collecting area";
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createElementComposite(java.lang.Object, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.graphics.Color)
+ */
+ @Override
+ protected void createElementComposite(NamedArea element, SelectionListener removeListener, Color backgroundColor) {
+ formFactory.createNamedAreaFieldController(this, element, removeListener);
+ }
+
}