Revision 21a1bf2d
Added by Cherian Mathew almost 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/NewTaxonBaseComposite.java | ||
---|---|---|
77 | 77 |
|
78 | 78 |
|
79 | 79 |
private final Window dialog; |
80 |
private final IdUuidName accTaxonIdUuid;
|
|
81 |
private final IdUuidName classificationIdUuid;
|
|
80 |
private final IdUuidName accTaxonIun;
|
|
81 |
private final IdUuidName classificationIun;
|
|
82 | 82 |
|
83 | 83 |
private static final Logger logger = Logger.getLogger(NewTaxonBaseComposite.class); |
84 | 84 |
|
85 |
private static final String CHOOSE_SECUNDUM_PROMPT = "Choose Secundum ...."; |
|
86 |
|
|
85 | 87 |
/** |
86 | 88 |
* The constructor should first build the main layout, set the |
87 | 89 |
* composition root and then do any custom initialization. |
... | ... | |
91 | 93 |
*/ |
92 | 94 |
public NewTaxonBaseComposite(Window dialog, |
93 | 95 |
INewTaxonBaseComponentListener listener, |
94 |
IdUuidName accTaxonIdUuid,
|
|
96 |
IdUuidName accTaxonIun,
|
|
95 | 97 |
String accTaxonName, |
96 |
IdUuidName classificationIdUuid) {
|
|
98 |
IdUuidName classificationIun) {
|
|
97 | 99 |
buildMainLayout(); |
98 | 100 |
setCompositionRoot(mainLayout); |
99 | 101 |
|
100 | 102 |
this.listener = listener; |
101 | 103 |
this.dialog = dialog; |
102 |
this.accTaxonIdUuid = accTaxonIdUuid;
|
|
103 |
this.classificationIdUuid = classificationIdUuid;
|
|
104 |
this.accTaxonIun = accTaxonIun;
|
|
105 |
this.classificationIun = classificationIun;
|
|
104 | 106 |
|
105 | 107 |
addUIListeners(); |
106 | 108 |
|
... | ... | |
124 | 126 |
secComboBox.setImmediate(true); |
125 | 127 |
if(listener != null) { |
126 | 128 |
secComboBox.setContainerDataSource(listener.getSecRefContainer()); |
129 |
Object selectedSecItemId = null; |
|
130 |
// if accTaxonIun is null then we are creating a new taxon |
|
131 |
// else a new synonym |
|
132 |
if(accTaxonIun == null) { |
|
133 |
selectedSecItemId = listener.getClassificationRefId(classificationIun.getUuid()); |
|
134 |
} else { |
|
135 |
selectedSecItemId = listener.getAcceptedTaxonRefId(accTaxonIun.getUuid()); |
|
136 |
} |
|
137 |
|
|
138 |
if(selectedSecItemId != null) { |
|
139 |
secComboBox.setValue(selectedSecItemId); |
|
140 |
} else { |
|
141 |
secComboBox.setInputPrompt(CHOOSE_SECUNDUM_PROMPT); |
|
142 |
} |
|
127 | 143 |
} |
128 | 144 |
} |
129 | 145 |
|
... | ... | |
154 | 170 |
public boolean execute() { |
155 | 171 |
setProgress("Saving Taxon " + nameTextField.getValue()); |
156 | 172 |
IdUuidName taxonBaseIdUuid; |
157 |
if(accTaxonIdUuid == null) {
|
|
158 |
taxonBaseIdUuid = listener.newTaxon(nameTextField.getValue(),secComboBox.getValue(), classificationIdUuid.getUuid());
|
|
173 |
if(accTaxonIun == null) {
|
|
174 |
taxonBaseIdUuid = listener.newTaxon(nameTextField.getValue(),secComboBox.getValue(), classificationIun.getUuid());
|
|
159 | 175 |
} else { |
160 |
taxonBaseIdUuid = listener.newSynonym(nameTextField.getValue(),secComboBox.getValue(), accTaxonIdUuid.getUuid());
|
|
176 |
taxonBaseIdUuid = listener.newSynonym(nameTextField.getValue(),secComboBox.getValue(), accTaxonIun.getUuid());
|
|
161 | 177 |
} |
162 | 178 |
Object rowId = new RowId(taxonBaseIdUuid.getId()); |
163 | 179 |
registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList(rowId), NewTaxonBaseComposite.class)); |
Also available in: Unified diff
EditConceptRelationshipComposite, EditConceptRelationshipPresenter : hack for checking relationship rules (currently only for congruence)
INewTaxonBaseComponentListener, NewTaxonBaseComposite, NewTaxonBasePresenter : Setting default secundum when addin taxon / synonym
StatusComposite, ConceptRelationshipView : added check for already selected item in taxon table
CdmVaadinUtilities : added utility method to check if given item is selected
d3.conceptrelationshiptree_connector.js : cleaned up transition for nodes + removed transition for links
edit.scss, styles.css : added italics also for taxon