Package com.microstrategy.web.blocks
Class Block
- java.lang.Object
 - 
- com.microstrategy.web.blocks.BlockTarget
 - 
- com.microstrategy.web.blocks.BlockListElement
 - 
- com.microstrategy.web.blocks.Block
 
 
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable
public class Block extends BlockListElement
This class represents a generic Block. A Block essentially consists of a set of PROPERTIES and a RENDERER. It also has a NAME which is used by the FACTORY. It is essentially a specialized DATA CONTAINER with a well-defined way to RENDER its contents through a generic RENDERER interface.- Since:
 - MicroStrategy Web 8.1.0
 - See Also:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class com.microstrategy.web.blocks.BlockListElement
BlockListElement.ListAction 
- 
Nested classes/interfaces inherited from class com.microstrategy.web.blocks.BlockTarget
BlockTarget.PathInfo 
 - 
 
- 
Field Summary
- 
Fields inherited from class com.microstrategy.web.blocks.BlockTarget
TARGETTYPE_BLOCK, TARGETTYPE_LIST, TARGETTYPE_PROPERTY 
 - 
 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(BlockVisitor visitor)Accept a BlockVisitor to this Block.voidaccept(BlockVisitor visitor, java.util.Comparator<BlockProperty> blockPropertyComparator)Accept a BlockVisitor to this Block.BlockPropertydefineProperty(java.lang.String name, java.lang.String type)Defines a new property for a Block.MarkupOutputgenerateMarkup(BlockContext blockContext)Generate the markup for this Block using the RENDERER instance (or fully qualified class name)..BlockPropertyAnnotationGroupsgetAnnotationGroups(boolean create)Returns the annotation groups associated with this Block.java.util.Iterator<java.lang.String>getBaseBlocks(boolean expand)Returns anIteratorof Block names: either just the directly specified base Blocks (expand == false) or all base Blocks (expand == true).java.lang.StringgetFileName()Returns the file name where the Block was read from.java.lang.StringgetName()Returns the name of this Block.BlockPropertygetOrCreateProperty(java.lang.String propName, java.lang.String propType)Returns a property whose name is 'propName'.BlockPropertygetProperty(java.lang.String name)Returns the Property with a given name.BlockPropertygetPropertyByIndex(int index)Returns the Property at a given numeric index.intgetPropertySize()Returns the number of properties in this Block.booleanhasAnnotationGroups()Returns whether there are any annotation groups associated with this Block.booleanpropertyExists(java.lang.String name)Returns true if a property with a specific name exists.voidput(java.lang.String propName, boolean propValue)Sets property value.voidput(java.lang.String propName, double propValue)Sets property value.voidput(java.lang.String propName, int propValue)Sets property value.voidput(java.lang.String propName, long propValue)Sets property value.voidput(java.lang.String propName, Block propValue)Sets property value.voidput(java.lang.String propName, BlockList propValue)Sets property value.voidput(java.lang.String propName, java.lang.String propValue)Sets property value.BlockputNewBlock(java.lang.String propName)BlockputNewBlock(java.lang.String propName, java.lang.String blockName)BlockListputNewList(java.lang.String propName)voidsetName(java.lang.String name)Sets the name of this Block.BlockPropertysetOrCreateProperty(java.lang.String propName, java.lang.String propType, java.lang.Object propValue)Sets a property (creating it, if necessary) to a specific value.java.lang.StringtoString()- 
Methods inherited from class com.microstrategy.web.blocks.BlockListElement
getListAction, getListElementKey, getListItem, setListAction, setListElementKey, setListItem, setListItem 
- 
Methods inherited from class com.microstrategy.web.blocks.BlockTarget
findProperties, getTargetType, resolvePath, resolvePath 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getName
public java.lang.String getName()
Returns the name of this Block.- Returns:
 - The name of this Block.
 
 
- 
setName
public void setName(java.lang.String name)
Sets the name of this Block.- Parameters:
 name- The name of this Block.
 
- 
getPropertySize
public int getPropertySize()
Returns the number of properties in this Block.- Returns:
 - The number of properties in this Block.
 
 
- 
defineProperty
public BlockProperty defineProperty(java.lang.String name, java.lang.String type) throws java.lang.Exception
Defines a new property for a Block.- Parameters:
 name- The name of the property.type- The type of the property.- Returns:
 - The newly created 
BlockProperty. - Throws:
 java.lang.Exception- If the property is already defined.- Since:
 - MicroStrategy Web 9.0.0
 
 
- 
propertyExists
public boolean propertyExists(java.lang.String name)
Returns true if a property with a specific name exists.- Parameters:
 name- The name of the property to check for.- Returns:
 - True, if the property exists; otherwise, false.
 
 
- 
getProperty
public BlockProperty getProperty(java.lang.String name)
Returns the Property with a given name.- Parameters:
 name- The name of the property to return.- Returns:
 - The 
BlockPropertyobject with the specified name, if it exists. If it does not exist, then returns null. 
 
- 
getOrCreateProperty
public BlockProperty getOrCreateProperty(java.lang.String propName, java.lang.String propType)
Returns a property whose name is 'propName'. If it does not exist, then create that property (whose type is 'propType').- Parameters:
 propName- The name of the property that you want to get (or create).propType- The type of the property (a value of one of the PROPTYPE_Xxx constants inBlockProperty).- Returns:
 - The 
