Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 84fb08e

Browse files
SORMAS-Foundation#3062 - Fixed other components being removed when setting the header
1 parent 99ac096 commit 84fb08e

14 files changed

Lines changed: 80 additions & 110 deletions

sormas-ui/src/main/java/de/symeda/sormas/ui/campaign/AbstractCampaignView.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515

1616
package de.symeda.sormas.ui.campaign;
1717

18-
import java.util.Optional;
19-
2018
import com.vaadin.navigator.Navigator;
2119
import com.vaadin.ui.Component;
22-
import com.vaadin.ui.Label;
23-
import com.vaadin.ui.VerticalLayout;
2420

2521
import de.symeda.sormas.api.i18n.I18nProperties;
2622
import de.symeda.sormas.ui.SubMenu;
@@ -40,7 +36,7 @@ protected AbstractCampaignView(String viewName) {
4036
}
4137

4238
@Override
43-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
39+
public void refreshMenu(SubMenu menu, String params) {
4440
menu.removeAllViews();
4541

4642
menu.addView(
@@ -60,9 +56,4 @@ public static void registerViews(Navigator navigator) {
6056
navigator.addView(CampaignView.VIEW_NAME, CampaignView.class);
6157
}
6258

63-
@Override
64-
protected Optional<VerticalLayout> createInfoLayout() {
65-
return Optional.empty();
66-
}
67-
6859
}

sormas-ui/src/main/java/de/symeda/sormas/ui/campaign/campaigndata/AbstractCampaignDataView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package de.symeda.sormas.ui.campaign.campaigndata;
1717

1818
import com.vaadin.navigator.ViewChangeListener;
19-
import com.vaadin.ui.Label;
19+
2020
import de.symeda.sormas.api.FacadeProvider;
2121
import de.symeda.sormas.api.campaign.data.CampaignFormDataReferenceDto;
2222
import de.symeda.sormas.api.i18n.Captions;
@@ -41,7 +41,7 @@ public void enter(ViewChangeListener.ViewChangeEvent event) {
4141
}
4242

4343
@Override
44-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
44+
public void refreshMenu(SubMenu menu, String params) {
4545
if (!findReferenceByParams(params)) {
4646
return;
4747
}

sormas-ui/src/main/java/de/symeda/sormas/ui/campaign/campaigndata/CampaignFormDataView.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ protected void initView(String params) {
5050

5151
CampaignFormDataDto campaignFormData = FacadeProvider.getCampaignFormDataFacade().getCampaignFormDataByUuid(getReference().getUuid());
5252
editComponent = ControllerProvider.getCampaignController()
53-
.getCampaignFormDataComponent(campaignFormData, campaignFormData.getCampaign(), campaignFormData.getCampaignFormMeta(), true, true, () -> {
54-
SormasUI.refreshView();
55-
Notification.show(
56-
String.format(I18nProperties.getString(Strings.messageCampaignFormSaved), campaignFormData.getCampaignFormMeta().toString()),
57-
TRAY_NOTIFICATION);
58-
}, null);
53+
.getCampaignFormDataComponent(
54+
campaignFormData,
55+
campaignFormData.getCampaign(),
56+
campaignFormData.getCampaignFormMeta(),
57+
true,
58+
true,
59+
() -> {
60+
SormasUI.refreshView();
61+
Notification.show(
62+
String.format(I18nProperties.getString(Strings.messageCampaignFormSaved), campaignFormData.getCampaignFormMeta().toString()),
63+
TRAY_NOTIFICATION);
64+
},
65+
null);
5966
editComponent.setMargin(false);
6067
editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
6168
editComponent.setHeightUndefined();
@@ -64,8 +71,6 @@ protected void initView(String params) {
6471

6572
container.addComponent(editComponent);
6673

67-
hideInfoLabel();
68-
6974
getViewTitleLabel().setValue(campaignFormData.getCampaignFormMeta().toString());
7075
}
7176
}

sormas-ui/src/main/java/de/symeda/sormas/ui/campaign/campaigns/CampaignView.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static com.vaadin.ui.Notification.Type.TRAY_NOTIFICATION;
44

55
import com.vaadin.navigator.ViewChangeListener;
6-
import com.vaadin.ui.Label;
76
import com.vaadin.ui.Notification;
87

98
import de.symeda.sormas.api.FacadeProvider;
@@ -71,13 +70,11 @@ protected void initView(String params) {
7170

7271
container.addComponent(editComponent);
7372

74-
hideInfoLabel();
75-
7673
getViewTitleLabel().setValue(campaignDto.getName());
7774
}
7875

7976
@Override
80-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
77+
public void refreshMenu(SubMenu menu, String params) {
8178
if (!findReferenceByParams(params)) {
8279
return;
8380
}

sormas-ui/src/main/java/de/symeda/sormas/ui/caze/AbstractCaseView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
2121
import com.vaadin.ui.Component;
22-
import com.vaadin.ui.Label;
2322
import com.vaadin.ui.UI;
2423
import com.vaadin.ui.themes.ValoTheme;
2524
import com.vaadin.v7.data.Property;
@@ -104,7 +103,7 @@ public void valueChange(ValueChangeEvent event) {
104103
}
105104

106105
@Override
107-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
106+
public void refreshMenu(SubMenu menu, String params) {
108107

109108
if (!findReferenceByParams(params)) {
110109
return;
@@ -198,7 +197,7 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
198197
menu.addView(CaseContactsView.VIEW_NAME, I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, Captions.caseContacts), params);
199198
}
200199

201-
replaceViewHeader(ControllerProvider.getCaseController().getCaseViewTitleLayout(caze));
200+
setMainHeaderComponent(ControllerProvider.getCaseController().getCaseViewTitleLayout(caze));
202201
}
203202

204203
@Override

sormas-ui/src/main/java/de/symeda/sormas/ui/configuration/AbstractConfigurationView.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
*******************************************************************************/
1818
package de.symeda.sormas.ui.configuration;
1919

20-
import java.util.Optional;
21-
2220
import com.vaadin.navigator.Navigator;
23-
import com.vaadin.ui.Label;
24-
import com.vaadin.ui.VerticalLayout;
2521

2622
import de.symeda.sormas.api.FacadeProvider;
2723
import de.symeda.sormas.api.feature.FeatureType;
@@ -56,7 +52,7 @@ protected AbstractConfigurationView(String viewName) {
5652
}
5753

5854
@Override
59-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
55+
public void refreshMenu(SubMenu menu, String params) {
6056
menu.removeAllViews();
6157

6258
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.OUTBREAKS)) {
@@ -68,16 +64,16 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
6864

6965
boolean isCaseSurveillanceEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.CASE_SURVEILANCE);
7066
boolean isAnySurveillanceEnabled = isCaseSurveillanceEnabled
71-
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)
72-
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.AGGREGATE_REPORTING);
67+
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)
68+
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.AGGREGATE_REPORTING);
7369

