merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / supplemental / CdmBaseElement.java
1 // $Id$
2 /**
3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.ui.section.supplemental;
11
12 import eu.etaxonomy.cdm.model.common.CdmBase;
13 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
14 import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
15 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
16 import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
17 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
18
19 /**
20 * @author l.morris
21 * @date 24 Jan 2012
22 *
23 */
24 public class CdmBaseElement extends AbstractCdmFormElement implements IEntityElement<CdmBase>{
25
26 private TextWithLabelElement text_uuid;
27 private TextWithLabelElement text_objectId;
28 private CdmBase entity;
29 /**
30 * @param formFactory
31 * @param formElement
32 */
33 public CdmBaseElement(CdmFormFactory formFactory,
34 ICdmFormElement formElement, CdmBase entity, int style) {
35
36 super(formFactory, formElement);
37 text_uuid = formFactory.createTextWithLabelElement(formElement, "UUID", null, style);
38 text_objectId = formFactory.createTextWithLabelElement(formElement, "Object ID", null, style);
39 setEntity(entity);
40 }
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.taxeditor.ui.element.ISelectable#setSelected(boolean)
44 */
45 @Override
46 public void setSelected(boolean selected) {
47 // this entity element is not likely to get selected
48 }
49
50 /* (non-Javadoc)
51 * @see eu.etaxonomy.taxeditor.ui.element.IEntityElement#getEntity()
52 */
53 @Override
54 public CdmBase getEntity() {
55 return entity;
56 }
57
58
59 public void setEntity(CdmBase entity) {
60
61 this.entity = entity;
62
63 text_uuid.setText(entity != null ? entity.getUuid().toString() : "");
64 text_objectId.setText(entity != null ? entity.getId()+"" : "");
65 }
66 }