use of com.vaadin.flow.router.OptionalParameter in project furms by unity-idm.
the class GroupFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
GroupFormModel groupFormModel = ofNullable(parameter).flatMap(id -> handleExceptions(() -> genericGroupService.findBy(communityId, new GenericGroupId(id)))).flatMap(Function.identity()).map(x -> new GroupFormModel(x.id, x.communityId, x.name, x.description)).orElseGet(() -> new GroupFormModel(communityId));
String trans = parameter == null ? "view.site-admin.policy-documents.form.parameter.new" : "view.site-admin.policy-documents.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
binder.setBean(groupFormModel);
if (groupFormModel.id.id == null)
addCreateButtons();
else {
addUpdateButtons();
workflowComboBox.setReadOnly(true);
}
}
use of com.vaadin.flow.router.OptionalParameter in project furms by unity-idm.
the class CommunityAllocationsDetailsView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
Optional<CommunityAllocation> communityAllocation = ofNullable(parameter).flatMap(id -> handleExceptions(() -> communityAllocationService.findById(id))).flatMap(Function.identity());
if (communityAllocation.isPresent()) {
getContent().removeAll();
breadCrumbParameter = new BreadCrumbParameter(parameter, communityAllocation.get().name, getTranslation("view.fenix-admin.community.resource-allocations.details.page.bread-crumb"));
ResourceAllocationChart resourceAllocationChart = new ResourceAllocationChart(chartPowerService.getChartDataForCommunityAlloc(communityAllocation.get().communityId, communityAllocation.get().id), jsonExporter.getJsonForCommunityAllocation(communityAllocation.get().communityId, communityAllocation.get().id), csvExporter.getCsvForCommunityAllocation(communityAllocation.get().communityId, communityAllocation.get().id), true);
getContent().add(resourceAllocationChart);
}
}
use of com.vaadin.flow.router.OptionalParameter 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()));
}
}
use of com.vaadin.flow.router.OptionalParameter in project furms by unity-idm.
the class ResourceTypeFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
ResourceTypeViewModel serviceViewModel = ofNullable(parameter).flatMap(id -> handleExceptions(() -> resourceTypeService.findById(id, getCurrentResourceId()))).flatMap(Function.identity()).map(ResourceTypeViewModelMapper::map).orElseGet(() -> new ResourceTypeViewModel(getCurrentResourceId()));
String trans = parameter == null ? "view.site-admin.resource-types.form.parameter.new" : "view.site-admin.resource-types.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
resourceTypeFormComponent.setFormPools(serviceViewModel);
}
use of com.vaadin.flow.router.OptionalParameter in project furms by unity-idm.
the class InfraServiceFormView method setParameter.
@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
InfraServiceViewModel serviceViewModel = ofNullable(parameter).flatMap(id -> handleExceptions(() -> infraServiceService.findById(id, getCurrentResourceId()))).flatMap(Function.identity()).map(InfraServiceViewModelMapper::map).orElseGet(() -> new InfraServiceViewModel(getCurrentResourceId()));
String trans = parameter == null ? "view.site-admin.service.form.parameter.new" : "view.site-admin.service.form.parameter.update";
breadCrumbParameter = new BreadCrumbParameter(parameter, getTranslation(trans));
serviceFormComponent.setFormPools(serviceViewModel);
}
Aggregations