Class CmsJspNavElement
- All Implemented Interfaces:
Comparable<CmsJspNavElement>
Each navigation element contains a number of information about a VFS resource, obtained either from the resources properties or attributes. You can use this information to generate a HTML navigation for files in the VFS in your template.
Note: this class has a natural ordering that is inconsistent with equals.
- Since:
- 6.0.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LocaleThe locale for which the property should be read.protected CmsJspNavBuilder.NavContextThe navigation context. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor required for every JavaBean, does nothing.CmsJspNavElement(String sitePath, Map<String, String> properties) Deprecated.CmsJspNavElement(String sitePath, Map<String, String> properties, int navTreeLevel) Deprecated.CmsJspNavElement(String sitePath, CmsResource resource, Map<String, String> properties) Create a new instance of the bean and calls the init method with the provided parameters.CmsJspNavElement(String sitePath, CmsResource resource, Map<String, String> properties, int navTreeLevel) Create a new instance of the bean and calls the init method with the provided parameters.CmsJspNavElement(String sitePath, CmsResource resource, Map<String, String> properties, int navTreeLevel, Locale locale) Create a new instance of the bean and calls the init method with the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionintNote: this class has a natural ordering that is inconsistent with equals.booleanNote: this class has a natural ordering that is inconsistent with equals.Returns the value of the property PROPERTY_DESCRIPTION of this navigation element, ornullif this property is not set.Returns the filename of the navigation element, i.e.getInfo()Returns the value of the propertyof this navigation element, orCmsPropertyDefinition.PROPERTY_NAVINFOnullif this property is not set.Returns the value of the propertyof this navigation element, orCmsPropertyDefinition.PROPERTY_LOCALEnullif this property is not set.Returns the navigation builder context.Returns the value of the propertyof this navigation element, orCmsPropertyDefinition.PROPERTY_NAVIMAGEnullif this property is not set.floatReturns the value of the property C_PROPERTY_NAVPOS converted to afloat, or a value ofFloat.MAX_VALUEif the navigation position property is not set (or not a valid number) for this resource.Returns the value of the property PROPERTY_NAVTEXT of this navigation element, or a warning message if this property is not set (this method will never returnnull).intReturns the navigation tree level of this resource.Returns the name of the parent folder of the resource of this navigation element.Returns the original map of all file properties of the resource that the navigation element belongs to.getProperty(String key) Returns the value of the selected property from this navigation element.Returns the resource.Returns the resource name this navigation element was initialized with.protected StringReturns the site path of the target resource.Gets the sub-entries of the navigation entry.getTitle()Returns the value of the property PROPERTY_TITLE of this navigation element, ornullif this property is not set.booleanReturns if the navigation position has been changed since initialization.inthashCode()Note: this class has a natural ordering that is inconsistent with equals.voidSame as callinginit(String, Hashtable, -1, null).voidInitialized the member variables of this bean with the values provided.voidInitialized the member variables of this bean with the values provided.booleanReturnstrueif this navigation element describes a folder,falseotherwise.booleanReturns if this is a hidden navigation entry.booleanReturnstrueif this navigation element is in the navigation,falseotherwise.booleanReturns if the navigation element represents a navigation level, linking to it's first sub-element.voidsetNavContext(CmsJspNavBuilder.NavContext navContext) Sets the navigation builder context.voidsetNavPosition(float value) Sets the value that will be returned by thegetNavPosition()method of this class.voidsetNavText(String text) Sets the navigation text.voidsetNavTreeLevel(int navTreeLevel) Sets the navigation tree level.protected voidsetResource(CmsResource resource) Sets the resource.toString()
-
Field Details
-
m_locale
The locale for which the property should be read.
-
-
Constructor Details
-
CmsJspNavElement
public CmsJspNavElement()Empty constructor required for every JavaBean, does nothing.Call one of the init methods after you have created an instance of the bean. Instead of using the constructor you should use the static factory methods provided by this class to create navigation beans that are properly initialized with current OpenCms context.
- See Also:
-
CmsJspNavElement
Create a new instance of the bean and calls the init method with the provided parameters.- Parameters:
sitePath- will be passed toinitresource- the resourceproperties- will be passed toinit
-
CmsJspNavElement
public CmsJspNavElement(String sitePath, CmsResource resource, Map<String, String> properties, int navTreeLevel) Create a new instance of the bean and calls the init method with the provided parameters.- Parameters:
sitePath- will be passed toinitresource- the resourceproperties- will be passed toinitnavTreeLevel- will be passed toinit- See Also:
-
CmsJspNavElement
public CmsJspNavElement(String sitePath, CmsResource resource, Map<String, String> properties, int navTreeLevel, Locale locale) Create a new instance of the bean and calls the init method with the provided parameters.- Parameters:
sitePath- will be passed toinitresource- the resourceproperties- will be passed toinitnavTreeLevel- will be passed toinitlocale- the locale for which properties should be accessed.- See Also:
-
CmsJspNavElement
Deprecated.Create a new instance of the bean and calls the init method with the provided parameters.- Parameters:
sitePath- will be passed toinitproperties- will be passed toinit- See Also:
-
CmsJspNavElement
@Deprecated public CmsJspNavElement(String sitePath, Map<String, String> properties, int navTreeLevel) Deprecated.Create a new instance of the bean and calls the init method with the provided parameters.- Parameters:
sitePath- will be passed toinitproperties- will be passed toinitnavTreeLevel- will be passed toinit- See Also:
-
-
Method Details
-
equals
Note: this class has a natural ordering that is inconsistent with equals. -
getDescription
Returns the value of the property PROPERTY_DESCRIPTION of this navigation element, ornullif this property is not set.- Returns:
- the value of the property PROPERTY_DESCRIPTION of this navigation element
or
nullif this property is not set
-
getFileName
Returns the filename of the navigation element, i.e. the name of the navigation resource without any path information.- Returns:
- the filename of the navigation element, i.e. the name of the navigation resource without any path information
-
getInfo
Returns the value of the propertyof this navigation element, orCmsPropertyDefinition.PROPERTY_NAVINFOnullif this property is not set.- Returns:
- the value of the property or
nullif this property is not set
-
getLocale
Returns the value of the propertyof this navigation element, orCmsPropertyDefinition.PROPERTY_LOCALEnullif this property is not set.- Returns:
- the value of the property or
nullif this property is not set
-
getParentFolderName
Returns the name of the parent folder of the resource of this navigation element.- Returns:
- the name of the parent folder of the resource of this navigation element
-
getProperties
Returns the original map of all file properties of the resource that the navigation element belongs to.Please note that the original reference is returned, so be careful when making changes to the map.
- Returns:
- the original map of all file properties of the resource that the navigation element belongs to
-
getProperty
Returns the value of the selected property from this navigation element.The navigation element contains a hash of all file properties of the resource that the navigation element belongs to.
- Parameters:
key- the property name to look up- Returns:
- the value of the selected property
-
getResource
Returns the resource.- Returns:
- the resource
-
getResourceName
Returns the resource name this navigation element was initialized with.- Returns:
- the resource name this navigation element was initialized with
-
getTitle
Returns the value of the property PROPERTY_TITLE of this navigation element, ornullif this property is not set.- Returns:
- the value of the property PROPERTY_TITLE of this navigation element
or
nullif this property is not set
-
hashCode
Note: this class has a natural ordering that is inconsistent with equals. -
init
Same as callinginit(String, Hashtable, -1, null).- Parameters:
resource- the name of the resource to extract the navigation information fromproperties- the properties of the resource read from the vfs
-
init
Initialized the member variables of this bean with the values provided.A resource will be in the navigation if at least one of the two properties
I_CmsConstants.PROPERTY_NAVTEXTorI_CmsConstants.PROPERTY_NAVPOSis set. Otherwise it will be ignored.This bean does provides static methods to create a new instance from the context of a current CmsObject. Call these static methods in order to get a properly initialized bean.
- Parameters:
resource- the name of the resource to extract the navigation information fromproperties- the properties of the resource read from the vfsnavTreeLevel- tree level of this resource, for building navigation trees- See Also:
-
init
Initialized the member variables of this bean with the values provided.A resource will be in the navigation if at least one of the two properties
I_CmsConstants.PROPERTY_NAVTEXTorI_CmsConstants.PROPERTY_NAVPOSis set. Otherwise it will be ignored.This bean does provides static methods to create a new instance from the context of a current CmsObject. Call these static methods in order to get a properly initialized bean.
- Parameters:
resource- the name of the resource to extract the navigation information fromproperties- the properties of the resource read from the vfsnavTreeLevel- tree level of this resource, for building navigation treeslocale- The locale for which properties should be accessed.- See Also:
-
isFolderLink
Returnstrueif this navigation element describes a folder,falseotherwise.- Returns:
trueif this navigation element describes a folder,falseotherwise.
-
toString
-
getSitePath
Returns the site path of the target resource.This may not be the same as the navigation resource.
- Returns:
- the target resource site path
-
setResource
Sets the resource.- Parameters:
resource- the resource to set
CmsJspNavElement(String, CmsResource, Map)