20 |
20 |
import com.vaadin.ui.themes.ValoTheme;
|
21 |
21 |
|
22 |
22 |
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
|
|
23 |
import eu.etaxonomy.cdm.model.name.TaxonName;
|
|
24 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
|
23 |
25 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
24 |
|
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonName;
|
|
26 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
|
25 |
27 |
import eu.etaxonomy.cdm.vaadin.model.TypedEntityReference;
|
|
28 |
import eu.etaxonomy.cdm.vaadin.security.UserHelper;
|
26 |
29 |
import eu.etaxonomy.cdm.vaadin.util.converter.TypeDesignationSetManager.TypeDesignationWorkingSet;
|
27 |
30 |
import eu.etaxonomy.cdm.vaadin.util.converter.TypeDesignationSetManager.TypeDesignationWorkingSetType;
|
28 |
31 |
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationDTO;
|
... | ... | |
71 |
74 |
nameIdButton = new IdButton<TaxonName>(TaxonName.class, regDto.getName().getId(), nameButton);
|
72 |
75 |
Label nameLabel = new Label(regDto.getName().getLabel());
|
73 |
76 |
nameLabel.setWidthUndefined();
|
74 |
|
nameButton.setEnabled(!isRegistrationLocked);
|
75 |
|
addComponents(nameIdButton.getButton(), nameLabel);
|
|
77 |
nameButton.setEnabled(!isRegistrationLocked && UserHelper.fromSession().userHasPermission(TaxonName.class, regDto.getName().getId(), CRUD.UPDATE));
|
|
78 |
|
|
79 |
addComponent(nameIdButton.getButton());
|
|
80 |
// PermissionDebugUtils.fromSession().addGainPerEntityPermissionButton(this, TaxonName.class, regDto.getName().getId(), CRUD.UPDATE);
|
|
81 |
addComponent(nameLabel);
|
76 |
82 |
} else {
|
77 |
83 |
// no name in the registration! we only show the typified name as label
|
78 |
84 |
if(regDto.getTypifiedName() != null){
|
... | ... | |
81 |
87 |
}
|
82 |
88 |
}
|
83 |
89 |
if(regDto.getOrderdTypeDesignationWorkingSets() != null){
|
84 |
|
for(TypedEntityReference baseEntityRef : regDto.getOrderdTypeDesignationWorkingSets().keySet()) {
|
|
90 |
for(TypedEntityReference<TypeDesignationBase<?>> baseEntityRef : regDto.getOrderdTypeDesignationWorkingSets().keySet()) {
|
85 |
91 |
TypeDesignationWorkingSet typeDesignationWorkingSet = regDto.getOrderdTypeDesignationWorkingSets().get(baseEntityRef);
|
86 |
92 |
String buttonLabel = SpecimenOrObservationBase.class.isAssignableFrom(baseEntityRef.getType()) ? "Type": "NameType";
|
87 |
93 |
Button tdButton = new Button(buttonLabel + ":");
|
88 |
94 |
tdButton.setDescription("Edit the type designation working set");
|
89 |
|
tdButton.setEnabled(!isRegistrationLocked);
|
|
95 |
tdButton.setEnabled(!isRegistrationLocked && UserHelper.fromSession().userHasPermission(baseEntityRef.getType(), baseEntityRef.getId(), CRUD.UPDATE));
|
90 |
96 |
addComponent(tdButton);
|
91 |
97 |
// Set<Integer> idSet = new HashSet<>();
|
92 |
98 |
// typeDesignationWorkingSet.getTypeDesignations().forEach(td -> idSet.add(td.getId()));
|
ref #6999 protecting type and name buttons