/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.element;
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailElement;
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}
* @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
* object.
*/
- public <T extends IEnumTerm> EnumComboElement<T> createEnumComboElement(
+ public <T extends IEnumTerm<T>> EnumComboElement<T> createEnumComboElement(
Class<T> enumComboType, ICdmFormElement parentElement,
int style) {
EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
* <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---------
return section;
}
- public FieldObservationDetailSection createFieldObservationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public FieldUnitDetailSection createFieldUnitDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ FieldUnitDetailSection section = new FieldUnitDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
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);
return section;
}
- public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public FieldUnitDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ FieldUnitDetailSection section = new FieldUnitDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
addAndAdaptElement(parentElement, element);
return element;
}
-
-
+
+
public GeneralDetailElement createGeneralDetailElement(ICdmFormElement parentElement){
GeneralDetailElement element = new GeneralDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return element;
}
- public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) {
- FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement);
+ public FieldUnitDetailElement createFieldUnitDetailElement(ICdmFormElement parentElement) {
+ FieldUnitDetailElement element = new FieldUnitDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return 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