use of com.vaadin.componentfactory.ToggleButton in project furms by unity-idm.
the class ResourceAllocationsDetailsView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
Optional<ProjectAllocation> projectAllocation = ofNullable(parameter).flatMap(id -> handleExceptions(() -> projectAllocationService.findByProjectIdAndId(projectId, id))).flatMap(Function.identity());
if (projectAllocation.isPresent()) {
getContent().removeAll();
breadCrumbParameter = new BreadCrumbParameter(parameter, projectAllocation.get().name, getTranslation("view.project-admin.resource-allocations.details.page.bread-crumb"));
ToggleButton toggle = new ToggleButton("Show per-user breakdown");
toggle.addValueChangeListener(evt -> {
getContent().removeAll();
if (evt.getValue())
getContent().add(toggle, getResourceAllocationChartWithUsersUsage(projectAllocation.get()));
else
getContent().add(toggle, getBasicResourceAllocationChart(projectAllocation.get()));
});
getContent().add(toggle, getBasicResourceAllocationChart(projectAllocation.get()));
}
}
Aggregations