Class CmsSitemapTreeController


  • public class CmsSitemapTreeController
    extends java.lang.Object
    Manages the sitemap tree in the 'locale comparison' view in the sitemap editor.

    • Field Detail

      • RHS_WIDTH

        public static final int RHS_WIDTH
        Default width for linked items displayed on the right side of tree items.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CmsSitemapTreeController

        public CmsSitemapTreeController​(CmsObject cms,
                                        CmsResource root,
                                        I_CmsLocaleCompareContext context,
                                        com.vaadin.ui.Component parent)
        Creates a new instance.

        Parameters:
        cms - the CMS context
        root - the tree's root resource
        context - the locale comparison context
        parent - the parent widget in which the tree will be rendered
    • Method Detail

      • activeIfTrue

        public static CmsMenuItemVisibilityMode activeIfTrue​(boolean condition)
        Returns VISIBILITY_ACTIVE if the given parameter is true, and VISIBILITY_INACTIVE otherwise.

        Parameters:
        condition - a boolean value
        Returns:
        the visibility based on the condition value
      • visibleIfTrue

        public static CmsMenuItemVisibilityMode visibleIfTrue​(boolean condition)
        Returns VISIBILITY_ACTIVE if the given parameter is true, and VISIBILITY_INVISIBLE otherwise.

        Parameters:
        condition - a boolean value
        Returns:
        the visibility based on the condition value
      • getRoot

        public CmsResource getRoot()
        Gets the resource corresponding to the tree's root.

        Returns:
        the resource for the root node
      • initEventHandlers

        public void initEventHandlers​(CmsSitemapTreeNode node)
        Initializes the event handlers for a tree node widget.

        Parameters:
        node - the node for which to initialize the event handlers
      • onClickOpen

        public void onClickOpen​(CmsSitemapTreeNode node)
        Called when the user clicks on the 'opener' icon of a sitemap tree entry.

        Parameters:
        node - the sitemap node widget
      • updateNode

        public void updateNode​(CmsSitemapTreeNode node)
        Updates a sitemap node widget after the resource it corresponds to has changed.

        Parameters:
        node - the sitemap node
      • updateNodeForId

        public void updateNodeForId​(CmsUUID id)
        Updates the tree node for the resource with the given structure id, if it exists.

        Parameters:
        id - the structure id of a resource
      • readSitemapEntryFolderIfPossible

        protected CmsResource readSitemapEntryFolderIfPossible​(CmsResource resource)
        If the given resource is the default file of a sitmeap entry folder, then returns that folder, else the original file.

        Parameters:
        resource - a resource
        Returns:
        the resource or its parent folder