use of uk.nhs.digital.ps.beans.ImageSection in project hippo by NHS-digital-website.
the class PageSectionGrouper method groupSections.
public List<Object> groupSections(List<? extends HippoBean> sections) {
// convert the section into a grouped list so we can
// show multiple images next to each other in a section
List<Object> groupedSections = new ArrayList<>();
for (HippoBean section : sections) {
if (isHalfImage(section)) {
// if the last entry was a Image Pair with a space then we are the second one
ImageSection imageSection = (ImageSection) section;
Object last = groupedSections.size() > 0 ? groupedSections.get(groupedSections.size() - 1) : null;
if (isImagePairWithSpace(last)) {
((ImagePairSection) last).setSecond(imageSection);
} else {
groupedSections.add(new ImagePairSection(imageSection));
}
} else {
// just add it, no grouping required
groupedSections.add(section);
}
}
return groupedSections;
}
use of uk.nhs.digital.ps.beans.ImageSection in project hippo by NHS-digital-website.
the class PageSectionGrouperTest method mockImage.
private static ImageSection mockImage(ImageSection.Size size) {
ImageSection imageSection = mock(ImageSection.class);
given(imageSection.getSize()).willReturn(size);
return imageSection;
}
Aggregations