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

Commit de8dc6c

Browse files
committed
3403 refactor sample entry layout
1 parent 54d95fd commit de8dc6c

1 file changed

Lines changed: 25 additions & 24 deletions

File tree

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/sampleLink/SampleListEntry.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,6 @@ public SampleListEntry(SampleIndexDto sample) {
8080
materialLabel.setWidth(50, Unit.PERCENTAGE);
8181
topLeftLayout.addComponent(materialLabel);
8282

83-
Label dateTimeLabel = new Label(
84-
I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, SampleDto.SAMPLE_DATE_TIME) + ": "
85-
+ DateFormatHelper.formatDate(sample.getSampleDateTime()));
86-
topLeftLayout.addComponent(dateTimeLabel);
87-
88-
if (sample.getSamplePurpose() == SamplePurpose.INTERNAL) {
89-
Label purposeLabel = new Label(SamplePurpose.INTERNAL.toString());
90-
topLeftLayout.addComponent(purposeLabel);
91-
} else {
92-
Label labLabel = new Label(DataHelper.toStringNullable(sample.getLab()));
93-
topLeftLayout.addComponent(labLabel);
94-
}
95-
}
96-
topLayout.addComponent(topLeftLayout);
97-
98-
VerticalLayout topRightLayout = new VerticalLayout();
99-
{
100-
topRightLayout.addStyleName(CssStyles.ALIGN_RIGHT);
101-
topRightLayout.setMargin(false);
102-
topRightLayout.setSpacing(false);
103-
10483
Label resultLabel = new Label();
10584
CssStyles.style(resultLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE);
10685
if (sample.getPathogenTestResult() != null) {
@@ -114,7 +93,7 @@ public SampleListEntry(SampleIndexDto sample) {
11493
resultLabel.setValue(DataHelper.toStringNullable(sample.getSpecimenCondition()));
11594
resultLabel.addStyleName(CssStyles.LABEL_WARNING);
11695
}
117-
topRightLayout.addComponent(resultLabel);
96+
topLeftLayout.addComponent(resultLabel);
11897

11998
Label referredLabel = new Label();
12099
CssStyles.style(referredLabel, CssStyles.LABEL_BOLD, CssStyles.LABEL_UPPERCASE);
@@ -132,7 +111,29 @@ public SampleListEntry(SampleIndexDto sample) {
132111
referredLabel.setValue(I18nProperties.getCaption(Captions.sampleNotShippedLong));
133112
}
134113
}
135-
topRightLayout.addComponent(referredLabel);
114+
topLeftLayout.addComponent(referredLabel);
115+
116+
Label dateTimeLabel = new Label(
117+
I18nProperties.getPrefixCaption(SampleDto.I18N_PREFIX, SampleDto.SAMPLE_DATE_TIME) + ": "
118+
+ DateFormatHelper.formatDate(sample.getSampleDateTime()));
119+
topLeftLayout.addComponent(dateTimeLabel);
120+
121+
if (sample.getSamplePurpose() == SamplePurpose.INTERNAL) {
122+
Label purposeLabel = new Label(SamplePurpose.INTERNAL.toString());
123+
topLeftLayout.addComponent(purposeLabel);
124+
} else {
125+
Label labLabel = new Label(DataHelper.toStringNullable(sample.getLab()));
126+
topLeftLayout.addComponent(labLabel);
127+
}
128+
}
129+
130+
VerticalLayout topRightLayout = new VerticalLayout();
131+
{
132+
topRightLayout.addStyleName(CssStyles.ALIGN_RIGHT);
133+
topRightLayout.setMargin(false);
134+
topRightLayout.setSpacing(false);
135+
136+
topLayout.addComponent(topLeftLayout);
136137
}
137138
topLayout.addComponent(topRightLayout);
138139
topLayout.setComponentAlignment(topRightLayout, Alignment.TOP_RIGHT);
@@ -156,7 +157,7 @@ public void addEditListener(int rowIndex, ClickListener editClickListener) {
156157
CssStyles.BUTTON_COMPACT);
157158

158159
addComponent(editButton);
159-
setComponentAlignment(editButton, Alignment.MIDDLE_RIGHT);
160+
setComponentAlignment(editButton, Alignment.TOP_RIGHT);
160161
setExpandRatio(editButton, 0);
161162
}
162163

0 commit comments

Comments
 (0)