1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.ui.section.supplemental;
|
5
|
|
6
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
7
|
import org.eclipse.swt.events.SelectionListener;
|
8
|
import org.eclipse.ui.forms.widgets.ExpandableComposite;
|
9
|
|
10
|
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
|
11
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
12
|
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
|
13
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
14
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
15
|
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
|
16
|
|
17
|
/**
|
18
|
* @author n.hoffmann
|
19
|
* @created Nov 16, 2009
|
20
|
* @version 1.0
|
21
|
*/
|
22
|
public class IdentifiableSourceElement extends AbstractOriginalSourceElement<IdentifiableSource>{
|
23
|
|
24
|
public IdentifiableSourceElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, IdentifiableSource element,
|
25
|
SelectionListener removeListener, int style) {
|
26
|
super(cdmFormFactory, formElement, element, removeListener, style);
|
27
|
}
|
28
|
|
29
|
/** {@inheritDoc} */
|
30
|
@Override
|
31
|
public void createControls(ICdmFormElement formElement, int style) {
|
32
|
super.createControls(formElement, style);
|
33
|
externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
|
34
|
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
|
35
|
}
|
36
|
|
37
|
/** {@inheritDoc} */
|
38
|
@Override
|
39
|
public void setEntity(IdentifiableSource entity) {
|
40
|
super.setEntity(entity);
|
41
|
text_idInSource.setText(entity.getIdInSource());
|
42
|
text_idNamespace.setText(entity.getIdNamespace());
|
43
|
|
44
|
selection_reference.setEntity(entity.getCitation());
|
45
|
text_referenceDetail.setText(entity.getCitationMicroReference());
|
46
|
combo_origsourcetype.setSelection(entity.getType());
|
47
|
text_originaleNameString.setText(entity.getOriginalNameString());
|
48
|
}
|
49
|
|
50
|
/** {@inheritDoc} */
|
51
|
@Override
|
52
|
public void handleEvent(Object eventSource) {
|
53
|
if(eventSource == text_idInSource){
|
54
|
getEntity().setIdInSource(text_idInSource.getText());
|
55
|
}
|
56
|
else if(eventSource == text_idNamespace){
|
57
|
getEntity().setIdNamespace(text_idNamespace.getText());
|
58
|
}
|
59
|
if(eventSource == selection_reference){
|
60
|
getEntity().setCitation(selection_reference.getSelection());
|
61
|
AbstractUtility.getDetailsView(this.formFactory.getContext().get(EPartService.class)).
|
62
|
refreshSelection();
|
63
|
}
|
64
|
else if(eventSource == text_referenceDetail){
|
65
|
getEntity().setCitationMicroReference(text_referenceDetail.getText());
|
66
|
}
|
67
|
else if(eventSource == text_originaleNameString){
|
68
|
getEntity().setOriginalNameString(text_originaleNameString.getText());
|
69
|
} else if(eventSource == combo_origsourcetype){
|
70
|
getEntity().setType(combo_origsourcetype.getSelection());
|
71
|
}
|
72
|
}
|
73
|
}
|