4 package eu
.etaxonomy
.taxeditor
.ui
.section
.key
;
6 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
7 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
8 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
9 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
10 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
11 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
12 import eu
.etaxonomy
.taxeditor
.ui
.element
.KeyStatementElement
;
13 import eu
.etaxonomy
.taxeditor
.ui
.element
.NumberWithLabelElement
;
14 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
15 import eu
.etaxonomy
.taxeditor
.ui
.selection
.EntitySelectionElement
;
21 public class PolytomousKeyNodeDetailElement
extends
22 AbstractCdmDetailElement
<PolytomousKeyNode
> {
24 private KeyStatementElement element_statement
;
26 private EntitySelectionElement
<Feature
> selection_feature
;
28 private EntitySelectionElement
<Taxon
> selection_taxon
;
30 private EntitySelectionElement
<PolytomousKey
> selection_subkey
;
32 private EntitySelectionElement
<PolytomousKeyNode
> selection_otherNode
;
34 private KeyStatementElement element_question
;
36 public PolytomousKeyNodeDetailElement(CdmFormFactory formFactory
,
37 ICdmFormElement formElement
) {
38 super(formFactory
, formElement
);
42 protected void createControls(ICdmFormElement formElement
,
43 PolytomousKeyNode entity
, int style
) {
44 if (!entity
.isLeaf()) {
45 NumberWithLabelElement number_nodeNumber
= formFactory
46 .createIntegerTextWithLabelElement(formElement
,
47 "Node Number", entity
.getNodeNumber(), style
);
48 number_nodeNumber
.setEnabled(false);
51 if (entity
.getParent() != null) {
52 PolytomousKeyNode parent
= entity
.getParent();
54 element_question
= formFactory
.createKeyStatementElement(
55 formElement
, "Question", parent
.getQuestion(), 50, style
);
57 selection_feature
= formFactory
58 .createSelectionElement(Feature
.class,
59 getConversationHolder(), formElement
, "Feature",
61 EntitySelectionElement
.EDITABLE
| EntitySelectionElement
.DELETABLE
, style
);
64 element_statement
= formFactory
.createKeyStatementElement(formElement
,
65 "Statement", entity
.getStatement(), 50, style
);
67 if (entity
.isLeaf()) {
68 selection_taxon
= formFactory
69 .createSelectionElement(Taxon
.class,
70 getConversationHolder(), formElement
, "Taxon",
71 entity
.getTaxon(), EntitySelectionElement
.NOTHING
,
75 selection_subkey
= formFactory
76 .createSelectionElement(PolytomousKey
.class,
77 getConversationHolder(), formElement
, "Subkey",
79 EntitySelectionElement
.EDITABLE
| EntitySelectionElement
.DELETABLE
, style
);
81 selection_otherNode
= formFactory
82 .createSelectionElement(PolytomousKeyNode
.class,
83 getConversationHolder(), formElement
, "Other Node",
84 entity
.getOtherNode(),
85 EntitySelectionElement
.DELETABLE
, style
);
87 formFactory
.createMultiLanguageTextElement(formElement
,
88 "Modifying Text", entity
.getModifyingText(), 50, style
);
96 * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
100 public void handleEvent(Object eventSource
) {
101 if (eventSource
== element_question
) {
102 getEntity().getParent().setQuestion(
103 element_question
.getKeyStatement());
104 } else if (eventSource
== element_statement
) {
105 getEntity().setStatement(element_statement
.getKeyStatement());
106 } else if (eventSource
== selection_feature
) {
107 getEntity().getParent().setFeature(selection_feature
.getEntity());
108 } else if (eventSource
== selection_taxon
) {
109 getEntity().setTaxon(selection_taxon
.getEntity());
110 } else if (eventSource
== selection_subkey
) {
111 getEntity().setSubkey(selection_subkey
.getEntity());
112 } else if (eventSource
== selection_otherNode
) {
113 getEntity().setOtherNode(selection_otherNode
.getEntity());