com.snowtide.pdf.layout
Interface Block

All Superinterfaces:
BlockParent, Region
All Known Subinterfaces:
Table

public interface Block
extends Region, BlockParent

Instances of this class represent groupings of text at a specific position on a Page. Blocks can contain Lines and/or other Blocks (via the BlockParent implementation). The current implementation generally will not allow a Block to contain Blocks and Lines.

Version:
©2004-2012 Snowtide Informatics Systems, Inc.

Method Summary
 Block crop(Region area)
          Returns a Block instance that contains only the content held by this Block instance that intersects the given "query" area.
 Line getLine(int idx)
          Returns the Line at the given index.
 int getLineCnt()
          Returns the number of Lines held by this Block.
 java.util.List getLines()
          Returns a List view of the Lines held by this Block.
 void pipe(OutputHandler tgt)
          Sends all text events associated with this Block to the given OutputHandler.
 Line removeLine(int idx)
          Removes the Line at the given index from this Block, and returns it.
 
Methods inherited from interface com.snowtide.pdf.layout.Region
area, endxpos, endypos, height, width, xpos, ypos
 
Methods inherited from interface com.snowtide.pdf.layout.BlockParent
addChild, getChild, getChildCnt, removeAllChildren, removeChild, sortChildren
 

Method Detail

getLines

java.util.List getLines()
Returns a List view of the Lines held by this Block. The returned List is guaranteed to offer efficient random access.

Since:
v1.4

getLine

Line getLine(int idx)
Returns the Line at the given index.

Since:
v1.4

getLineCnt

int getLineCnt()
Returns the number of Lines held by this Block.

Since:
v1.4

removeLine

Line removeLine(int idx)

Removes the Line at the given index from this Block, and returns it.

Note that a block does not update its regional bounds after a line is removed. Doing so would result in poor performance for applications that frequently executed this function. A updateBounds() function might be provided in the future for applications that remove Lines from Blocks and also wish to have the Blocks update their bounds.

Since:
v1.4

pipe

void pipe(OutputHandler tgt)
          throws java.io.IOException
Sends all text events associated with this Block to the given OutputHandler.

Parameters:
tgt - - the destination for all contents of this block
Throws:
java.io.IOException

crop

Block crop(Region area)
Returns a Block instance that contains only the content held by this Block instance that intersects the given "query" area. If all of the content held by this instance is intersected by the query area, then this instance may be returned unchanged. If no content in this Block intersects the query area, then an empty Block instance will be returned.