From 1098365d62f65195905bc5a49d4bc3273baf7b4a Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 11 Nov 2022 15:16:32 +0100 Subject: [PATCH] add hasSpatialLayers() --- .../shared/geoportal/view/SectionView.java | 88 ++++++++++++++----- 1 file changed, 66 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/view/SectionView.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/view/SectionView.java index 7bf3f03..718cae0 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/view/SectionView.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/view/SectionView.java @@ -4,9 +4,15 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; +/** + * The Class SectionView. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Nov 11, 2022 + */ public class SectionView implements Serializable, CheckEmpty { - /** * */ @@ -16,41 +22,64 @@ public class SectionView implements Serializable, CheckEmpty { private List listSubDocuments; + /** + * Instantiates a new section view. + */ public SectionView() { } - + + /** + * Checks if is empty. + * + * @return true, if is empty + */ @Override - public boolean isEmpty(){ + public boolean isEmpty() { if (listSubDocuments == null) return true; - + for (SubDocumentView subDocumentView : listSubDocuments) { boolean isEmpty = subDocumentView.isEmpty(); - if(isEmpty) + if (isEmpty) return true; } - - return false; - } - - public boolean hasSpatialLayers(){ - if (listSubDocuments == null) - return false; - - for (SubDocumentView subDocumentView : listSubDocuments) { - boolean hasLayers = subDocumentView.getListLayers()!=null && subDocumentView.getListLayers().size()>0; - if(hasLayers) - return true; - } - + return false; } + /** + * Checks for spatial layers. + * + * @return true, if successful + */ + public boolean hasSpatialLayers() { + if (listSubDocuments == null) + return false; + + for (SubDocumentView subDocumentView : listSubDocuments) { + boolean hasLayers = subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0; + if (hasLayers) + return true; + } + + return false; + } + + /** + * Gets the section title. + * + * @return the section title + */ public String getSectionTitle() { return sectionTitle; } + /** + * Adds the sub document. + * + * @param subDocumentView the sub document view + */ public void addSubDocument(SubDocumentView subDocumentView) { if (listSubDocuments == null) @@ -59,18 +88,33 @@ public class SectionView implements Serializable, CheckEmpty { listSubDocuments.add(subDocumentView); } + /** + * Gets the list sub documents. + * + * @return the list sub documents + */ public List getListSubDocuments() { - - if(listSubDocuments == null) + + if (listSubDocuments == null) listSubDocuments = new ArrayList(); - + return listSubDocuments; } + /** + * Sets the section title. + * + * @param sectionTitle the new section title + */ public void setSectionTitle(String sectionTitle) { this.sectionTitle = sectionTitle; } + /** + * To string. + * + * @return the string + */ @Override public String toString() { StringBuilder builder = new StringBuilder();