Revision 809f6237
Added by Katja Luther about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java | ||
---|---|---|
149 | 149 |
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection; |
150 | 150 |
import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement; |
151 | 151 |
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection; |
152 |
import eu.etaxonomy.taxeditor.ui.section.description.CommonNameSourceElement; |
|
152 | 153 |
import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement; |
153 | 154 |
import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection; |
154 | 155 |
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement; |
... | ... | |
351 | 352 |
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection; |
352 | 353 |
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement; |
353 | 354 |
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection; |
355 |
import eu.etaxonomy.taxeditor.ui.selection.CommonNameReferenceSelectionElement; |
|
354 | 356 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
355 | 357 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle; |
356 | 358 |
import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement; |
... | ... | |
804 | 806 |
parentElement.addElement(element); |
805 | 807 |
return element; |
806 | 808 |
} |
809 |
public UriWithLabelElement createUriWithLabelElement(ICdmFormElement parentElement, String labelString, |
|
810 |
URI initialUri,Integer textHeight, int style) { |
|
811 |
UriWithLabelElement element = new UriWithLabelElement(this, parentElement, labelString, initialUri, textHeight, style); |
|
812 |
adapt(element); |
|
813 |
parentElement.addElement(element); |
|
814 |
return element; |
|
815 |
} |
|
816 |
|
|
807 | 817 |
|
808 | 818 |
/** |
809 | 819 |
* @param element |
... | ... | |
1227 | 1237 |
String initialText, boolean initialState, int style) { |
1228 | 1238 |
ToggleableTextElement element = new ToggleableTextElement(this, parentElement, labelString, initialText, |
1229 | 1239 |
initialState, style | orientation); |
1240 |
|
|
1230 | 1241 |
adapt(element); |
1231 | 1242 |
parentElement.addElement(element); |
1232 | 1243 |
return element; |
... | ... | |
2715 | 2726 |
style); |
2716 | 2727 |
} else if (entity instanceof Rights) { |
2717 | 2728 |
element = new RightsElement(this, parentElement, (Rights) entity, removeListener, style); |
2729 |
} else if (entity instanceof DescriptionElementSource && parentElement.getEntity() instanceof CommonTaxonName) { |
|
2730 |
element = new CommonNameSourceElement(this, parentElement, (DescriptionElementSource) entity, |
|
2731 |
removeListener, style); |
|
2718 | 2732 |
} else if (entity instanceof DescriptionElementSource) { |
2719 | 2733 |
element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity, |
2720 |
removeListener, style); |
|
2734 |
removeListener, style, false);
|
|
2721 | 2735 |
} else if (entity instanceof TaxonNodeAgentRelation) { |
2722 | 2736 |
element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity, |
2723 | 2737 |
removeListener,backgroundColor, style); |
... | ... | |
2928 | 2942 |
// ConversationHolder conversation, |
2929 | 2943 |
ICdmFormElement parentElement, String labelString, T selection, int mode, |
2930 | 2944 |
int style) { |
2931 |
EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, //conversation,
|
|
2945 |
EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, |
|
2932 | 2946 |
parentElement, clazz, |
2933 | 2947 |
labelString, selection, mode, style); |
2934 | 2948 |
adapt(element); |
... | ... | |
2936 | 2950 |
return element; |
2937 | 2951 |
} |
2938 | 2952 |
|
2953 |
public CommonNameReferenceSelectionElement createCommonNameReferenceSelectionElement(ICdmFormElement parentElement, String labelString, Reference selection, int mode, |
|
2954 |
int style) { |
|
2955 |
CommonNameReferenceSelectionElement element = new CommonNameReferenceSelectionElement(this, |
|
2956 |
parentElement, labelString, selection, mode, style); |
|
2957 |
adapt(element); |
|
2958 |
parentElement.addElement(element); |
|
2959 |
return element; |
|
2960 |
} |
|
2961 |
|
|
2939 | 2962 |
/** |
2940 | 2963 |
* <p> |
2941 | 2964 |
* Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label. |
... | ... | |
3009 | 3032 |
return labelElement; |
3010 | 3033 |
} |
3011 | 3034 |
|
3035 |
|
|
3036 |
|
|
3012 | 3037 |
// public DateElementFormElement createDateElementForm(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){ |
3013 | 3038 |
// Label label = new Label(formElement.getLayoutComposite(), style); |
3014 | 3039 |
// label.setText(labelText+" (yyyy-MM-dd)"); |
... | ... | |
3151 | 3176 |
|
3152 | 3177 |
|
3153 | 3178 |
|
3179 |
|
|
3180 |
|
|
3154 | 3181 |
// public RichTextWithLabelElement createRichTextLabelElement(ICdmFormElement parentElement, String labelString, String initialText, int textHeight, int style) { |
3155 | 3182 |
// RichTextWithLabelElement element = new RichTextWithLabelElement(this, parentElement, labelString, |
3156 | 3183 |
// initialText, textHeight, style); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/CommonNameSourceElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.section.description; |
|
10 |
|
|
11 |
import org.eclipse.swt.events.SelectionListener; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.description.DescriptionElementSource; |
|
14 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
|
15 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
16 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
17 |
|
|
18 |
/** |
|
19 |
* @author k.luther |
|
20 |
* @since 17.09.2018 |
|
21 |
* |
|
22 |
*/ |
|
23 |
public class CommonNameSourceElement extends DescriptionElementSourceElement { |
|
24 |
|
|
25 |
/** |
|
26 |
* @param cdmFormFactory |
|
27 |
* @param formElement |
|
28 |
* @param element |
|
29 |
* @param removeListener |
|
30 |
* @param style |
|
31 |
*/ |
|
32 |
public CommonNameSourceElement(CdmFormFactory cdmFormFactory, AbstractFormSection<?> formElement, |
|
33 |
DescriptionElementSource element, SelectionListener removeListener, int style) { |
|
34 |
super(cdmFormFactory, formElement, element, removeListener, style, true); |
|
35 |
|
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public void createControls(ICdmFormElement formElement, int style) { |
|
40 |
this.isCommonNameReference = true; |
|
41 |
super.createControls(formElement, style); |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementSourceElement.java | ||
---|---|---|
37 | 37 |
|
38 | 38 |
public DescriptionElementSourceElement(CdmFormFactory cdmFormFactory, |
39 | 39 |
AbstractFormSection<?> formElement, DescriptionElementSource element, |
40 |
SelectionListener removeListener, int style) { |
|
41 |
super(cdmFormFactory, formElement, element, removeListener, style); |
|
40 |
SelectionListener removeListener, int style, boolean isCommonNameReference) {
|
|
41 |
super(cdmFormFactory, formElement, element, removeListener, style, isCommonNameReference);
|
|
42 | 42 |
formFactory.createSelectionArbitrator(this); |
43 | 43 |
} |
44 | 44 |
|
... | ... | |
83 | 83 |
} else if (eventSource == text_idNamespace) { |
84 | 84 |
getEntity().setIdNamespace(text_idNamespace.getText()); |
85 | 85 |
} else if (eventSource == selection_reference) { |
86 |
getEntity().setCitation(selection_reference.getSelection());
|
|
86 |
getEntity().setCitation(selection_reference.getSelection());
|
|
87 | 87 |
} else if (eventSource == text_referenceDetail) { |
88 | 88 |
getEntity().setCitationMicroReference( |
89 | 89 |
text_referenceDetail.getText()); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractOriginalSourceElement.java | ||
---|---|---|
39 | 39 |
public AbstractOriginalSourceElement(CdmFormFactory formFactory, |
40 | 40 |
AbstractFormSection section, |
41 | 41 |
T element, SelectionListener removeListener, |
42 |
int style) { |
|
43 |
super(formFactory, section, element, removeListener, style); |
|
42 |
int style, boolean isCommonNameReference) {
|
|
43 |
super(formFactory, section, element, removeListener, style, isCommonNameReference);
|
|
44 | 44 |
} |
45 | 45 |
|
46 |
public AbstractOriginalSourceElement(CdmFormFactory formFactory, |
|
47 |
AbstractFormSection section, |
|
48 |
T element, SelectionListener removeListener, |
|
49 |
int style) { |
|
50 |
super(formFactory, section, element, removeListener, style); |
|
51 |
} |
|
52 |
|
|
46 | 53 |
/** |
47 | 54 |
* {@inheritDoc} |
48 | 55 |
*/ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractReferencedEntityElement.java | ||
---|---|---|
36 | 36 |
protected EntitySelectionElement<Reference> selection_reference; |
37 | 37 |
protected TextWithLabelElement text_referenceDetail; |
38 | 38 |
|
39 |
protected boolean isCommonNameReference = false; |
|
40 |
|
|
39 | 41 |
public AbstractReferencedEntityElement(CdmFormFactory formFactory, |
40 | 42 |
AbstractFormSection section, T entity, |
41 |
SelectionListener removeListener, int style) { |
|
43 |
SelectionListener removeListener, int style, boolean isCommonNameReference) {
|
|
42 | 44 |
super(formFactory, section, entity, removeListener, null, style); |
43 | 45 |
// make this element selectable |
44 | 46 |
if(formFactory.getSelectionProvider() != null){ |
45 | 47 |
selectionArbitrator = formFactory.createSelectionArbitrator(this); |
46 | 48 |
} |
49 |
this.isCommonNameReference = isCommonNameReference; |
|
47 | 50 |
} |
48 | 51 |
|
52 |
public AbstractReferencedEntityElement(CdmFormFactory formFactory, |
|
53 |
AbstractFormSection section, T entity, |
|
54 |
SelectionListener removeListener, int style) { |
|
55 |
super(formFactory, section, entity, removeListener, null, style); |
|
56 |
// make this element selectable |
|
57 |
if(formFactory.getSelectionProvider() != null){ |
|
58 |
selectionArbitrator = formFactory.createSelectionArbitrator(this); |
|
59 |
} |
|
60 |
|
|
61 |
} |
|
62 |
|
|
63 |
|
|
49 | 64 |
/** {@inheritDoc} */ |
50 | 65 |
@Override |
51 | 66 |
public void createControls(ICdmFormElement formElement, int style) { |
52 |
selection_reference = formFactory |
|
53 |
.createSelectionElement(Reference.class,//getConversationHolder(), |
|
54 |
formElement, "Reference", |
|
55 |
null, EntitySelectionElement.ALL, style); |
|
67 |
if (isCommonNameReference){ |
|
68 |
selection_reference = formFactory |
|
69 |
.createCommonNameReferenceSelectionElement(formElement, "Reference", |
|
70 |
null, EntitySelectionElement.ALL, style); |
|
71 |
}else{ |
|
72 |
selection_reference = formFactory |
|
73 |
.createSelectionElement(Reference.class,//getConversationHolder(), |
|
74 |
formElement, "Reference", |
|
75 |
null, EntitySelectionElement.ALL, style); |
|
76 |
} |
|
77 |
|
|
56 | 78 |
text_referenceDetail = formFactory.createTextWithLabelElement( |
57 | 79 |
formElement, "Reference Detail", null, SWT.NULL); |
58 | 80 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/CommonNameReferenceSelectionElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2018 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.taxeditor.ui.selection; |
|
10 |
|
|
11 |
import org.eclipse.swt.events.SelectionEvent; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.common.Marker; |
|
14 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
|
15 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
16 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
17 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; |
|
18 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
19 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author k.luther |
|
23 |
* @since 17.09.2018 |
|
24 |
* |
|
25 |
*/ |
|
26 |
public class CommonNameReferenceSelectionElement extends EntitySelectionElement<Reference> { |
|
27 |
|
|
28 |
/** |
|
29 |
* @param formFactory |
|
30 |
* @param parentElement |
|
31 |
* @param clazz |
|
32 |
* @param labelString |
|
33 |
* @param entity |
|
34 |
* @param mode |
|
35 |
* @param style |
|
36 |
*/ |
|
37 |
public CommonNameReferenceSelectionElement(CdmFormFactory formFactory, ICdmFormElement parentElement, |
|
38 |
String labelString, Reference entity, int mode, int style) { |
|
39 |
super(formFactory, parentElement, Reference.class, labelString, entity, mode, style); |
|
40 |
|
|
41 |
} |
|
42 |
|
|
43 |
|
|
44 |
@Override |
|
45 |
public void widgetSelected(SelectionEvent e) { |
|
46 |
if (e.getSource().equals(button_selection) ){ |
|
47 |
Reference selection = SelectionDialogFactory.getSelectionFromDialog(Reference.class, getShell(), //getConversationHolder(), |
|
48 |
getEntity(), getParentElement()); |
|
49 |
boolean alreadyMarked = false; |
|
50 |
if (selection != null){ |
|
51 |
for (Marker marker: selection.getMarkers()){ |
|
52 |
if (marker.getMarkerType().equals(MarkerType.COMMON_NAME_REFERENCE())){ |
|
53 |
alreadyMarked = true; |
|
54 |
break; |
|
55 |
} |
|
56 |
} |
|
57 |
if (!alreadyMarked){ |
|
58 |
selection.addMarker(Marker.NewInstance(MarkerType.COMMON_NAME_REFERENCE(), true)); |
|
59 |
} |
|
60 |
|
|
61 |
setSelectionInternal(selection); |
|
62 |
} |
|
63 |
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true); |
|
64 |
}else{ |
|
65 |
Reference selection = SelectionDialogFactory.getSelectionFromExtDialog(Reference.class, getShell(),//null, |
|
66 |
getParentElement()); |
|
67 |
setSelectionInternal(selection); |
|
68 |
} |
|
69 |
|
|
70 |
} |
|
71 |
} |
Also available in: Unified diff
ref #7345: every reference used for a common name gets a marker 'common name reference'