jetbrains.buildServer.web.functions
Class BlockStateUtil

java.lang.Object
  extended by jetbrains.buildServer.web.functions.BlockStateUtil

public abstract class BlockStateUtil
extends java.lang.Object

Author:
Maxim Podkolzine (maxim.podkolzine@jetbrains.com)

Constructor Summary
BlockStateUtil()
           
 
Method Summary
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.

displayBlockStyle

public static java.lang.String displayBlockStyle(javax.servlet.http.HttpServletRequest request,
                                                 java.lang.String blockType,
                                                 boolean collapsedByDefault)
Returns:
display:none; string if block should be hidden according to user settings
See Also:
isBlockHidden(javax.servlet.http.HttpServletRequest, String, boolean)

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 Also:
util:blockHiddenCss, util:blockId, BlockWithHandle, BlockWithHeader

blockId

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