Revision cf9c36f8
Added by Andreas Kohlbecker almost 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorksetViewBean.java | ||
---|---|---|
39 | 39 |
import com.vaadin.ui.GridLayout; |
40 | 40 |
import com.vaadin.ui.HorizontalLayout; |
41 | 41 |
import com.vaadin.ui.Label; |
42 |
import com.vaadin.ui.ListSelect; |
|
42 | 43 |
import com.vaadin.ui.Notification; |
43 | 44 |
import com.vaadin.ui.Panel; |
44 | 45 |
import com.vaadin.ui.UI; |
... | ... | |
124 | 125 |
|
125 | 126 |
private Button addExistingNameButton; |
126 | 127 |
|
128 |
private ListSelect existingNameRegistrationTypeSelect; |
|
129 |
|
|
127 | 130 |
private RegistrationItem workingsetHeader; |
128 | 131 |
|
129 | 132 |
private Panel registrationListPanel; |
... | ... | |
140 | 143 |
|
141 | 144 |
private RegistrationStatusFieldInstantiator statusFieldInstantiator; |
142 | 145 |
|
143 |
|
|
144 | 146 |
public RegistrationWorksetViewBean() { |
145 | 147 |
super(); |
146 | 148 |
} |
... | ... | |
235 | 237 |
registrationsGrid.setColumnExpandRatio(1, 1f); |
236 | 238 |
|
237 | 239 |
registrationItemMap.clear(); |
238 |
registrationsGrid.setRows(workingset.getRegistrationDTOs().size() * 2 + 2);
|
|
240 |
registrationsGrid.setRows(workingset.getRegistrationDTOs().size() * 2 + 3);
|
|
239 | 241 |
int row = 0; |
240 | 242 |
for(RegistrationDTO dto : workingset.getRegistrationDTOs()) { |
241 | 243 |
row = putRegistrationListComponent(row, dto); |
... | ... | |
249 | 251 |
addNewNameRegistrationButton.addClickListener( |
250 | 252 |
e -> getViewEventBus().publish(this, new TaxonNameEditorAction(EditorActionType.ADD, null, addNewNameRegistrationButton, null, this))); |
251 | 253 |
|
254 |
existingNameRegistrationTypeSelect = new ListSelect(null, EnumSet.allOf(ExistingNameRegistrationType.class)); |
|
255 |
existingNameRegistrationTypeSelect.setRows(1); |
|
256 |
existingNameRegistrationTypeSelect.setNullSelectionAllowed(true); |
|
257 |
existingNameRegistrationTypeSelect.setEnabled(false); |
|
252 | 258 |
addExistingNameButton = new Button("existing name:"); |
253 |
addExistingNameButton.setDescription("A name which was previously published in a earlier publication."); |
|
254 | 259 |
addExistingNameButton.setEnabled(false); |
255 | 260 |
addExistingNameButton.addClickListener( |
256 |
e -> getViewEventBus().publish(this, new RegistrationWorkingsetAction(citationUuid, RegistrationWorkingsetAction.Action.start)) |
|
257 |
); |
|
261 |
e -> getViewEventBus().publish(this, new RegistrationWorkingsetAction( |
|
262 |
citationUuid, |
|
263 |
RegistrationWorkingsetAction.Action.start, |
|
264 |
(ExistingNameRegistrationType)existingNameRegistrationTypeSelect.getValue()) |
|
265 |
) |
|
266 |
); |
|
258 | 267 |
|
259 | 268 |
existingNameCombobox = new LazyComboBox<TaxonName>(TaxonName.class); |
260 | 269 |
existingNameCombobox.addValueChangeListener( |
261 |
e -> addExistingNameButton.setEnabled(e.getProperty().getValue() != null) |
|
270 |
e -> { |
|
271 |
boolean selectionNotEmpty = e.getProperty().getValue() != null; |
|
272 |
addExistingNameButton.setEnabled(selectionNotEmpty); |
|
273 |
existingNameRegistrationTypeSelect.setEnabled(selectionNotEmpty); |
|
274 |
if(selectionNotEmpty){ |
|
275 |
TaxonName name = (TaxonName)e.getProperty().getValue(); |
|
276 |
if(getPresenter().canCreateRegistrationForName(name)){ |
|
277 |
existingNameRegistrationTypeSelect.setValue(ExistingNameRegistrationType.NAME_TYPIFICATION); |
|
278 |
existingNameRegistrationTypeSelect.setEnabled(true); |
|
279 |
existingNameRegistrationTypeSelect.setNullSelectionAllowed(false); |
|
280 |
} else { |
|
281 |
existingNameRegistrationTypeSelect.setValue(ExistingNameRegistrationType.TYPIFICATION_ONLY); |
|
282 |
existingNameRegistrationTypeSelect.setEnabled(false); |
|
283 |
} |
|
284 |
} else { |
|
285 |
existingNameRegistrationTypeSelect.setNullSelectionAllowed(true); |
|
286 |
existingNameRegistrationTypeSelect.clear(); |
|
287 |
existingNameRegistrationTypeSelect.setEnabled(false); |
|
288 |
|
|
289 |
} |
|
290 |
} |
|
262 | 291 |
); |
263 | 292 |
|
264 |
HorizontalLayout buttonContainer = new HorizontalLayout(addRegistrationLabel_1, addNewNameRegistrationButton, addRegistrationLabel_2, addExistingNameButton, existingNameCombobox); |
|
293 |
HorizontalLayout buttonContainer = new HorizontalLayout( |
|
294 |
addRegistrationLabel_1, |
|
295 |
addNewNameRegistrationButton, |
|
296 |
addRegistrationLabel_2, |
|
297 |
addExistingNameButton, |
|
298 |
existingNameCombobox, |
|
299 |
existingNameRegistrationTypeSelect |
|
300 |
); |
|
265 | 301 |
buttonContainer.setSpacing(true); |
266 | 302 |
// buttonContainer.setWidth(100, Unit.PERCENTAGE); |
267 | 303 |
buttonContainer.setComponentAlignment(addRegistrationLabel_1, Alignment.MIDDLE_LEFT); |
... | ... | |
271 | 307 |
registrationsGrid.addComponent(buttonContainer, 0, row, COL_INDEX_BUTTON_GROUP, row); |
272 | 308 |
registrationsGrid.setComponentAlignment(buttonContainer, Alignment.MIDDLE_RIGHT); |
273 | 309 |
|
310 |
row++; |
|
311 |
Label hint = new Label( |
|
312 |
"For most names that already exist in the system it is only possible to create a registration covering type designations. " |
|
313 |
+ "Only in those rare cases where the citation of this workingset and the nomenclatural reference of a name are the same it is possible to create a registration covering the name also. " |
|
314 |
+ "In all other cases please choose <a href=\"registration#!regStart\">\"New\"</a> from the main menu and start a registration for the nomenclatural reference of the name to be registered.", |
|
315 |
ContentMode.HTML); |
|
316 |
registrationsGrid.addComponent(hint, 0, row, COL_INDEX_BUTTON_GROUP, row); |
|
317 |
registrationsGrid.setComponentAlignment(hint, Alignment.MIDDLE_RIGHT); |
|
318 |
|
|
274 | 319 |
Panel namesTypesPanel = new Panel(registrationsGrid); |
275 | 320 |
namesTypesPanel.setStyleName(EditValoTheme.PANEL_CONTENT_PADDING_LEFT); |
276 | 321 |
return namesTypesPanel; |
277 | 322 |
} |
278 | 323 |
|
279 | 324 |
|
280 |
|
|
281 | 325 |
protected int putRegistrationListComponent(int row, RegistrationDTO dto) { |
282 | 326 |
|
283 | 327 |
EntityReference typifiedNameReference = dto.getTypifiedNameRef(); |
Also available in: Unified diff
fix #7546 implementing workflow for creating registrations for existing names: