com.opencms.flex.jsp
Class CmsJspNavBuilder

java.lang.Object
  |
  +--com.opencms.flex.jsp.CmsJspNavBuilder

public class CmsJspNavBuilder
extends java.lang.Object

Bean to provide a convenient way to build navigation structures based on CmsJspNavElement.

Since:
5.0
Version:
$Revision: 1.5 $
Author:
Alexander Kandzior (a.kandzior@alkacon.com)
See Also:
CmsJspNavElement

Constructor Summary
CmsJspNavBuilder()
          Empty constructor, so that this bean can be initialized from a JSP.
CmsJspNavBuilder(com.opencms.file.CmsObject cms)
          Default constructor.
 
Method Summary
static java.util.ArrayList getChannelSubFolders(com.opencms.file.CmsObject cms, java.lang.String channel)
          Returns all subfolders of a channel, or an empty array if the folder does not exist or has no subfolders.
static java.util.ArrayList getChannelSubFolders(com.opencms.file.CmsObject cms, java.lang.String parentChannel, java.lang.String subChannel)
          Returns all subfolders of a sub channel that has the given parent channel, or an empty array if that combination does not exist or has no subfolders.
 java.util.ArrayList getChannelSubFolders(java.lang.String channel)
          Returns all subfolders of a channel, or an empty array if the folder does not exist or has no subfolders.
 java.util.ArrayList getChannelSubFolders(java.lang.String parentChannel, java.lang.String subChannel)
          Returns all subfolders of a sub channel that has the given parent channel, or an empty array if that combination does not exist or has no subfolders.
static java.util.ArrayList getChannelSubFoldersSortTitleAsc(com.opencms.file.CmsObject cms, java.lang.String channel, java.lang.String subChannel)
          Returns all subfolders of a channel, sorted by "Title" property ascending, or an empty array if the folder does not exist or has no subfolders.
 java.util.ArrayList getChannelSubFoldersSortTitleAsc(java.lang.String channel, java.lang.String subChannel)
          Returns all subfolders of a channel, sorted by "Title" property ascending, or an empty array if the folder does not exist or has no subfolders.
 java.util.ArrayList getNavigationForFolder()
          Collect all navigation elements from the files of the folder of the current request URI, navigation elements are of class CmsJspNavElement.
static java.util.ArrayList getNavigationForFolder(com.opencms.file.CmsObject cms, java.lang.String folder)
          Collect all navigation elements from the files in the given folder, navigation elements are of class CmsJspNavElement.
