Project

General

Profile

Download (2.55 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.section.supplemental;
5

    
6
import org.eclipse.swt.events.SelectionListener;
7

    
8
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
9
import eu.etaxonomy.taxeditor.store.StoreUtil;
10
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
11
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
12
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
13
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
14
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
15

    
16
/**
17
 * @author n.hoffmann
18
 * @created Nov 16, 2009
19
 * @version 1.0
20
 */
21
public class IdentifiableSourceElement extends AbstractOriginalSourceElement<IdentifiableSource>{
22

    
23
	public IdentifiableSourceElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, IdentifiableSource element,
24
			SelectionListener removeListener, int style) {
25
		super(cdmFormFactory, formElement, element, removeListener, style);
26
	}
27

    
28
	/** {@inheritDoc} */
29
	@Override
30
	public void createControls(ICdmFormElement formElement, int style) {
31
		super.createControls(formElement, style);
32
		externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, IdentifiableSource.class.getCanonicalName()));
33
        externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
34
	}
35

    
36
	/** {@inheritDoc} */
37
	@Override
38
	public void setEntity(IdentifiableSource entity) {
39
		super.setEntity(entity);
40
		text_idInSource.setText(entity.getIdInSource());
41
		text_idNamespace.setText(entity.getIdNamespace());
42

    
43
		selection_reference.setEntity(entity.getCitation());
44
		text_referenceDetail.setText(entity.getCitationMicroReference());
45
		combo_origsourcetype.setSelection(entity.getType());
46
		text_originaleNameString.setText(entity.getOriginalNameString());
47
	}
48

    
49
	/** {@inheritDoc} */
50
	@Override
51
	public void handleEvent(Object eventSource) {
52
		if(eventSource == text_idInSource){
53
			getEntity().setIdInSource(text_idInSource.getText());
54
		}
55
		else if(eventSource == text_idNamespace){
56
			getEntity().setIdNamespace(text_idNamespace.getText());
57
		}
58
		if(eventSource == selection_reference){
59
			getEntity().setCitation(selection_reference.getSelection());
60
		}
61
		else if(eventSource == text_referenceDetail){
62
			getEntity().setCitationMicroReference(text_referenceDetail.getText());
63
		}
64
		else if(eventSource == text_originaleNameString){
65
			getEntity().setOriginalNameString(text_originaleNameString.getText());
66
		} else if(eventSource == combo_origsourcetype){
67
			getEntity().setType(combo_origsourcetype.getSelection());
68
		}
69
	}
70
}
(13-13/20)