Package org.opencms.jsp
Class CmsJspNavBuilder
java.lang.Object
org.opencms.jsp.CmsJspNavBuilder
Bean to provide a convenient way to build navigation structures based on the
CmsJspNavElement
.
Use this together with the
to obtain navigation information based on the current users permissions.
For example, use CmsJspActionElement
and pass the
value of the current OpenCms user context uri obtained
from getNavigationForFolder(String)
as argument to obtain a list
of all items in the navigation of the current folder. Then use a simple scriptlet to
iterate over these items and create a HTML navigation.CmsRequestContext.getUri()
- Since:
- 6.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Navigation builder context.static enum
The visibility mode. -
Field Summary
Modifier and TypeFieldDescriptionprotected CmsObject
The current CMS context.protected Locale
The locale for which the property should be read.protected String
The current request URI.protected String
The current request folder.static final String
Default file property value to mark navigation level folders. -
Constructor Summary
ConstructorDescriptionEmpty constructor, so that this bean can be initialized from a JSP.Default constructor.CmsJspNavBuilder
(CmsObject cms, Locale locale) Constructor for a version that reads properties according to a locale. -
Method Summary
Modifier and TypeMethodDescriptionGets the CMS context used for building the navigation.static String
getDefaultFile
(CmsObject cms, String folder) Deprecated.Build a "bread crumb" path navigation to the current folder.getNavigationBreadCrumb
(int startlevel, boolean currentFolder) Build a "bread crumb" path navigation to the current folder.getNavigationBreadCrumb
(int startlevel, int endlevel) Build a "bread crumb" path navigation to the current folder.getNavigationBreadCrumb
(String folder, int startlevel, int endlevel, boolean currentFolder) Build a "bread crumb" path navigation to the given folder.Collect all navigation elements from the files of the folder of the current request URI.getNavigationForFolder
(int level) Build a navigation for the folder that is either minus levels up from of the folder of the current request URI, or that is plus levels down from the root folder towards the current request URI.getNavigationForFolder
(String folder) Collect all navigation visible elements from the files in the given folder.getNavigationForFolder
(String folder, int level) Build a navigation for the folder that is either minus levels up from the given folder, or that is plus levels down from the root folder towards the given folder.getNavigationForFolder
(String folder, CmsJspNavBuilder.Visibility visibility, CmsResourceFilter resourceFilter) Collect all navigation elements from the files in the given folder.static List<CmsJspNavElement>
getNavigationForFolder
(CmsObject cms, String folder) Deprecated.usegetNavigationForFolder(String)
insteadstatic List<CmsJspNavElement>
getNavigationForFolder
(CmsObject cms, String folder, int level) Deprecated.usegetNavigationForFolder(String, int)
insteadReturns a navigation element for the resource of the current request URI.getNavigationForResource
(String sitePath) Returns a navigation element for the named resource.getNavigationForResource
(String sitePath, CmsResourceFilter reourceFilter) Returns a navigation element for the named resource.static CmsJspNavElement
getNavigationForResource
(CmsObject cms, String resource) Deprecated.usegetNavigationForResource(String)
insteadgetNavigationTreeForFolder
(int startlevel, int endlevel) Builds a tree navigation for the folders between the provided start and end level.getNavigationTreeForFolder
(String folder, int startlevel, int endlevel) Builds a tree navigation for the folders between the provided start and end level.static List<CmsJspNavElement>
getNavigationTreeForFolder
(CmsObject cms, String folder, int startlevel, int endlevel) Deprecated.usegetNavigationForResource(String)
insteadThis method builds a complete site navigation tree with entries of all branches.getSiteNavigation
(String folder, int endLevel) This method builds a complete navigation tree with entries of all branches from the specified folder.getSiteNavigation
(String folder, CmsJspNavBuilder.Visibility visibility, int endLevel) This method builds a complete navigation tree with entries of all branches from the specified folder.static List<CmsJspNavElement>
getSiteNavigation
(CmsObject cms, String folder, int endLevel) Deprecated.usegetNavigationForResource(String)
insteadvoid
Initializes this bean.void
Initializes this bean.void
Initializes this bean.static boolean
isNavLevelFolder
(CmsObject cms, CmsResource resource) Returns whether the given resource is a folder and is marked to be a navigation level folder.
-
Field Details
-
NAVIGATION_LEVEL_FOLDER
Default file property value to mark navigation level folders.- See Also:
-
m_cms
The current CMS context. -
m_locale
The locale for which the property should be read. -
m_requestUri
The current request URI. -
m_requestUriFolder
The current request folder.
-
-
Constructor Details
-
CmsJspNavBuilder
public CmsJspNavBuilder()Empty constructor, so that this bean can be initialized from a JSP. -
CmsJspNavBuilder
Default constructor.- Parameters:
cms
- context provider for the current request
-
CmsJspNavBuilder
Constructor for a version that reads properties according to a locale.- Parameters:
cms
- context provider for the current requestlocale
- the locale for which properties should be accessed
-
-
Method Details
-
getDefaultFile
Deprecated.useCmsObject.readDefaultFile(String)
insteadReturns the full name (including VFS path) of the default file for this navigation element ornull
if the navigation element is not a folder.The default file of a folder is determined by the value of the property
default-file
or the system wide property setting.- Parameters:
cms
- the CMS objectfolder
- full name of the folder- Returns:
- the name of the default file
-
getCmsObject
Gets the CMS context used for building the navigation.- Returns:
- the CMS context
-
init
Initializes this bean.- Parameters:
cms
- the current cms context
-
init
Initializes this bean.- Parameters:
cms
- the current cms contextlocale
- the locale for which properties should be read
-
init
Initializes this bean.- Parameters:
cms
- the current cms contextlocale
- the locale for which properties should be readrequestUri
- the request URI
-
CmsObject.readDefaultFile(String)
instead