Project

General

Profile

Download (2.42 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
import org.eclipse.ui.forms.widgets.ExpandableComposite;
8

    
9
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
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

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

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

    
27
	/** {@inheritDoc} */
28
	@Override
29
	public void createControls(ICdmFormElement formElement, int style) {
30
		super.createControls(formElement, style);
31
		externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
32
        externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
33
	}
34

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

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

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