static java.util.ArrayList getNavigationForFolder(com.opencms.file.CmsObject cms, java.lang.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.
 java.util.ArrayList 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.
 java.util.ArrayList getNavigationForFolder(java.lang.String folder)
          Collect all navigation elements from the files in the given folder, navigation elements are of class CmsJspNavElement.
 java.util.ArrayList getNavigationForFolder(java.lang.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.
 com.opencms.flex.jsp.CmsJspNavElement getNavigationForResource()
          Returns a CmsJspNavElement for the resource of the current request URI.
static com.opencms.flex.jsp.CmsJspNavElement getNavigationForResource(com.opencms.file.CmsObject cms, java.lang.String resource)
          Returns a CmsJspNavElement for the named resource.
 com.opencms.flex.jsp.CmsJspNavElement getNavigationForResource(java.lang.String resource)
          Returns a CmsJspNavElement for the named resource.
static java.util.ArrayList getNavigationTreeForFolder(com.opencms.file.CmsObject cms, java.lang.String folder, int startlevel, int endlevel)
          Builds a tree navigation for the folders between the provided start and end level.
 java.util.ArrayList getNavigationTreeForFolder(int startlevel, int endlevel)
           
 java.util.ArrayList getNavigationTreeForFolder(java.lang.String folder, int startlevel, int endlevel)
           
 void init(com.opencms.file.CmsObject cms)
          Initiliazes this bean.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsJspNavBuilder

public CmsJspNavBuilder()
Empty constructor, so that this bean can be initialized from a JSP.

See Also:
Object.Object()

CmsJspNavBuilder

public CmsJspNavBuilder(com.opencms.file.CmsObject cms)
Default constructor.

Parameters:
cms - context provider for the current request
Method Detail

init

public void init(com.opencms.file.CmsObject cms)
Initiliazes this bean.

Parameters:
cms - context provider for the current request

getNavigationForResource

public com.opencms.flex.jsp.CmsJspNavElement getNavigationForResource()
Returns a CmsJspNavElement for the resource of the current request URI.

Returns:
CmsJspNavElement a CmsJspNavElement for the resource of the current request URI

getNavigationForResource

public com.opencms.flex.jsp.CmsJspNavElement getNavigationForResource(java.lang.String resource)
Returns a CmsJspNavElement for the named resource.

Parameters:
resource - the resource name to get the nav information for, must be a full path name, e.g. "/docs/index.html".
Returns:
CmsJspNavElement a CmsJspNavElement for the given resource

getNavigationForResource

public static com.opencms.flex.jsp.CmsJspNavElement getNavigationForResource(com.opencms.file.CmsObject cms,
                                                                             java.lang.String resource)
Returns a CmsJspNavElement for the named resource.

Parameters:
cms - context provider for the current request
resource - the resource name to get the nav information for, must be a full path name, e.g. "/docs/index.html".
Returns:
a CmsJspNavElement for the given resource

getNavigationForFolder

public java.util.ArrayList getNavigationForFolder()
Collect all navigation elements from the files of the folder of the current request URI, navigation elements are of class CmsJspNavElement.

Returns:
A sorted (ascending to nav position) ArrayList of navigation elements.

getNavigationForFolder

public java.util.ArrayList getNavigationForFolder(java.lang.String folder)
Collect all navigation elements from the files in the given folder, navigation elements are of class CmsJspNavElement.

Parameters:
folder - the selected folder
Returns:
A sorted (ascending to nav position) ArrayList of navigation elements.

getNavigationForFolder

public static java.util.ArrayList getNavigationForFolder(com.opencms.file.CmsObject cms,
                                                         java.lang.String folder)
Collect all navigation elements from the files in the given folder, navigation elements are of class CmsJspNavElement.

Parameters:
cms - context provider for the current request
folder - the selected folder
Returns:
A sorted (ascending to nav position) ArrayList of navigation elements.

getNavigationForFolder

public java.util.ArrayList 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.

If level is set to zero the root folder is used by convention.

Parameters:
level - if negative, walk this many levels up, if positive, walk this many levels down from root folder

getNavigationForFolder

public java.util.ArrayList getNavigationForFolder(java.lang.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.

If level is set to zero the root folder is used by convention.

Parameters:
folder - the selected folder
level - if negative, walk this many levels up, if positive, walk this many levels down from root folder

getNavigationForFolder

public static java.util.ArrayList getNavigationForFolder(com.opencms.file.CmsObject cms,
                                                         java.lang.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.

If level is set to zero the root folder is used by convention.

Parameters:
cms - context provider for the current request
folder - the selected folder
level - if negative, walk this many levels up, if positive, walk this many levels down from root folder

getNavigationTreeForFolder

public java.util.ArrayList getNavigationTreeForFolder(int startlevel,
                                                      int endlevel)
See Also:
getNavigationTreeForFolder(CmsObject, String, int, int)

getNavigationTreeForFolder

public java.util.ArrayList getNavigationTreeForFolder(java.lang.String folder,
                                                      int startlevel,
                                                      int endlevel)
See Also:
getNavigationTreeForFolder(CmsObject, String, int, int)

getNavigationTreeForFolder

public static java.util.ArrayList getNavigationTreeForFolder(com.opencms.file.CmsObject cms,
                                                             java.lang.String folder,
                                                             int startlevel,
                                                             int endlevel)
Builds a tree navigation for the folders between the provided start and end level.

A tree navigation includes all nav elements that are required to display a tree structure. However, the data structure is a simple list. Each of the nav elements in the list has the CmsJspNavElement.getNavTreeLevel() set to the level it belongs to. Use this information to distinguish between the nav levels.

Parameters:
cms - context provider for the current request
folder - the selected folder
startlevel - the start level
endlevel - the end level
Returns:
a sorted list of nav elements with the nav tree level property set

getChannelSubFolders

public java.util.ArrayList getChannelSubFolders(java.lang.String parentChannel,
                                                java.lang.String subChannel)
Returns all subfolders of a sub channel that has the given parent channel, or an empty array if that combination does not exist or has no subfolders.

Parameters:
parentChannel - the parent channel
subChannel - the sub channel
Returns:
an unsorted list of CmsResources

getChannelSubFolders

public static java.util.ArrayList getChannelSubFolders(com.opencms.file.CmsObject cms,
                                                       java.lang.String parentChannel,
                                                       java.lang.String subChannel)
Returns all subfolders of a sub channel that has the given parent channel, or an empty array if that combination does not exist or has no subfolders.

Parameters:
cms - context provider for the current request
parentChannel - the parent channel
subChannel - the sub channel
Returns:
an unsorted list of CmsResources

getChannelSubFolders

public java.util.ArrayList getChannelSubFolders(java.lang.String channel)
Returns all subfolders of a channel, or an empty array if the folder does not exist or has no subfolders.

Parameters:
channel - the channel to look for subfolders in
Returns:
an unsorted list of CmsResources

getChannelSubFolders

public static java.util.ArrayList getChannelSubFolders(com.opencms.file.CmsObject cms,
                                                       java.lang.String channel)
Returns all subfolders of a channel, or an empty array if the folder does not exist or has no subfolders.

Parameters:
cms - context provider for the current request
channel - the channel to look for subfolders in
Returns:
an unsorted list of CmsResources

getChannelSubFoldersSortTitleAsc

public java.util.ArrayList getChannelSubFoldersSortTitleAsc(java.lang.String channel,
                                                            java.lang.String subChannel)
Returns all subfolders of a channel, sorted by "Title" property ascending, or an empty array if the folder does not exist or has no subfolders.

Parameters:
channel - the parent channel
subChannel - the sub channel
Returns:
a sorted list of CmsResources

getChannelSubFoldersSortTitleAsc

public static java.util.ArrayList getChannelSubFoldersSortTitleAsc(com.opencms.file.CmsObject cms,
                                                                   java.lang.String channel,
                                                                   java.lang.String subChannel)
Returns all subfolders of a channel, sorted by "Title" property ascending, or an empty array if the folder does not exist or has no subfolders.

Parameters:
cms - context provider for the current request
channel - the parent channel
subChannel - the sub channel
Returns:
a sorted list of CmsResources