This repository was archived by the owner on May 5, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
sormas-ui/src/main/java/de/symeda/sormas/ui/campaign/campaigns Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525import java .util .HashSet ;
2626import java .util .stream .Collectors ;
2727
28+ import org .apache .commons .collections .CollectionUtils ;
29+
2830import com .vaadin .icons .VaadinIcons ;
2931import com .vaadin .shared .ui .ContentMode ;
3032import com .vaadin .shared .ui .MarginInfo ;
@@ -170,12 +172,16 @@ public CampaignDto getValue() {
170172 @ Override
171173 public void setValue (CampaignDto newFieldValue ) throws ReadOnlyException , Converter .ConversionException {
172174 super .setValue (newFieldValue );
173- campaignFormsGridComponent .setSavedItems (new ArrayList <>(newFieldValue .getCampaignFormMetas ()));
174- campaignDashboardGridComponent .setSavedItems (
175- newFieldValue .getCampaignDashboardElements ()
176- .stream ()
177- .sorted (Comparator .comparingInt (CampaignDashboardElement ::getOrder ))
178- .collect (Collectors .toList ()));
175+ campaignFormsGridComponent
176+ .setSavedItems (newFieldValue .getCampaignFormMetas () != null ? new ArrayList <>(newFieldValue .getCampaignFormMetas ()) : new ArrayList <>());
177+
178+ if (CollectionUtils .isNotEmpty (newFieldValue .getCampaignDashboardElements ())) {
179+ campaignDashboardGridComponent .setSavedItems (
180+ newFieldValue .getCampaignDashboardElements ()
181+ .stream ()
182+ .sorted (Comparator .comparingInt (CampaignDashboardElement ::getOrder ))
183+ .collect (Collectors .toList ()));
184+ }
179185 }
180186
181187 @ Override
You can’t perform that action at this time.
0 commit comments