/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.element;
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.FeatureDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
* <p>
* CdmFormFactory class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Feb 24, 2010
* @version 1.0
return true;
}
};
-
+
/**
- *
+ *
* @author n.hoffmann
* @date Jan 25, 2010
*
}
/**
- *
+ *
* @author n.hoffmann
* @date Jan 25, 2010
*
* <p>
* Constructor for CdmFormFactory.
* </p>
- *
+ *
* @param display
* a {@link org.eclipse.swt.widgets.Display} object.
* @param selectionProvider
* <p>
* Constructor for CdmFormFactory.
* </p>
- *
+ *
* @param display
* a {@link org.eclipse.swt.widgets.Display} object.
*/
}
/**
- *
+ *
*/
private void init() {
boldFontHolder2 = new BoldFontHolder2();
/**
* Creates an instance initialized with the correct selectionProvider
- *
+ *
* Make sure to remove the instance when the entityComposite disposes via
* destroySelectionArbitrator(..)
- *
+ *
* @param entityElement
* a {@link eu.etaxonomy.taxeditor.ui.element.IEntityElement}
* object.
* <p>
* destroySelectionArbitrator
* </p>
- *
+ *
* @param selectionArbitrator
* a
* {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator}
* Adapts the {@link AbstractCdmFormElement}:<br>
* - sets the {@link IPropertyChangeListener}s handled by this class
* </p>
- *
+ *
* @param formElement
* a
* {@link eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement}
* <p>
* destroyElement
* </p>
- *
+ *
* @param formElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createEmptyCell
* </p>
- *
+ *
* @param parent
* a {@link org.eclipse.swt.widgets.Composite} object.
* @return a {@link org.eclipse.swt.widgets.Label} object.
* <p>
* createMultilineTextWithLabel
* </p>
- *
+ *
* @param labelString
* a {@link java.lang.String} object.
* @param textHeight
* <p>
* createMultiLanguageTextElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createTextWithLabelElement
* </p>
- *
+ *
* @param labelString
* a {@link java.lang.String} object.
* @param initialText
}
/**
- *
+ *
* @param parentElement
* @param labelString
* @param conversationEnabled
* <p>
* createIntegerTextWithLabelElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createLanguageStringWithLabelElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createLanguageStringWithLabelElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createTextElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createKeyValueViewerElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createTermComboElement
* </p>
- *
+ *
* @param termComboType
* a
* {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
* @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
* object.
*/
-
+
public <T extends DefinedTermBase> TermComboElement<T> createTermComboElement(Class<T> termComboType,
ICdmFormElement parentElement, String labelString, T selection, int style) {
TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termComboType, labelString,
parentElement.addElement(element);
return element;
}
-
+
/**
* <p>
* createTermComboElement
* </p>
- *
+ *
* @param termComboType
* a
* {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType}
* @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
* object.
*/
-
+
public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
- TermType termType,
+ TermType termType,
ICdmFormElement parentElement,
- String labelString,
- T selection,
+ String labelString,
+ T selection,
int style) {
TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, style);
adapt(element);
* <p>
* createEnumComboElement
* </p>
- *
+ *
* @param enumComboType
* a
* {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EnumComboType}
* <p>
* createBrowserElement
* </p>
- *
+ *
* @param imageUri
* a {@link java.net.URI} object.
* @param style
* <p>
* createImageElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createTextActionElement
* </p>
- *
+ *
* @param labelString
* a {@link java.lang.String} object.
* @param initialText
* <p>
* createCheckbox
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
/**
* Creates a section as a part of the form.
- *
+ *
* @return the section widget
* @param section
* a
* <p>
* createToggleableTextField
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createTimePeriodElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
parentElement.addElement(element);
return element;
}
-
+
/**
* <p>
* createGatheringEventUnitElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* object.
*/
public GatheringEventUnitElement createGatheringEventUnitElement(
- ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
String labelString,
- DerivedUnitFacade gatheringEvent,
- MinMaxTextSection.UnitType unitType,
+ DerivedUnitFacade gatheringEvent,
+ MinMaxTextSection.UnitType unitType,
int style) {
- GatheringEventUnitElement element = new GatheringEventUnitElement(this,
+ GatheringEventUnitElement element = new GatheringEventUnitElement(this,
parentElement,
- labelString,
- gatheringEvent,
+ labelString,
+ gatheringEvent,
unitType,
style);
adapt(element);
* <p>
* createPointElement
* </p>
- *
+ *
* @param style
* a int.
* @param parentElement
* <p>
* createDateDetailSection
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
adapt(section);
return section;
}
-
+
/**
* <p>
* createDateDetailSection
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createPartialElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* addSelectionListener
* </p>
- *
+ *
* @param listener
* a {@link org.eclipse.swt.events.SelectionListener} object.
*/
* <p>
* removeSelectionListener
* </p>
- *
+ *
* @param listener
* a {@link org.eclipse.swt.events.SelectionListener} object.
*/
* <p>
* addPropertyChangeListener
* </p>
- *
+ *
* @param listener
* a {@link org.eclipse.jface.util.IPropertyChangeListener}
* object.
* <p>
* removePropertyChangeListener
* </p>
- *
+ *
* @param listener
* a {@link org.eclipse.jface.util.IPropertyChangeListener}
* object.
* <p>
* createHorizontalSeparator
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createVersionElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
parentElement.addElement(element);
return element;
}
-
+
/**
* @param cdmBaseSection
* @param object
* <p>
* createVersionSection
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
adapt(section);
return section;
}
-
+
/**
* @param parent
* @param i
* <p>
* createEmptyElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createHeadlineSection
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
* <p>
* createParsingMessageElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
selectionProvider, style);
-
+
parentElement.addElement(section);
adapt(section);
return section;
-
+
}
-
- /**
- * @param definedTermClass
- * @param formElement
- * @param style
- * @return
- */
- public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass, AbstractCdmDetailSection parentElement, int style) {
- AbstractCdmDetailElement element = null;
-
- if (NamedArea.class.isAssignableFrom(definedTermClass)){
- element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
+
+ /**
+ * @param definedTermClass
+ * @param formElement
+ * @param style
+ * @return
+ */
+ public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
+ AbstractCdmDetailSection parentElement, int style) {
+ AbstractCdmDetailElement element = null;
+
+ if (NamedArea.class.isAssignableFrom(definedTermClass)) {
+ element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
+ } else if (definedTermClass.equals(Feature.class)) {
+ element = new FeatureDetailElement(this, parentElement);
} else {
- element = new DefinedTermDetailElement(this, parentElement);
- }
-
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
+ element = new DefinedTermDetailElement(this, parentElement);
+ }
+
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
//--------DetailSections---------
addAndAdaptSection(parentElement, section);
return section;
}
-
+
public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
addAndAdaptElement(parentElement, element);
return element;
}
-
-
+
+
public GeneralDetailElement createGeneralDetailElement(ICdmFormElement parentElement){
GeneralDetailElement element = new GeneralDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
* <p>
* createEntityCollectionElement
* </p>
- *
+ *
* @param removeListener
* a {@link org.eclipse.swt.events.SelectionListener} object.
* @param style
} else if (entity instanceof DefinedTerm) {
switch(((DefinedTerm)entity).getTermType()) {
case Scope:
- element = new ScopeElement(this,
- parentElement,
+ element = new ScopeElement(this,
+ parentElement,
(DefinedTerm) entity,
- removeListener,
+ removeListener,
style);
break;
case Modifier:
- element = new ModifierElement(this,
+ element = new ModifierElement(this,
parentElement,
- (DefinedTerm) entity,
- removeListener,
+ (DefinedTerm) entity,
+ removeListener,
style);
break;
default:
//FIXME : Actually we should through an exception here
element = null;
break;
-
+
}
} else if (entity instanceof Reference) {
element = new DescriptionSourceElement(this, parentElement, (Reference) entity, removeListener, style);
case LivingSpecimen:
case PreservedSpecimen:
case OtherSpecimen:
- element = new SpecimenCollectionDetailElement(this,
+ element = new SpecimenCollectionDetailElement(this,
parentElement,
- (DerivedUnit) entity,
- removeListener,
+ (DerivedUnit) entity,
+ removeListener,
style);
break;
default:
- element = new DerivedUnitElement(this,
+ element = new DerivedUnitElement(this,
parentElement,
- (DerivedUnit) entity,
- removeListener,
+ (DerivedUnit) entity,
+ removeListener,
style);
- }
+ }
} else if (entity instanceof NamedArea) {
element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
* <li>{@link NomenclaturalAuthorTeamSelectionElement} see
* {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
* </li>
- * </ul>
+ * </ul>
* </p>
- *
+ *
* @param clazz
* a {@link Class} object of the type that you want the selection
* element to handle
parentElement.addElement(element);
return element;
}
-
+
public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
parentElement.addElement(element);
return element;
}
-
+
public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
int mode, int style) {
parentElement.addElement(element);
return element;
}
-
-
+
+
/** {@inheritDoc} */
public LabelElement createLabel(ICdmFormElement parentElement, String text) {
LabelElement labelElement = new LabelElement(this, parentElement, text);
* <p>
* Getter for the field <code>selectionProvider</code>.
* </p>
- *
+ *
* @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
*/
public ISelectionProvider getSelectionProvider() {
* <p>
* createDetailedDescriptionDetailElement
* </p>
- *
+ *
* @param parentElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
/**
* Creates a styled text as a part of the form.
- *
+ *
* @param parent
* the text parent
* @param value
--- /dev/null
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.ui.section.vocabulary;\r
+\r
+import eu.etaxonomy.cdm.model.description.Feature;\r
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
+import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;\r
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 20 Dec 2011\r
+ *\r
+ */\r
+public class FeatureDetailElement extends DefinedTermDetailElement<Feature> {\r
+\r
+ private CheckboxElement supportsTextData;\r
+\r
+ private CheckboxElement supportsQuantitativeData;\r
+\r
+ private CheckboxElement supportsDistribution;\r
+\r
+ private CheckboxElement supportsIndividualAssociation;\r
+\r
+ private CheckboxElement supportsTaxonInteraction;\r
+\r
+ private CheckboxElement supportsCategoricalData;\r
+\r
+ /**\r
+ * @param formFactory\r
+ * @param formElement\r
+ */\r
+ public FeatureDetailElement(CdmFormFactory formFactory,\r
+ ICdmFormElement formElement) {\r
+ super(formFactory, formElement);\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, eu.etaxonomy.cdm.model.common.TermBase, int)\r
+ */\r
+ @Override\r
+ protected void createControls(ICdmFormElement formElement, Feature entity, int style) {\r
+ super.createControls(formElement, entity, style);\r
+ supportsTextData = formFactory.createCheckbox(formElement, "Supports Text Data", entity.isSupportsTextData(), style);\r
+ supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitive Data", entity.isSupportsQuantitativeData(), style);\r
+ supportsDistribution = formFactory.createCheckbox(formElement, "Supports Distribution", entity.isSupportsDistribution(), style);\r
+ supportsIndividualAssociation = formFactory.createCheckbox(formElement, "Supports Individual Association", entity.isSupportsIndividualAssociation(), style);\r
+ supportsTaxonInteraction = formFactory.createCheckbox(formElement, "Supports Taxon Interaction", entity.isSupportsTaxonInteraction(), style);\r
+ supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data", entity.isSupportsCategoricalData(), style);\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement#handleEvent(java.lang.Object)\r
+ */\r
+ @Override\r
+ public void handleEvent(Object eventSource) {\r
+ super.handleEvent(eventSource);\r
+ if(eventSource == supportsTextData){\r
+ getEntity().setSupportsTextData(supportsTextData.getSelection());\r
+ }\r
+ else if(eventSource == supportsQuantitativeData){\r
+ getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());\r
+ }\r
+ else if(eventSource == supportsDistribution){\r
+ getEntity().setSupportsDistribution(supportsDistribution.getSelection());\r
+ }\r
+ else if(eventSource == supportsIndividualAssociation){\r
+ getEntity().setSupportsIndividualAssociation(supportsIndividualAssociation.getSelection());\r
+ }\r
+ else if(eventSource == supportsTaxonInteraction){\r
+ getEntity().setSupportsTaxonInteraction(supportsTaxonInteraction.getSelection());\r
+ }\r
+ else if(eventSource == supportsCategoricalData){\r
+ getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());\r
+ }\r
+ }\r
+\r
+}\r