7470
if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_VIEW)) {
7571
if (isAnySurveillanceEnabled) {
7672
menu.addView(
77-
CountriesView.VIEW_NAME,
78-
I18nProperties.getPrefixCaption("View", CountriesView.VIEW_NAME.replaceAll("/", ".") + ".short", ""),
79-
null,
80-
false);
73+
CountriesView.VIEW_NAME,
74+
I18nProperties.getPrefixCaption("View", CountriesView.VIEW_NAME.replaceAll("/", ".") + ".short", ""),
75+
null,
76+
false);
8177
}
8278
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.INFRASTRUCTURE_TYPE_AREA)) {
8379
menu.addView(
@@ -162,8 +158,8 @@ public static void registerViews(Navigator navigator) {
162158

163159
boolean isCaseSurveillanceEnabled = FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.CASE_SURVEILANCE);
164160
boolean isAnySurveillanceEnabled = isCaseSurveillanceEnabled
165-
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)
166-
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.AGGREGATE_REPORTING);
161+
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)
162+
|| FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.AGGREGATE_REPORTING);
167163

168164
if (UserProvider.getCurrent().hasUserRight(UserRight.INFRASTRUCTURE_VIEW)) {
169165
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.INFRASTRUCTURE_TYPE_AREA)) {
@@ -204,8 +200,4 @@ public static void registerViews(Navigator navigator) {
204200
}
205201
}
206202

207-
@Override
208-
protected Optional<VerticalLayout> createInfoLayout() {
209-
return Optional.empty();
210-
}
211203
}

sormas-ui/src/main/java/de/symeda/sormas/ui/contact/AbstractContactView.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
2424
import com.vaadin.ui.Button;
2525
import com.vaadin.ui.Component;
26-
import com.vaadin.ui.Label;
2726
import com.vaadin.ui.themes.ValoTheme;
2827

2928
import de.symeda.sormas.api.FacadeProvider;
@@ -86,7 +85,7 @@ public void enter(ViewChangeEvent event) {
8685
}
8786

8887
@Override
89-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
88+
public void refreshMenu(SubMenu menu, String params) {
9089

9190
if (!findReferenceByParams(params)) {
9291
return;
@@ -104,7 +103,7 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
104103
menu.addView(ContactEpiDataView.VIEW_NAME, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, ContactDto.EPI_DATA), params);
105104
menu.addView(ContactVisitsView.VIEW_NAME, I18nProperties.getPrefixCaption(ContactDto.I18N_PREFIX, ContactDto.VISITS), params);
106105

107-
replaceViewHeader(ControllerProvider.getContactController().getContactViewTitleLayout(contact));
106+
setMainHeaderComponent(ControllerProvider.getContactController().getContactViewTitleLayout(contact));
108107
}
109108

