Class BlockStateUtil


  • public abstract class BlockStateUtil
    extends java.lang.Object
    Author:
    Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
    • Constructor Summary

      Constructors 
      Constructor Description
      BlockStateUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String blockId​(java.lang.String text)
      Generate block ID from some text content
      static java.lang.String displayBlockStyle​(javax.servlet.http.HttpServletRequest request, java.lang.String blockType, boolean collapsedByDefault)  
      static java.lang.String getBlockState​(javax.servlet.http.HttpServletRequest request, java.lang.String blockType)  
      static java.lang.String getBlockStyleJavascript​(javax.servlet.http.HttpServletRequest request, java.lang.String blockType, boolean wrapInScriptTag)
      Restores current state of the blocks for particular blocksType (or for a single block, if blockType = blockId) State is put to BS.Blocks._saved variable.
      static boolean isBlockHidden​(javax.servlet.http.HttpServletRequest request, java.lang.String blockType, boolean collapsedByDefault)  
      static void setBlockState​(javax.servlet.http.HttpServletRequest request, java.lang.String blockType, java.lang.String blockState)
      Set block state for block blockType to string blockState for current user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BlockStateUtil

        public BlockStateUtil()
    • Method Detail

      • setBlockState

        public static void setBlockState​(javax.servlet.http.HttpServletRequest request,
                                         java.lang.String blockType,
                                         java.lang.String blockState)
        Set block state for block blockType to string blockState for current user. If there is no current user, the state is saved to cookie
      • getBlockState

        public static java.lang.String getBlockState​(javax.servlet.http.HttpServletRequest request,
                                                     java.lang.String blockType)
        Returns:
        block state for block blockType for current user. If there is no current user, the state is read from cookie
      • isBlockHidden

        public static boolean isBlockHidden​(javax.servlet.http.HttpServletRequest request,
                                            java.lang.String blockType,
                                            boolean collapsedByDefault)
        Returns:
        true if 1) block should be collapsed by default and it's state wasn't changed by user or 2) block should be expanded by default and its state was changed by user.
      • getBlockStyleJavascript

        public static java.lang.String getBlockStyleJavascript​(javax.servlet.http.HttpServletRequest request,
                                                               java.lang.String blockType,
                                                               boolean wrapInScriptTag)
        Restores current state of the blocks for particular blocksType (or for a single block, if blockType = blockId) State is put to BS.Blocks._saved variable. It is supposed that corresponding BS.Blocks.restoreSavedBlocks() method is called after this method, to fix actual block state. see util:blockHiddenCss (util-functions.tld) see util:blockId (util-functions.tld) see BlockWithHandle, BlockWithHeader (util-functions.tld)
      • blockId

        public static java.lang.String blockId​(java.lang.String text)
        Generate block ID from some text content