Revision cb4d176d
Added by Andreas Kohlbecker almost 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkflowViewBean.java | ||
---|---|---|
11 | 11 |
import java.util.ArrayList; |
12 | 12 |
import java.util.Collection; |
13 | 13 |
import java.util.List; |
14 |
import java.util.Set; |
|
14 | 15 |
import java.util.UUID; |
15 | 16 |
|
16 | 17 |
import org.springframework.security.core.GrantedAuthority; |
... | ... | |
31 | 32 |
import com.vaadin.ui.Panel; |
32 | 33 |
import com.vaadin.ui.TabSheet; |
33 | 34 |
import com.vaadin.ui.TabSheet.Tab; |
35 |
import com.vaadin.ui.UI; |
|
36 |
import com.vaadin.ui.VerticalLayout; |
|
37 |
import com.vaadin.ui.Window; |
|
34 | 38 |
import com.vaadin.ui.themes.ValoTheme; |
35 | 39 |
|
40 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
|
41 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
|
42 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
|
36 | 43 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem; |
37 | 44 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemEditButtonGroup; |
45 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItemEditButtonGroup.IdSetButton; |
|
38 | 46 |
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStyles; |
39 | 47 |
import eu.etaxonomy.cdm.vaadin.component.registration.TypeStateLabel; |
40 | 48 |
import eu.etaxonomy.cdm.vaadin.component.registration.WorkflowSteps; |
... | ... | |
44 | 52 |
import eu.etaxonomy.cdm.vaadin.event.RegistrationEditorAction; |
45 | 53 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
46 | 54 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction; |
47 |
import eu.etaxonomy.cdm.vaadin.event.TypedesignationsEditorAction;
|
|
55 |
import eu.etaxonomy.cdm.vaadin.event.TypeDesignationWorkingsetEditorAction;
|
|
48 | 56 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent; |
49 | 57 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
50 | 58 |
import eu.etaxonomy.cdm.vaadin.model.registration.WorkflowStep; |
... | ... | |
277 | 285 |
editTypesButton.setStyleName(ValoTheme.BUTTON_TINY); |
278 | 286 |
editTypesButton.setDescription("Edit type designations"); |
279 | 287 |
if(dto.getOrderdTypeDesignationWorkingSets() != null && !dto.getOrderdTypeDesignationWorkingSets().isEmpty()){ |
280 |
editTypesButton.addClickListener(e -> { |
|
281 |
int regId = dto.getId(); |
|
282 |
getEventBus().publishEvent(new TypedesignationsEditorAction(
|
|
283 |
AbstractEditorAction.Action.EDIT, |
|
284 |
regId |
|
285 |
) |
|
286 |
); |
|
287 |
}); |
|
288 |
// editTypesButton.addClickListener(e -> {
|
|
289 |
// int regId = dto.getId();
|
|
290 |
// getEventBus().publishEvent(new TypeDesignationSetEditorAction(
|
|
291 |
// AbstractEditorAction.Action.EDIT,
|
|
292 |
// regId
|
|
293 |
// )
|
|
294 |
// );
|
|
295 |
// });
|
|
288 | 296 |
} else { |
289 | 297 |
editTypesButton.setEnabled(false); |
290 | 298 |
} |
... | ... | |
300 | 308 |
Integer nameId = editButtonGroup.getNameButton().getId(); |
301 | 309 |
getEventBus().publishEvent(new TaxonNameEditorAction( |
302 | 310 |
AbstractEditorAction.Action.EDIT, |
303 |
nameId |
|
311 |
nameId, |
|
312 |
e.getButton(), |
|
313 |
this |
|
304 | 314 |
) |
305 | 315 |
); |
306 | 316 |
}); |
317 |
|
|
318 |
for(IdSetButton idSetButton : editButtonGroup.getTypeDesignationButtons()){ |
|
319 |
idSetButton.getButton().addClickListener(e -> { |
|
320 |
Set<Integer> ids = idSetButton.getIds(); |
|
321 |
getEventBus().publishEvent(new TypeDesignationWorkingsetEditorAction( |
|
322 |
AbstractEditorAction.Action.EDIT, |
|
323 |
ids, |
|
324 |
e.getButton(), |
|
325 |
this |
|
326 |
) |
|
327 |
); |
|
328 |
}); |
|
329 |
} |
|
330 |
|
|
331 |
editButtonGroup.getAddTypeDesignationButton().addClickListener( |
|
332 |
e -> chooseNewTypeRegistrationWorkingset(e.getButton()) |
|
333 |
); |
|
307 | 334 |
} |
308 | 335 |
regItem = editButtonGroup; |
309 | 336 |
} else { |
... | ... | |
317 | 344 |
namesTypesList.setComponentAlignment(buttonGroup, Alignment.TOP_LEFT); |
318 | 345 |
} |
319 | 346 |
|
347 |
/** |
|
348 |
* @param button |
|
349 |
* |
|
350 |
*/ |
|
351 |
protected void chooseNewTypeRegistrationWorkingset(Button button) { |
|
352 |
|
|
353 |
Window typeDesignationTypeCooser = new Window(); |
|
354 |
typeDesignationTypeCooser.setModal(true); |
|
355 |
typeDesignationTypeCooser.setResizable(false); |
|
356 |
typeDesignationTypeCooser.setCaption("Add new type designation"); |
|
357 |
Label label = new Label("Please select kind of type designation to be created."); |
|
358 |
Button newSpecimenTypeDesignationButton = new Button("Specimen type designation", |
|
359 |
e -> addNewTypeRegistrationWorkingset(SpecimenTypeDesignation.class, typeDesignationTypeCooser)); |
|
360 |
Button newNameTypeDesignationButton = new Button("Name type designation", |
|
361 |
e -> addNewTypeRegistrationWorkingset(NameTypeDesignation.class, typeDesignationTypeCooser)); |
|
362 |
|
|
363 |
VerticalLayout layout = new VerticalLayout(label, newSpecimenTypeDesignationButton, newNameTypeDesignationButton); |
|
364 |
layout.setMargin(true); |
|
365 |
layout.setSpacing(true); |
|
366 |
layout.setComponentAlignment(newSpecimenTypeDesignationButton, Alignment.MIDDLE_CENTER); |
|
367 |
layout.setComponentAlignment(newNameTypeDesignationButton, Alignment.MIDDLE_CENTER); |
|
368 |
typeDesignationTypeCooser.setContent(layout); |
|
369 |
UI.getCurrent().addWindow(typeDesignationTypeCooser); |
|
370 |
|
|
371 |
} |
|
372 |
|
|
373 |
/** |
|
374 |
* @param button |
|
375 |
* |
|
376 |
*/ |
|
377 |
protected void addNewTypeRegistrationWorkingset(Class<? extends TypeDesignationBase<?>> newEntityType, Window typeDesignationTypeCooser) { |
|
378 |
UI.getCurrent().removeWindow(typeDesignationTypeCooser); |
|
379 |
getEventBus().publishEvent(new TypeDesignationWorkingsetEditorAction( |
|
380 |
AbstractEditorAction.Action.ADD, |
|
381 |
newEntityType, |
|
382 |
null, |
|
383 |
this |
|
384 |
)); |
|
385 |
} |
|
386 |
|
|
320 | 387 |
|
321 | 388 |
/** |
322 | 389 |
* |
Also available in: Unified diff
ref #6719 RegistrationItemEditButtons active; Chooser for new type designations