2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
;
12 import org
.eclipse
.swt
.SWT
;
13 import org
.eclipse
.swt
.events
.SelectionListener
;
15 import eu
.etaxonomy
.cdm
.model
.common
.ReferencedEntityBase
;
16 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
17 import eu
.etaxonomy
.taxeditor
.ui
.element
.AbstractFormSection
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.element
.ISelectableElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.SelectionArbitrator
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.TextWithLabelElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractEntityCollectionElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
28 * @created Mar 25, 2010
31 public abstract class AbstractReferencedEntityElement
<T
extends ReferencedEntityBase
>
32 extends AbstractEntityCollectionElement
<T
> implements ISelectableElement
{
34 private SelectionArbitrator selectionArbitrator
;
36 protected EntitySelectionElement
<Reference
> selection_reference
;
37 protected TextWithLabelElement text_referenceDetail
;
39 public AbstractReferencedEntityElement(CdmFormFactory formFactory
,
40 AbstractFormSection section
, T entity
,
41 SelectionListener removeListener
, int style
) {
42 super(formFactory
, section
, entity
, removeListener
, null, style
);
43 // make this element selectable
44 if(formFactory
.getSelectionProvider() != null){
45 selectionArbitrator
= formFactory
.createSelectionArbitrator(this);
51 public void createControls(ICdmFormElement formElement
, int style
) {
52 selection_reference
= formFactory
53 .createSelectionElement(Reference
.class,
54 getConversationHolder(), formElement
, "Reference",
55 null, EntitySelectionElement
.ALL
, style
);
56 text_referenceDetail
= formFactory
.createTextWithLabelElement(
57 formElement
, "Reference Detail", null, SWT
.NULL
);
61 public void setEntity(T entity
) {
64 selection_reference
.setEntity(entity
.getCitation());
65 text_referenceDetail
.setText(entity
.getCitationMicroReference());
69 public SelectionArbitrator
getSelectionArbitrator() {
70 return selectionArbitrator
;