X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/ccc7ac6f2d14106f291ed39daebd4e59e7fb78f0..fe61f73d8387bbfcd82c7c073746e62cc96af787:/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java index c629f3582..e4b2e3874 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java @@ -37,6 +37,7 @@ import org.eclipse.ui.forms.widgets.ExpandableComposite; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.internal.forms.widgets.FormFonts; +import org.joda.time.DateTime; import org.joda.time.Partial; import org.springframework.security.core.GrantedAuthority; @@ -56,10 +57,12 @@ import eu.etaxonomy.cdm.model.common.Group; import eu.etaxonomy.cdm.model.common.ICdmBase; import eu.etaxonomy.cdm.model.common.IEnumTerm; import eu.etaxonomy.cdm.model.common.IdentifiableSource; +import eu.etaxonomy.cdm.model.common.Identifier; import eu.etaxonomy.cdm.model.common.Language; import eu.etaxonomy.cdm.model.common.LanguageString; import eu.etaxonomy.cdm.model.common.Marker; import eu.etaxonomy.cdm.model.common.TermType; +import eu.etaxonomy.cdm.model.common.TermVocabulary; import eu.etaxonomy.cdm.model.common.TimePeriod; import eu.etaxonomy.cdm.model.common.User; import eu.etaxonomy.cdm.model.common.VersionableEntity; @@ -84,6 +87,7 @@ import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.cdm.model.media.MediaRepresentation; import eu.etaxonomy.cdm.model.media.MediaRepresentationPart; import eu.etaxonomy.cdm.model.media.Rights; +import eu.etaxonomy.cdm.model.molecular.DnaSample; import eu.etaxonomy.cdm.model.name.NameRelationship; import eu.etaxonomy.cdm.model.name.NameTypeDesignation; import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; @@ -95,10 +99,11 @@ import eu.etaxonomy.cdm.model.taxon.SynonymRelationship; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.strategy.parser.ParserProblem; -import eu.etaxonomy.taxeditor.model.AbstractUtility; +import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType; +import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement; import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled; import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement; import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement; @@ -168,7 +173,8 @@ import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection; import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection; import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection; import eu.etaxonomy.taxeditor.ui.section.media.ImageFileElement; -import eu.etaxonomy.taxeditor.ui.section.media.MediaElement; +import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement; +import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement; import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationElement; import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartElement; import eu.etaxonomy.taxeditor.ui.section.media.MediaRepresentationPartSection; @@ -214,9 +220,12 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSectio import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement; +import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection; +import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement; +import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection; @@ -234,11 +243,16 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDeta import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection; +import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.CurrentSampleDesignationDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement; +import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement; +import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection; +import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationHistoryDetailSection; +import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationTextDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection; @@ -249,12 +263,8 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailS import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection; -import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailElement; -import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection; import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement; import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection; -import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailElement; -import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection; import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement; import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection; import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement; @@ -438,7 +448,7 @@ public class CdmFormFactory extends FormToolkit { if (selectionProvider != null) { selectionProvider.removeSelectionChangedListener(selectionArbitrator); } else { - AbstractUtility.error(this.getClass(), + MessagingUtils.error(this.getClass(), "Tried to destroy a selection listener from this factories listeners but was null", null); } } @@ -528,31 +538,6 @@ public class CdmFormFactory extends FormToolkit { return this.createLabel(parent, null); } - /** - *
- * createMultilineTextWithLabel - *
- * - * @param labelString - * a {@link java.lang.String} object. - * @param textHeight - * a int. - * @param style - * a int. - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} - * object. - */ - public TextWithLabelElement createMultilineTextWithLabel(ICdmFormElement parentElement, String labelString, - int textHeight, int style) { - TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, style); - adapt(element); - parentElement.addElement(element); - return element; - } - /** ** createMultiLanguageTextElement @@ -651,7 +636,16 @@ public class CdmFormFactory extends FormToolkit { initialText = ""; } - TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, textLimit, style); + TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, + textLimit, style); + adapt(element); + parentElement.addElement(element); + return element; + } + + public TextWithLabelElement createMultiLineTextWithLabel(ICdmFormElement parentElement, String labelString, + int textHeight, int style) { + TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, true, style); adapt(element); parentElement.addElement(element); return element; @@ -726,79 +720,15 @@ public class CdmFormFactory extends FormToolkit { return element; } - /** - *
- * createLanguageStringWithLabelElement - *
- * - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @param labelString - * a {@link java.lang.String} object. - * @param languageString - * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object. - * @param style - * a int. - * @return a - * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement} - * object. - */ public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement, String labelString, LanguageString languageString, int style) { - LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString, - languageString, style); - adapt(element); - parentElement.addElement(element); - return element; + return createLanguageStringWithLabelElement(parentElement, labelString, languageString, null, false, style); } - /** - *- * createLanguageStringWithLabelElement - *
- * - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @param labelString - * a {@link java.lang.String} object. - * @param languageString - * a {@link eu.etaxonomy.cdm.model.common.LanguageString} object. - * @param height - * a int. - * @param style - * a int. - * @return a - * {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement} - * object. - */ public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement, - String labelString, LanguageString languageString, int height, int style) { + String labelString, LanguageString languageString, Integer height, boolean isMultiLine, int style) { LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString, - languageString, height, style); - adapt(element); - parentElement.addElement(element); - return element; - } - - /** - *- * createTextElement - *
- * - * @param parentElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} - * object. - * @param initialText - * a {@link java.lang.String} object. - * @param style - * a int. - * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} - * object. - */ - public TextWithLabelElement createTextElement(ICdmFormElement parentElement, String initialText, int style) { - TextWithLabelElement element = new TextWithLabelElement(this, parentElement, null, initialText, null, style); + languageString, height, isMultiLine, style); adapt(element); parentElement.addElement(element); return element; @@ -897,6 +827,41 @@ public class CdmFormFactory extends FormToolkit { return element; } + /** + *+ * createTermComboElement + *
+ * + * @param termComboType + * a + * {@link eu.eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.TermComboType} + * object. + * @param parentElement + * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} + * object. + * @param labelString + * a {@link java.lang.String} object. + * @param selection + * a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} + * object. + * @param style + * a int. + * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement} + * object. + */ + + public
* createEnumComboElement
@@ -1298,7 +1263,7 @@ public class CdmFormFactory extends FormToolkit {
*/
public void removeSelectionListener(SelectionListener listener) {
if (listener == null) {
- AbstractUtility.error(this.getClass(),
+ MessagingUtils.error(this.getClass(),
"Tried to remove a selection listener from this factories listeners but was null", null);
} else {
selectionListenerList.remove(listener);
@@ -1439,8 +1404,8 @@ public class CdmFormFactory extends FormToolkit {
* object.
* @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
*/
- public EmptyElement createEmptyElement(ICdmFormElement parentElement) {
- EmptyElement element = new EmptyElement(this, parentElement, null, SWT.NULL);
+ public EmptyElement createEmptyElement(ICdmFormElement parentElement, String emptyText) {
+ EmptyElement element = new EmptyElement(this, parentElement, emptyText, SWT.NULL);
adapt(element);
parentElement.addElement(element);
return element;
@@ -1629,6 +1594,18 @@ public class CdmFormFactory extends FormToolkit {
return section;
}
+ public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
+ public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
@@ -1761,18 +1738,6 @@ public class CdmFormFactory extends FormToolkit {
return section;
}
- public SpecimenScanGeneralDetailSection createSpecimenScanGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- SpecimenScanGeneralDetailSection section = new SpecimenScanGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
-
- public LivingPlantPhotoGeneralDetailSection createLivingPlantPhotoGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- LivingPlantPhotoGeneralDetailSection section = new LivingPlantPhotoGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
-
public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
@@ -1803,6 +1768,12 @@ public class CdmFormFactory extends FormToolkit {
return section;
}
+ public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public PreservedSpecimenDeterminationDetailSection createPreservedSpecimenDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
PreservedSpecimenDeterminationDetailSection section = new PreservedSpecimenDeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
@@ -2039,6 +2010,12 @@ public class CdmFormFactory extends FormToolkit {
return element;
}
+ public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
+ TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
+ addAndAdaptElement(parentElement, element);
+ return element;
+ }
+
public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
@@ -2105,24 +2082,17 @@ public class CdmFormFactory extends FormToolkit {
return element;
}
- public SpecimenScanGeneralDetailElement createSpecimenScanGeneralDetailElement(ICdmFormElement parentElement){
- SpecimenScanGeneralDetailElement element = new SpecimenScanGeneralDetailElement(this, parentElement);
- addAndAdaptElement(parentElement, element);
- return element;
- }
-
- public LivingPlantPhotoGeneralDetailElement createLivingPlantPhotoGeneralDetailElement(ICdmFormElement parentElement){
- LivingPlantPhotoGeneralDetailElement element = new LivingPlantPhotoGeneralDetailElement(this, parentElement);
- addAndAdaptElement(parentElement, element);
- return element;
- }
-
public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return element;
}
+ public MediaDetailElement createMediaDetailElement(ICdmFormElement parentElement){
+ MediaDetailElement mediaDetailElement = new MediaDetailElement(this, parentElement);
+ addAndAdaptElement(parentElement, mediaDetailElement);
+ return mediaDetailElement;
+ }
public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
@@ -2143,6 +2113,12 @@ public class CdmFormFactory extends FormToolkit {
return element;
}
+ public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
+ OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
+ addAndAdaptElement(parentElement, element);
+ return element;
+ }
+
public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
@@ -2161,6 +2137,12 @@ public class CdmFormFactory extends FormToolkit {
return element;
}
+ public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
+ SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
+ addAndAdaptElement(parentElement, element);
+ return element;
+ }
+
/**
* @param parentElement
* @param element
@@ -2315,6 +2297,12 @@ public class CdmFormFactory extends FormToolkit {
return section;
}
+ public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+ CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
@@ -2327,6 +2315,12 @@ public class CdmFormFactory extends FormToolkit {
return section;
}
+ public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+ SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
@@ -2432,7 +2426,7 @@ public class CdmFormFactory extends FormToolkit {
} else if (entity instanceof Marker) {
element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
} else if (entity instanceof Media) {
- element = new MediaElement(this, parentElement, (Media) entity, removeListener, style);
+ element = new MediaMetaElement(this, parentElement, (Media) entity, removeListener, style);
} else if (entity instanceof MediaRepresentation) {
element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
style);
@@ -2537,16 +2531,20 @@ public class CdmFormFactory extends FormToolkit {
if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
}
+ } else if (entity instanceof Identifier) {
+ element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier
* Getter for the field selectionProvider
.