Package org.opencms.ade.sitemap
Class CmsSitemapNavPosCalculator
- java.lang.Object
-
- org.opencms.ade.sitemap.CmsSitemapNavPosCalculator
-
public class CmsSitemapNavPosCalculator extends java.lang.Object
Helper class for recalculating navigation positions when a user has changed the order of navigation entries in the sitemap editor.This is harder than it sounds because we need to handle special cases like e.g. the user inserting an entry between two existing entries with the same navigation position, which means we need to update the navigation positions of multiple entries to force the ordering which the user wanted.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DUMMY_PATH
Dummy file name for the inserted dummy navigation element.
-
Constructor Summary
Constructors Constructor Description CmsSitemapNavPosCalculator(java.util.List<CmsJspNavElement> navigation, CmsResource movedElement, int insertPosition)
Creates a new sitemap navigation position calculator and performs the navigation position calculation for a given insertion operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getInsertPositionInResult()
Gets the insert position in the final result list.java.util.List<CmsJspNavElement>
getNavigationChanges()
Gets the changed navigation entries from the final result list.java.util.List<CmsJspNavElement>
getResultList()
Gets the final result list.
-
-
-
Field Detail
-
DUMMY_PATH
public static final java.lang.String DUMMY_PATH
Dummy file name for the inserted dummy navigation element.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsSitemapNavPosCalculator
public CmsSitemapNavPosCalculator(java.util.List<CmsJspNavElement> navigation, CmsResource movedElement, int insertPosition)
Creates a new sitemap navigation position calculator and performs the navigation position calculation for a given insertion operation.- Parameters:
navigation
- the existing navigation element listmovedElement
- the resource which should be insertedinsertPosition
- the insertion position in the list
-
-
Method Detail
-
getInsertPositionInResult
public int getInsertPositionInResult()
Gets the insert position in the final result list.- Returns:
- the insert position in the final result
-
getNavigationChanges
public java.util.List<CmsJspNavElement> getNavigationChanges()
Gets the changed navigation entries from the final result list.- Returns:
- the changed navigation entries for the final result list
-
getResultList
public java.util.List<CmsJspNavElement> getResultList()
Gets the final result list.- Returns:
- the final result list
-
-