Project

General

Profile

Download (2.01 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 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.supplemental;
10

    
11
import eu.etaxonomy.cdm.model.common.CdmBase;
12
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
13
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
14
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
15
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
16
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
17

    
18
/**
19
 * @author l.morris
20
 * @date 24 Jan 2012
21
 *
22
 */
23
public class CdmBaseElement extends AbstractCdmFormElement implements IEntityElement<CdmBase>{
24

    
25
	private TextWithLabelElement text_uuid;
26
	private TextWithLabelElement text_objectId;
27
	private CdmBase entity;
28
	/**
29
	 * @param formFactory
30
	 * @param formElement
31
	 */
32
	public CdmBaseElement(CdmFormFactory formFactory,
33
			ICdmFormElement formElement, CdmBase entity, int style) {
34

    
35
		super(formFactory, formElement);
36
		text_uuid = formFactory.createTextWithLabelElement(formElement, "UUID", null, style);
37
		text_uuid.setEditable(false);
38
		text_objectId = formFactory.createTextWithLabelElement(formElement, "Object ID", null, style);
39
		text_objectId.setEditable(false);
40
		setEntity(entity);
41
	}
42

    
43
	/* (non-Javadoc)
44
	 * @see eu.etaxonomy.taxeditor.ui.element.ISelectable#setSelected(boolean)
45
	 */
46
	@Override
47
	public void setSelected(boolean selected) {
48
		// this entity element is not likely to get selected
49
	}
50

    
51
	/* (non-Javadoc)
52
	 * @see eu.etaxonomy.taxeditor.ui.element.IEntityElement#getEntity()
53
	 */
54
	@Override
55
	public CdmBase getEntity() {
56
		return entity;
57
	}
58

    
59

    
60
	public void setEntity(CdmBase entity) {
61

    
62
		this.entity = entity;
63

    
64
		text_uuid.setText(entity != null ? entity.getUuid().toString() : "");
65
		text_objectId.setText(entity != null ? entity.getId()+"" : "");
66
	}
67
}
(7-7/21)