110109
@Override
@@ -148,7 +147,7 @@ public ContactReferenceDto getContactRef() {
148147
}
149148

150149
public void setContactEditPermission(Component component) {
151-
Boolean isContactEditAllowed = isContactEditAllowed();
150+
boolean isContactEditAllowed = isContactEditAllowed();
152151
if (!isContactEditAllowed) {
153152
getComponent(getComponentIndex(component)).setEnabled(false);
154153
}

sormas-ui/src/main/java/de/symeda/sormas/ui/events/AbstractEventView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
2121
import com.vaadin.ui.Component;
22-
import com.vaadin.ui.Label;
2322

2423
import de.symeda.sormas.api.FacadeProvider;
2524
import de.symeda.sormas.api.event.EventDto;
@@ -48,7 +47,7 @@ public void enter(ViewChangeEvent event) {
4847
}
4948

5049
@Override
51-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
50+
public void refreshMenu(SubMenu menu, String params) {
5251

5352
if (!findReferenceByParams(params)) {
5453
return;
@@ -60,7 +59,7 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
6059
menu.addView(EventParticipantsView.VIEW_NAME, I18nProperties.getCaption(Captions.eventEventParticipants), params);
6160
menu.addView(EventActionsView.VIEW_NAME, I18nProperties.getCaption(Captions.eventEventActions), params);
6261

63-
replaceViewHeader(ControllerProvider.getEventController().getEventViewTitleLayout(getReference().getUuid()));
62+
setMainHeaderComponent(ControllerProvider.getEventController().getEventViewTitleLayout(getReference().getUuid()));
6463
}
6564

6665
@Override

sormas-ui/src/main/java/de/symeda/sormas/ui/events/EventParticipantDataView.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class EventParticipantDataView extends AbstractDetailView<EventParticipan
6060

6161
public EventParticipantDataView() {
6262
super(VIEW_NAME);
63-
hideInfoLabel();
6463
}
6564

6665
@Override
@@ -158,7 +157,7 @@ protected void initView(String params) {
158157
}
159158

160159
@Override
161-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
160+
public void refreshMenu(SubMenu menu, String params) {
162161

163162
if (!findReferenceByParams(params)) {
164163
return;
@@ -174,9 +173,7 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
174173
true);
175174

176175
menu.addView(EventParticipantDataView.VIEW_NAME, I18nProperties.getCaption(EventParticipantDto.I18N_PREFIX), params);
177-
infoLabel.setValue(I18nProperties.getCaption(Captions.EventParticipant));
178-
infoLabelSub.setValue(eventParticipantDto.getPerson().toString());
179176

180-
replaceViewHeader(ControllerProvider.getEventParticipantController().getEventParticipantViewTitleLayout(eventParticipantDto));
177+
setMainHeaderComponent(ControllerProvider.getEventParticipantController().getEventParticipantViewTitleLayout(eventParticipantDto));
181178
}
182179
}

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/AbstractSampleView.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
2121
import com.vaadin.ui.Component;
22-
import com.vaadin.ui.Label;
2322

2423
import de.symeda.sormas.api.FacadeProvider;
2524
import de.symeda.sormas.api.caze.CaseReferenceDto;
@@ -31,7 +30,7 @@
3130
import de.symeda.sormas.api.sample.SampleDto;
3231
import de.symeda.sormas.api.sample.SampleReferenceDto;
3332
import de.symeda.sormas.api.user.UserRight;
34-
import de.symeda.sormas.api.utils.DataHelper;
33+
import de.symeda.sormas.ui.ControllerProvider;
3534
import de.symeda.sormas.ui.SubMenu;
3635
import de.symeda.sormas.ui.UserProvider;
3736
import de.symeda.sormas.ui.caze.CaseDataView;
@@ -57,7 +56,7 @@ public void enter(ViewChangeEvent event) {
5756
}
5857

5958
@Override
60-
public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, String params) {
59+
public void refreshMenu(SubMenu menu, String params) {
6160

6261
if (!findReferenceByParams(params)) {
6362
return;
@@ -87,8 +86,8 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
8786
}
8887

8988
menu.addView(SampleDataView.VIEW_NAME, I18nProperties.getCaption(SampleDto.I18N_PREFIX), params);
90-
infoLabel.setValue(getReference().getCaption());
91-
infoLabelSub.setValue(DataHelper.getShortUuid(getReference().getUuid()));
89+
90+
setMainHeaderComponent(ControllerProvider.getSampleController().getSampleViewTitleLayout(sampleByUuid));
9291
}
9392

9493
@Override

0 commit comments

Comments
 (0)