public class

Block

extends BlockListElement
java.lang.Object
   ↳ com.microstrategy.web.blocks.BlockTarget
     ↳ com.microstrategy.web.blocks.BlockListElement
       ↳ com.microstrategy.web.blocks.Block

Class Overview

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.

Summary

[Expand]
Inherited Constants
From class com.microstrategy.web.blocks.BlockTarget
Public Methods
void accept(BlockVisitor visitor)
Accept a BlockVisitor to this Block.
void accept(BlockVisitor visitor, Comparator<BlockProperty> blockPropertyComparator)
Accept a BlockVisitor to this Block.
BlockProperty defineProperty(String name, String type)
Defines a new property for a Block.
MarkupOutput generateMarkup(BlockContext blockContext)
Generate the markup for this Block using the RENDERER instance (or fully qualified class name)..
BlockPropertyAnnotationGroups getAnnotationGroups(boolean create)
Returns the annotation groups associated with this Block.
Iterator<String> getBaseBlocks(boolean expand)
Returns an Iterator of Block names: either just the directly specified base Blocks (expand == false) or all base Blocks (expand == true).
String getFileName()
Returns the file name where the Block was read from.
String getName()
Returns the name of this Block.
BlockProperty getOrCreateProperty(String propName, String propType)
Returns a property whose name is 'propName'.
BlockProperty getProperty(String name)
Returns the Property with a given name.
BlockProperty getPropertyByIndex(int index)
Returns the Property at a given numeric index.
int getPropertySize()
Returns the number of properties in this Block.
boolean hasAnnotationGroups()
Returns whether there are any annotation groups associated with this Block.
boolean propertyExists(String name)
Returns true if a property with a specific name exists.
void put(String propName, int propValue)
Sets property value.
void put(String propName, long propValue)
Sets property value.
void put(String propName, boolean propValue)
Sets property value.
void put(String propName, String propValue)
Sets property value.
void put(String propName, BlockList propValue)
Sets property value.
void put(String propName, Block propValue)
Sets property value.
void put(String propName, double propValue)
Sets property value.
Block putNewBlock(String propName)
Block putNewBlock(String propName, String blockName)
BlockList putNewList(String propName)
void setName(String name)
Sets the name of this Block.
BlockProperty setOrCreateProperty(String propName, String propType, Object propValue)
Sets a property (creating it, if necessary) to a specific value.
String toString()
[Expand]
Inherited Methods
From class com.microstrategy.web.blocks.BlockListElement
From class com.microstrategy.web.blocks.BlockTarget
From class java.lang.Object

Public Methods

public void accept (BlockVisitor visitor)

Accept a BlockVisitor to this Block. The visitor is notified in the following way:

  1. First, at the start of the Block visitBlockStart(Block, BlockTarget)
  2. If the return value of visitBlockStart(Block, BlockTarget) is true, then each of the BlockProperties are visited.
  3. Finally, at the end of the Block visitBlockEnd(Block, BlockTarget).

Parameters
visitor The BlockVisitor instance which will visit this Block.

public void accept (BlockVisitor visitor, Comparator<BlockProperty> blockPropertyComparator)

Accept a BlockVisitor to this Block. The visitor is notified in the following way:

  1. First, at the start of the Block visitBlockStart(Block, BlockTarget)
  2. If the return value of visitBlockStart(Block, BlockTarget) is true, then each of the BlockProperties are visited.
  3. Finally, at the end of the Block visitBlockEnd(Block, BlockTarget).
  4. However, the order of the BlockProperty instances is defined by the supplied Comparator instance

Parameters
visitor The BlockVisitor instance which will visit this Block.
blockPropertyComparator The XmlRendererANF.BlockPropertyComparator instance which will be used to compare the block property.

public BlockProperty defineProperty (String name, String type)

Defines a new property for a Block.

Parameters
name The name of the property.
type The type of the property.
Returns
Throws
Exception If the property is already defined.

public MarkupOutput generateMarkup (BlockContext blockContext)

Generate the markup for this Block using the RENDERER instance (or fully qualified class name)..

Parameters
blockContext The BlockContext that defines information about how Blocks are constructed, expanded and serialized.
Returns
  • A MarkupOutput object containing the markup generated for this Block.
Throws
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.

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

public Iterator<String> getBaseBlocks (boolean expand)

Returns an Iterator of 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 Iterator of Block names.

public String getFileName ()

Returns the file name where the Block was read from.

Returns
  • The file name where the Block was read from.

public String getName ()

Returns the name of this Block.

Returns
  • The name of this Block.

public BlockProperty getOrCreateProperty (String propName, 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 in BlockProperty).
Returns

public BlockProperty getProperty (String name)

Returns the Property with a given name.

Parameters
name The name of the property to return.
Returns
  • The BlockProperty object with the specified name, if it exists. If it does not exist, then returns null.

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 BlockProperty object at the specified index, if it exists. If it does not exist, then an IllegalArgumentException is thrown.
Throws
IllegalArgumentException If the index is out of range.

public int getPropertySize ()

Returns the number of properties in this Block.

Returns
  • The number of properties in this Block.

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.

public boolean propertyExists (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.

public void put (String propName, int propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public void put (String propName, long propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public void put (String propName, boolean propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public void put (String propName, String propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public void put (String propName, BlockList propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public void put (String propName, Block propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public void put (String propName, double propValue)

Sets property value. If the property is not present then it will be created.

Parameters
propName The property name
propValue The property value

public Block putNewBlock (String propName)

public Block putNewBlock (String propName, String blockName)

Throws
Exception

public BlockList putNewList (String propName)

public void setName (String name)

Sets the name of this Block.

Parameters
name The name of this Block.

public BlockProperty setOrCreateProperty (String propName, String propType, 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 from EnumBlockPropertyTypes
propValue The value of the property.
Returns

public String toString ()