Revision 8f36abc7
Added by Katja Luther over 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java | ||
---|---|---|
326 | 326 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection; |
327 | 327 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement; |
328 | 328 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection; |
329 |
import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedSourceElement; |
|
329 | 330 |
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement; |
330 | 331 |
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection; |
332 |
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceElement; |
|
331 | 333 |
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceAdvancedSection; |
332 | 334 |
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement; |
333 | 335 |
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement; |
... | ... | |
1959 | 1961 |
return section; |
1960 | 1962 |
} |
1961 | 1963 |
|
1964 |
public AdvancedSourceElement createAdvancedSourceDetailElement(ICdmFormElement parentElement, int style){ |
|
1965 |
AdvancedSourceElement element = new AdvancedSourceElement(this, parentElement); |
|
1966 |
addAndAdaptElement(parentElement, element); |
|
1967 |
return element; |
|
1968 |
} |
|
1969 |
|
|
1962 | 1970 |
public SingleSourceSection createSingleSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, String label, int style){ |
1963 | 1971 |
SingleSourceSection section = new SingleSourceSection(this, conversation, parentElement, cdmEntity, selectionProvider, style, label); |
1964 | 1972 |
addAndAdaptSection(parentElement, section); |
... | ... | |
2315 | 2323 |
return element; |
2316 | 2324 |
} |
2317 | 2325 |
|
2326 |
public NomenclaturalSourceElement createNomenclaturalSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity, String label){ |
|
2327 |
NomenclaturalSourceElement element = new NomenclaturalSourceElement(this, parentElement, cdmEntity, label); |
|
2328 |
addAndAdaptElement(parentElement, element); |
|
2329 |
return element; |
|
2330 |
} |
|
2331 |
|
|
2318 | 2332 |
public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){ |
2319 | 2333 |
TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement); |
2320 | 2334 |
addAndAdaptElement(parentElement, element); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java | ||
---|---|---|
210 | 210 |
@Override |
211 | 211 |
public void setBackground(Color color) { |
212 | 212 |
if (label != null) { |
213 |
label.setBackground(color); |
|
213 |
if (!label.isDisposed()){ |
|
214 |
label.setBackground(color); |
|
215 |
} |
|
214 | 216 |
} |
215 | 217 |
} |
216 | 218 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java | ||
---|---|---|
84 | 84 |
super.setText(StoreUtil.cleanTitleString(title)); |
85 | 85 |
} |
86 | 86 |
|
87 |
protected void createControlsByType(AbstractCdmDetailSection<ENTITY> formElement, Class<ENTITY> entityClass, int style) { |
|
87 |
public AbstractCdmDetailElement<ENTITY> getDetailElement() { |
|
88 |
return detailElement; |
|
89 |
} |
|
90 |
|
|
91 |
public void setDetailElement(AbstractCdmDetailElement<ENTITY> detailElement) { |
|
92 |
this.detailElement = detailElement; |
|
93 |
} |
|
94 |
|
|
95 |
protected void createControlsByType(AbstractCdmDetailSection<ENTITY> formElement, Class<ENTITY> entityClass, int style) { |
|
88 | 96 |
TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout(); |
89 | 97 |
layout.topMargin = 10; |
90 | 98 |
layout.numColumns = DEFAULT_NUM_COLUMNS; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/AdvancedSourceElement.java | ||
---|---|---|
48 | 48 |
protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) { |
49 | 49 |
Display display = Display.getCurrent(); |
50 | 50 |
Color background = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); |
51 |
if (entity instanceof DescriptionElementSource){ |
|
52 |
select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Name in Source", entity != null? ((DescriptionElementSource)entity).getNameUsedInSource(): null, EntitySelectionElement.DELETABLE, style); |
|
53 |
select_nameUsedInSource.setBackground(background); |
|
54 |
} |
|
51 | 55 |
|
52 |
|
|
56 |
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){ |
|
57 |
text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style); |
|
58 |
text_idNamespace.setBackground(background); |
|
59 |
} |
|
53 | 60 |
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){ |
54 | 61 |
text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?entity.getIdInSource():null, style); |
55 | 62 |
text_idInSource.setBackground(background); |
56 | 63 |
|
57 | 64 |
} |
58 |
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){ |
|
59 |
text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style); |
|
60 |
text_idNamespace.setBackground(background); |
|
61 |
} |
|
65 |
|
|
62 | 66 |
text_originaleNameString = formFactory.createTextWithLabelElement( |
63 | 67 |
formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL); |
64 | 68 |
|
65 | 69 |
text_originaleNameString.setBackground(background); |
66 |
if (entity instanceof DescriptionElementSource){ |
|
67 |
select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Name in Source", entity != null? ((DescriptionElementSource)entity).getNameUsedInSource(): null, EntitySelectionElement.DELETABLE, style); |
|
68 |
select_nameUsedInSource.setBackground(background); |
|
69 |
} |
|
70 |
|
|
70 | 71 |
|
71 | 72 |
|
72 | 73 |
externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName())); |
73 | 74 |
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3)); |
74 | 75 |
externalLinks.setEntity(entity); |
76 |
|
|
75 | 77 |
externalLinks.setBackground(background); |
76 | 78 |
addControl(externalLinks); |
77 | 79 |
addElement(externalLinks); |
... | ... | |
83 | 85 |
externalLinks.setEntity(entity); |
84 | 86 |
} |
85 | 87 |
|
88 |
public ExternalLinksSection getExternalLinks() { |
|
89 |
return externalLinks; |
|
90 |
} |
|
91 |
|
|
92 |
public void setExternalLinks(ExternalLinksSection externalLinks) { |
|
93 |
this.externalLinks = externalLinks; |
|
94 |
} |
|
95 |
|
|
86 | 96 |
@Override |
87 | 97 |
public void handleEvent(Object eventSource) { |
88 | 98 |
if (eventSource.equals(text_idInSource)){ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java | ||
---|---|---|
50 | 50 |
@Override |
51 | 51 |
protected void createControls(ICdmFormElement formElement, |
52 | 52 |
TaxonName entity, int style) { |
53 |
// selection_nomenclaturalReference = formFactory |
|
54 |
// .createSelectionElementWithAbbreviatedTitle(Reference.class, |
|
55 |
// getConversationHolder(), formElement, "Reference", |
|
56 |
// entity.getNomenclaturalReference(), |
|
57 |
// EntitySelectionElement.ALL, style); |
|
58 |
// text_referenceDetail = formFactory.createTextWithLabelElement( |
|
59 |
// formElement, "Ref. Detail", |
|
60 |
// entity.getNomenclaturalMicroReference(), style); |
|
61 | 53 |
|
62 |
sourceElement = formFactory.createOriginalSourceElement(formElement, entity, "Reference");
|
|
54 |
sourceElement = formFactory.createNomenclaturalSourceElement(formElement, entity, "Reference");
|
|
63 | 55 |
if (entity.getNomenclaturalSource() == null){ |
64 | 56 |
NomenclaturalSource source = NomenclaturalSource.NewNomenclaturalInstance(entity); |
65 | 57 |
entity.setNomenclaturalSource(source); |
... | ... | |
73 | 65 |
|
74 | 66 |
@Override |
75 | 67 |
public void handleEvent(Object eventSource) { |
76 |
// if (eventSource == selection_nomenclaturalReference) { |
|
77 |
// getEntity().setNomenclaturalReference( |
|
78 |
// selection_nomenclaturalReference.getSelection()); |
|
79 |
// } else if (eventSource == text_referenceDetail) { |
|
80 |
// getEntity().setNomenclaturalMicroReference( |
|
81 |
// text_referenceDetail.getText()); |
|
82 |
// } |
|
68 |
|
|
83 | 69 |
} |
84 | 70 |
|
85 | 71 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2020 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.reference; |
|
10 |
|
|
11 |
import org.eclipse.ui.forms.widgets.TableWrapData; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
14 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
15 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
|
16 |
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase; |
|
17 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
18 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
19 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
|
20 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
|
21 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
|
22 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
|
23 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author k.luther |
|
27 |
* @since Nov 11, 2020 |
|
28 |
*/ |
|
29 |
public class NomenclaturalSourceElement extends OriginalSourceElement { |
|
30 |
|
|
31 |
private EntitySelectionElementWithAbbreviatedTitle<Reference> selection_NomRef; |
|
32 |
|
|
33 |
/** |
|
34 |
* @param formFactory |
|
35 |
* @param formElement |
|
36 |
* @param cdmEntity |
|
37 |
* @param label |
|
38 |
*/ |
|
39 |
public NomenclaturalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity, |
|
40 |
String label) { |
|
41 |
super(formFactory, formElement, cdmEntity, label); |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) { |
|
47 |
|
|
48 |
entity = HibernateProxyHelper.deproxy(entity); |
|
49 |
// selection_Ref = formFactory.createSelectionElement(Reference.class, |
|
50 |
// formElement, label, null, |
|
51 |
// EntitySelectionElement.ALL, style, 100); |
|
52 |
selection_NomRef = formFactory.createSelectionElementWithAbbreviatedTitle(Reference.class, |
|
53 |
getConversationHolder(), formElement, "Reference", |
|
54 |
null, |
|
55 |
EntitySelectionElement.ALL, style); |
|
56 |
|
|
57 |
if (entity != null){ |
|
58 |
selection_NomRef.setEntity(entity.getCitation()); |
|
59 |
} |
|
60 |
selection_NomRef.setBackground(this.getPersistentBackground()); |
|
61 |
microReference = formFactory.createTextWithLabelElement(formElement, "Details", entity != null? entity.getCitationMicroReference(): "", style); |
|
62 |
microReference.setIndent(10); |
|
63 |
for (ICdmFormElement element: selection_NomRef.getElements()){ |
|
64 |
element.setBackground(getPersistentBackground()); |
|
65 |
} |
|
66 |
|
|
67 |
advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName())); |
|
68 |
TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1); |
|
69 |
layoutData.indent = 10; |
|
70 |
|
|
71 |
advancedSection.setLayoutData(layoutData); |
|
72 |
|
|
73 |
addControl(advancedSection); |
|
74 |
addElement(advancedSection); |
|
75 |
advancedSection.setBackground(this.getPersistentBackground()); |
|
76 |
advancedSection.setEntity(entity); |
|
77 |
advancedSection.setExpanded(true); |
|
78 |
advancedSection.getExternalLinksElement().setText("Link to protologue"); |
|
79 |
this.getLayoutComposite().layout(); |
|
80 |
|
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public EntitySelectionElement<Reference> getReferenceSelectionElement(){ |
|
85 |
return selection_NomRef; |
|
86 |
|
|
87 |
} |
|
88 |
@Override |
|
89 |
public void handleEvent(Object eventSource) { |
|
90 |
if (eventSource.equals(selection_NomRef)){ |
|
91 |
getEntity().setCitation(selection_NomRef.getEntity()); |
|
92 |
} |
|
93 |
super.handleEvent(eventSource); |
|
94 |
} |
|
95 |
|
|
96 |
|
|
97 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceAdvancedSection.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
19 | 19 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
20 | 20 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection; |
21 |
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection; |
|
21 | 22 |
|
22 | 23 |
/** |
23 | 24 |
* @author k.luther |
... | ... | |
34 | 35 |
protected AbstractCdmDetailElement<OriginalSourceBase> createCdmDetailElement( |
35 | 36 |
AbstractCdmDetailSection<OriginalSourceBase> parentElement, int style) { |
36 | 37 |
|
37 |
return new AdvancedSourceElement(getFormFactory(), parentElement);
|
|
38 |
return getFormFactory().createAdvancedSourceDetailElement(parentElement, style);
|
|
38 | 39 |
} |
39 | 40 |
|
40 | 41 |
@Override |
... | ... | |
54 | 55 |
getLayoutComposite().setLayout(layout); |
55 | 56 |
// setLayout(layout); |
56 | 57 |
} |
58 |
|
|
59 |
protected ExternalLinksSection getExternalLinksElement(){ |
|
60 |
return ((AdvancedSourceElement)this.getDetailElement()).getExternalLinks(); |
|
61 |
} |
|
57 | 62 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java | ||
---|---|---|
32 | 32 |
*/ |
33 | 33 |
public class OriginalSourceElement extends AbstractCdmDetailElement<OriginalSourceBase> implements IPropertyChangeListener{ |
34 | 34 |
|
35 |
private EntitySelectionElement<Reference> selection_Ref;
|
|
36 |
private TextWithLabelElement microReference;
|
|
37 |
private OriginalSourceAdvancedSection advancedSection;
|
|
38 |
private String label = "Source";
|
|
39 |
private CdmBase cdmEntity;
|
|
35 |
protected EntitySelectionElement<Reference> selection_Ref;
|
|
36 |
protected TextWithLabelElement microReference;
|
|
37 |
protected OriginalSourceAdvancedSection advancedSection;
|
|
38 |
protected String label = "Source";
|
|
39 |
protected CdmBase cdmEntity;
|
|
40 | 40 |
|
41 | 41 |
public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity, String label) { |
42 | 42 |
super(formFactory, formElement); |
Also available in: Unified diff
ref #9199: fix problems with nomenclatural reference details