BlockPropertythat you wanted to access. - Since:
 - MicroStrategy Web 9.0.0
 - See Also:
 getProperty(String),defineProperty(String, String)
 
- 
put
public void put(java.lang.String propName, int propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
put
public void put(java.lang.String propName, java.lang.String propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
put
public void put(java.lang.String propName, long propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
put
public void put(java.lang.String propName, double propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
put
public void put(java.lang.String propName, boolean propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
put
public void put(java.lang.String propName, Block propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
put
public void put(java.lang.String propName, BlockList propValue)Sets property value. If the property is not present then it will be created.- Parameters:
 propName- The property namepropValue- The property value
 
- 
putNewBlock
public Block putNewBlock(java.lang.String propName)
 
- 
putNewBlock
public Block putNewBlock(java.lang.String propName, java.lang.String blockName) throws java.lang.Exception
- Throws:
 java.lang.Exception
 
- 
putNewList
public BlockList putNewList(java.lang.String propName)
 
- 
setOrCreateProperty
public BlockProperty setOrCreateProperty(java.lang.String propName, java.lang.String propType, java.lang.Object propValue)
Sets a property (creating it, if necessary) to a specific value.- Parameters:
 propName- The name of the property to set.propType- The type of the property fromEnumBlockPropertyTypespropValue- The value of the property.- Returns:
 - The 
BlockPropertyobject that was set (or created). - Since:
 - MicroStrategy Web 9.0.0
 - See Also:
 defineProperty(String, String),getProperty(String)
 
- 
getPropertyByIndex
public BlockProperty getPropertyByIndex(int index)
Returns the Property at a given numeric index.- Parameters:
 index- The index of the Property to return (first index=0).- Returns:
 - The 
BlockPropertyobject at the specified index, if it exists. If it does not exist, then an IllegalArgumentException is thrown. - Throws:
 java.lang.IllegalArgumentException- If the index is out of range.
 
- 
generateMarkup
public MarkupOutput generateMarkup(BlockContext blockContext) throws java.lang.Exception
Generate the markup for this Block using the RENDERER instance (or fully qualified class name)..- Parameters:
 blockContext- TheBlockContextthat defines information about how Blocks are constructed, expanded and serialized.- Returns:
 - A 
MarkupOutputobject containing the markup generated for this Block. - Throws:
 java.lang.Exception- If we are unable to create an instance of the desired RENDERER or there is an exception in the process of generating the markup.- Since:
 - MicroStrategy Web 9.0.0
 
 
- 
getBaseBlocks
public java.util.Iterator<java.lang.String> getBaseBlocks(boolean expand)
Returns anIteratorof Block names: either just the directly specified base Blocks (expand == false) or all base Blocks (expand == true).- Parameters:
 expand- Whether or not to expand the list of Block names to all indirectly accessible Blocks or just the direct ones.- Returns:
 - An 
Iteratorof Block names. 
 
- 
getFileName
public java.lang.String getFileName()
Returns the file name where the Block was read from.- Returns:
 - The file name where the Block was read from.
 - Since:
 - MicroStrategy Web 9.0.0
 
 
- 
accept
public void accept(BlockVisitor visitor)
Accept a BlockVisitor to this Block. The visitor is notified in the following way:- First, at the start of the Block 
BlockVisitor.visitBlockStart(Block, BlockTarget) - If the return value of 
BlockVisitor.visitBlockStart(Block, BlockTarget)is true, then each of the BlockProperties are visited. - Finally, at the end of the Block 
BlockVisitor.visitBlockEnd(Block, BlockTarget). 
- Parameters:
 visitor- TheBlockVisitorinstance which will visit this Block.- Since:
 - MicroStrategy Web 9.0.0
 
 - First, at the start of the Block 
 
- 
accept
public void accept(BlockVisitor visitor, java.util.Comparator<BlockProperty> blockPropertyComparator)
Accept a BlockVisitor to this Block. The visitor is notified in the following way:- First, at the start of the Block 
BlockVisitor.visitBlockStart(Block, BlockTarget) - If the return value of 
BlockVisitor.visitBlockStart(Block, BlockTarget)is true, then each of the BlockProperties are visited. - Finally, at the end of the Block 
BlockVisitor.visitBlockEnd(Block, BlockTarget). - However, the order of the BlockProperty instances is defined by the supplied Comparator instance
 
- Parameters:
 visitor- TheBlockVisitorinstance which will visit this Block.blockPropertyComparator- TheXmlRendererANF.BlockPropertyComparatorinstance which will be used to compare the block property.- Since:
 - MicroStrategy Web 9.0.1
 
 - First, at the start of the Block 
 
- 
hasAnnotationGroups
public boolean hasAnnotationGroups()
Returns whether there are any annotation groups associated with this Block.- Returns:
 - Whether there are any annotation groups associated with this Block.
 
 
- 
getAnnotationGroups
public BlockPropertyAnnotationGroups getAnnotationGroups(boolean create)
Returns the annotation groups associated with this Block.- Parameters:
 create- If no annotation groups exists, this indicates whether a new set should be created.- Returns:
 - A 
BlockPropertyAnnotationGroupsobject (if it exists or the caller set 'create' to true); otherwise it is null. 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -