Revision 06db1b37
Added by Andreas Kohlbecker almost 3 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/model/registration/SpecimenTypeDesignationDTO.java | ||
---|---|---|
214 | 214 |
std.getTypeSpecimen().setPreferredStableUri(uri); |
215 | 215 |
} |
216 | 216 |
|
217 |
public Reference getDesignationReference() { |
|
218 |
return std.getCitation(); |
|
219 |
} |
|
220 |
|
|
221 |
public void setDesignationReference(Reference citation) { |
|
222 |
std.setCitation(citation); |
|
223 |
} |
|
224 |
|
|
225 |
public String getDesignationReferenceDetail() { |
|
226 |
return std.getCitationMicroReference(); |
|
227 |
} |
|
228 |
|
|
229 |
public void setDesignationReferenceDetail(String detail) { |
|
230 |
std.setCitationMicroReference(detail); |
|
231 |
} |
|
232 |
|
|
217 | 233 |
public URI getMediaUri(){ |
218 | 234 |
if(checkMediaSpecimen()){ |
219 | 235 |
MediaRepresentationPart part = findMediaRepresentationPart(); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationDTORow.java | ||
---|---|---|
16 | 16 |
import com.vaadin.ui.NativeSelect; |
17 | 17 |
import com.vaadin.ui.TextField; |
18 | 18 |
|
19 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; |
|
19 | 20 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
20 | 21 |
import eu.etaxonomy.cdm.model.reference.Reference; |
21 | 22 |
import eu.etaxonomy.cdm.model.term.DefinedTerm; |
... | ... | |
47 | 48 |
*/ |
48 | 49 |
TextField associatedTypeDesignationCount = new TextField(); |
49 | 50 |
RowListSelect kindOfUnit = new RowListSelect(); // position is IMPORTANT, see rowListSelectColumn() |
50 |
NativeSelect typeStatus = new NativeSelect();
|
|
51 |
RowListSelect typeStatus = new RowListSelect();
|
|
51 | 52 |
ToOneRelatedEntityCombobox<eu.etaxonomy.cdm.model.occurrence.Collection> collection = |
52 | 53 |
new ToOneRelatedEntityCombobox<eu.etaxonomy.cdm.model.occurrence.Collection>(null, eu.etaxonomy.cdm.model.occurrence.Collection.class); |
53 | 54 |
TextField accessionNumber = new TextFieldNFix(); |
54 | 55 |
TextField preferredStableUri = new TextFieldNFix(); |
56 |
ToOneRelatedEntityCombobox<Reference> designationReference = |
|
57 |
new ToOneRelatedEntityCombobox<Reference>(null, Reference.class); |
|
58 |
TextField designationReferenceDetail = new TextFieldNFix(); //"Image reference detail"); |
|
55 | 59 |
TextField mediaUri = new TextFieldNFix(); |
56 | 60 |
ToOneRelatedEntityCombobox<Reference> mediaSpecimenReference = |
57 | 61 |
new ToOneRelatedEntityCombobox<Reference>(null, Reference.class); |
... | ... | |
61 | 65 |
|
62 | 66 |
kindOfUnit.setRequired(true); |
63 | 67 |
kindOfUnit.setRow(this); |
68 |
kindOfUnit.addValueChangeListener(e -> |
|
69 |
updateRowItemsEnablement() |
|
70 |
); |
|
64 | 71 |
|
65 | 72 |
typeStatus.setRequired(true); |
73 |
typeStatus.addValueChangeListener(e -> |
|
74 |
updateRowItemsEnablement() |
|
75 |
); |
|
66 | 76 |
|
67 | 77 |
accessionNumber.setWidth(100, Unit.PIXELS); |
68 | 78 |
|
79 |
collection.setWidth(200, Unit.PIXELS); |
|
80 |
collection.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Collection>(collection)); |
|
81 |
|
|
69 | 82 |
preferredStableUri.setWidth(150, Unit.PIXELS); |
70 | 83 |
preferredStableUri.setConverter(new UriConverter()); |
71 | 84 |
|
72 |
collection.setWidth(200, Unit.PIXELS); |
|
73 |
collection.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Collection>(collection)); |
|
85 |
designationReference.setWidth(200, Unit.PIXELS); |
|
86 |
designationReference.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(mediaSpecimenReference)); |
|
87 |
|
|
88 |
designationReferenceDetail.setWidth(200, Unit.PIXELS); |
|
74 | 89 |
|
75 | 90 |
mediaUri.setWidth(150, Unit.PIXELS); |
76 | 91 |
mediaUri.setConverter(new UriConverter()); |
... | ... | |
80 | 95 |
|
81 | 96 |
mediaSpecimenReferenceDetail.setWidth(200, Unit.PIXELS); |
82 | 97 |
|
83 |
kindOfUnit.addValueChangeListener(e -> |
|
84 |
updateRowItemsEnablement() |
|
85 |
); |
|
86 | 98 |
|
87 | 99 |
} |
88 | 100 |
|
... | ... | |
95 | 107 |
kindOfUnit, typeStatus, |
96 | 108 |
collection, accessionNumber, |
97 | 109 |
preferredStableUri, |
110 |
designationReference, designationReferenceDetail, |
|
98 | 111 |
mediaUri, mediaSpecimenReference, |
99 | 112 |
mediaSpecimenReferenceDetail |
100 | 113 |
}; |
... | ... | |
107 | 120 |
"kindOfUnit", "typeStatus", |
108 | 121 |
"collection", "accessionNumber", |
109 | 122 |
"preferredStableUri", |
123 |
"designationReference", "designationReferenceDetail", |
|
110 | 124 |
"mediaUri", "mediaSpecimenReference", |
111 | 125 |
"mediaSpecimenReferenceDetail" |
112 | 126 |
}); |
... | ... | |
126 | 140 |
kindOfUnit.setDescription(kindOfUnitLocked ? |
127 | 141 |
"Can not be changed since the type specimen is associated with multiple type designations" : ""); |
128 | 142 |
|
143 |
boolean withDesignationReference = typeStatus.getValue() != null && ((SpecimenTypeDesignationStatus)typeStatus.getValue()).hasDesignationSource(); |
|
144 |
|
|
145 |
designationReference.setEnabled(withDesignationReference); |
|
146 |
designationReferenceDetail.setEnabled(withDesignationReference); |
|
147 |
|
|
129 | 148 |
mediaSpecimenReference.setEnabled(publishedImageType || unPublishedImageType); |
130 | 149 |
mediaSpecimenReferenceDetail.setEnabled(publishedImageType || unPublishedImageType); |
131 | 150 |
mediaUri.setEnabled(publishedImageType || unPublishedImageType); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java | ||
---|---|---|
12 | 12 |
import java.util.EnumSet; |
13 | 13 |
import java.util.HashMap; |
14 | 14 |
import java.util.HashSet; |
15 |
import java.util.List; |
|
15 | 16 |
import java.util.Map; |
16 | 17 |
import java.util.Set; |
17 | 18 |
import java.util.Stack; |
... | ... | |
109 | 110 |
|
110 | 111 |
private Map<CollectionPopupEditor, SpecimenTypeDesignationDTORow> collectionPopupEditorsRowMap = new HashMap<>(); |
111 | 112 |
|
112 |
private Map<ReferencePopupEditor, SpecimenTypeDesignationDTORow> referencePopupEditorsRowMap = new HashMap<>();
|
|
113 |
private Map<ReferencePopupEditor, ToOneRelatedEntityCombobox<Reference>> referencePopupEditorsCombobox = new HashMap<>();
|
|
113 | 114 |
|
114 | 115 |
private Set<CollectionRowItemCollection> popuEditorTypeDesignationSourceRows = new HashSet<>(); |
115 | 116 |
|
... | ... | |
234 | 235 |
} |
235 | 236 |
}); |
236 | 237 |
|
237 |
row.mediaSpecimenReference.loadFrom(
|
|
238 |
row.designationReference.loadFrom(
|
|
238 | 239 |
referencePagingProvider, |
239 | 240 |
referencePagingProvider, |
240 | 241 |
referencePagingProvider.getPageSize() |
241 | 242 |
); |
243 |
row.designationReference.getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, row.designationReference.getSelect())); |
|
244 |
row.designationReference.getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Reference>(row.designationReference.getSelect(), |
|
245 |
SpecimenTypeDesignationWorkingsetEditorPresenter.this)); |
|
246 |
row.designationReference.addClickListenerAddEntity(e -> doReferenceEditorAdd(row.designationReference)); |
|
247 |
row.designationReference.addClickListenerEditEntity(e -> { |
|
248 |
if(row.designationReference.getValue() != null){ |
|
249 |
doReferenceEditorEdit(row.designationReference); |
|
250 |
} |
|
251 |
}); |
|
242 | 252 |
|
253 |
row.mediaSpecimenReference.loadFrom( |
|
254 |
referencePagingProvider, |
|
255 |
referencePagingProvider, |
|
256 |
referencePagingProvider.getPageSize() |
|
257 |
); |
|
243 | 258 |
row.mediaSpecimenReference.getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, row.mediaSpecimenReference.getSelect())); |
244 | 259 |
row.mediaSpecimenReference.getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Reference>(row.mediaSpecimenReference.getSelect(), |
245 | 260 |
SpecimenTypeDesignationWorkingsetEditorPresenter.this)); |
246 |
row.mediaSpecimenReference.addClickListenerAddEntity(e -> doReferenceEditorAdd(row)); |
|
261 |
row.mediaSpecimenReference.addClickListenerAddEntity(e -> doReferenceEditorAdd(row.mediaSpecimenReference));
|
|
247 | 262 |
row.mediaSpecimenReference.addClickListenerEditEntity(e -> { |
248 | 263 |
if(row.mediaSpecimenReference.getValue() != null){ |
249 |
doReferenceEditorEdit(row); |
|
264 |
doReferenceEditorEdit(row.mediaSpecimenReference);
|
|
250 | 265 |
} |
251 | 266 |
}); |
252 | 267 |
|
... | ... | |
272 | 287 |
UserHelperAccess.userHelper().createAuthorityForCurrentUser(dto.getFieldUnit(), crud, null); |
273 | 288 |
} |
274 | 289 |
|
290 |
List<SpecimenTypeDesignationDTO> stdDTOs = dto.getSpecimenTypeDesignationDTOs(); |
|
291 |
for(SpecimenTypeDesignationDTO stddto : stdDTOs) { |
|
292 |
// clean up |
|
293 |
if(!stddto.getTypeStatus().hasDesignationSource()) { |
|
294 |
stddto.setDesignationReference(null); |
|
295 |
stddto.setDesignationReferenceDetail(null); |
|
296 |
} |
|
297 |
} |
|
298 |
|
|
275 | 299 |
specimenTypeDesignationWorkingSetService.save(dto); |
276 | 300 |
} |
277 | 301 |
|
... | ... | |
385 | 409 |
} |
386 | 410 |
} |
387 | 411 |
|
388 |
public void doReferenceEditorAdd(SpecimenTypeDesignationDTORow row) {
|
|
412 |
public void doReferenceEditorAdd(ToOneRelatedEntityCombobox<Reference> referenceComobox) {
|
|
389 | 413 |
|
390 | 414 |
ReferencePopupEditor referencePopupEditor = openPopupEditor(ReferencePopupEditor.class, null); |
391 | 415 |
|
... | ... | |
394 | 418 |
referencePopupEditor.withDeleteButton(true); |
395 | 419 |
referencePopupEditor.loadInEditor(null); |
396 | 420 |
|
397 |
referencePopupEditorsRowMap.put(referencePopupEditor, row);
|
|
421 |
referencePopupEditorsCombobox.put(referencePopupEditor, referenceComobox);
|
|
398 | 422 |
} |
399 | 423 |
|
400 |
public void doReferenceEditorEdit(SpecimenTypeDesignationDTORow row) {
|
|
424 |
public void doReferenceEditorEdit(ToOneRelatedEntityCombobox<Reference> referenceComobox) {
|
|
401 | 425 |
|
402 | 426 |
ReferencePopupEditor referencePopupEditor = openPopupEditor(ReferencePopupEditor.class, null); |
403 | 427 |
referencePopupEditor.withReferenceTypes(RegistrationUIDefaults.MEDIA_REFERENCE_TYPES); |
404 | 428 |
referencePopupEditor.grantToCurrentUser(COLLECTION_EDITOR_CRUD); |
405 | 429 |
referencePopupEditor.withDeleteButton(true); |
406 |
referencePopupEditor.loadInEditor(row.mediaSpecimenReference.getValue().getUuid());
|
|
430 |
referencePopupEditor.loadInEditor(referenceComobox.getValue().getUuid());
|
|
407 | 431 |
|
408 |
referencePopupEditorsRowMap.put(referencePopupEditor, row);
|
|
432 |
referencePopupEditorsCombobox.put(referencePopupEditor, referenceComobox);
|
|
409 | 433 |
} |
410 | 434 |
|
411 | 435 |
@EventBusListenerMethod(filter = EntityChangeEventFilter.ReferenceFilter.class) |
... | ... | |
414 | 438 |
Reference newRef = getRepo().getReferenceService().load(event.getEntityUuid(), Arrays.asList(new String[]{"$"})); |
415 | 439 |
cache.load(newRef); |
416 | 440 |
|
441 |
ToOneRelatedEntityCombobox<Reference> combobox = referencePopupEditorsCombobox.get(event.getSourceView()); |
|
417 | 442 |
if(event.isCreatedType()){ |
418 |
SpecimenTypeDesignationDTORow row = referencePopupEditorsRowMap.get(event.getSourceView()); |
|
419 |
ToOneRelatedEntityCombobox<Reference> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 7); |
|
420 | 443 |
combobox.setValue((Reference) event.getEntity()); |
421 | 444 |
} else { |
422 | 445 |
for( CollectionRowItemCollection row : popuEditorTypeDesignationSourceRows) { |
423 |
ToOneRelatedEntityCombobox<Reference> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 7); |
|
424 | 446 |
combobox.reload(); |
425 | 447 |
} |
426 | 448 |
} |
Also available in: Unified diff
fix #9301 adding designationReference and detail to specimen type designation editor