net.sf.vex.layout
Class BlockPseudoElementBox

java.lang.Object
  |
  +--net.sf.vex.layout.AbstractBox
        |
        +--net.sf.vex.layout.BlockPseudoElementBox
All Implemented Interfaces:
BlockBox, Box

public class BlockPseudoElementBox
extends AbstractBox
implements BlockBox

Implements a Block


Constructor Summary
BlockPseudoElementBox(LayoutContext context, Element pseudoElement, int width)
           
 
Method Summary
 Box[] getChildren()
          Provide children for AbstractBox.paint(net.sf.vex.layout.LayoutContext, int, int).
 Element getElement()
          Returns the Element with which this box is associated, or null if there is no such box.
 LineBox getFirstLine()
          Returns the first LineBox contained by this block, or null if the block contains no lines.
 LineBox getLastLine()
          Returns the last LineBox contained by this block, or null if the block contains no lines.
 int getLineEndOffset(int offset)
          Returns the offset of the end of the line containing the given offset.
 int getLineStartOffset(int offset)
          Returns the offset of the start of the line containing the given offset.
 int getMarginBottom()
          Returns the bottom margin of this box.
 int getMarginTop()
          Returns the top margin of this box.
 int getNextLineOffset(LayoutContext context, int offset, int x)
          Returns the offset on the next line that is closest to the given x coordinate.
 int getPreviousLineOffset(LayoutContext context, int offset, int x)
          Returns the offset on the previous line that is closest to the given x coordinate.
 void layout(LayoutContext context, int width, boolean force)
          Layout this box.
 void paint(LayoutContext context, int x, int y)
          Draw boxes before painting our child.
 
Methods inherited from class net.sf.vex.layout.AbstractBox
containsOffset, getCaretShapes, getEndOffset, getHeight, getStartOffset, getWidth, getX, getY, hasContent, setHeight, setWidth, setX, setY, skipPaint, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.vex.layout.Box
containsOffset, getCaretShapes, getEndOffset, getHeight, getStartOffset, getWidth, getX, getY, hasContent, setX, setY, viewToModel
 

Constructor Detail

BlockPseudoElementBox

public BlockPseudoElementBox(LayoutContext context,
                             Element pseudoElement,
                             int width)
Method Detail

getChildren

public Box[] getChildren()
Provide children for AbstractBox.paint(net.sf.vex.layout.LayoutContext, int, int).

Specified by:
getChildren in interface Box
Overrides:
getChildren in class AbstractBox
See Also:
Box.getChildren()

getElement

public Element getElement()
Description copied from interface: Box
Returns the Element with which this box is associated, or null if there is no such box. The box may directly represent the Element, or simply use it for formatting information.

Specified by:
getElement in interface Box
Overrides:
getElement in class AbstractBox
See Also:
Box.getElement()

getFirstLine

public LineBox getFirstLine()
Description copied from interface: BlockBox
Returns the first LineBox contained by this block, or null if the block contains no lines.

Specified by:
getFirstLine in interface BlockBox
See Also:
BlockBox.getFirstLine()

getLastLine

public LineBox getLastLine()
Description copied from interface: BlockBox
Returns the last LineBox contained by this block, or null if the block contains no lines.

Specified by:
getLastLine in interface BlockBox
See Also:
BlockBox.getLastLine()

getLineEndOffset

public int getLineEndOffset(int offset)
Description copied from interface: BlockBox
Returns the offset of the end of the line containing the given offset.

Specified by:
getLineEndOffset in interface BlockBox
Parameters:
offset - offset identifying the current line.
See Also:
BlockBox.getLineEndOffset(int)

getLineStartOffset

public int getLineStartOffset(int offset)
Description copied from interface: BlockBox
Returns the offset of the start of the line containing the given offset.

Specified by:
getLineStartOffset in interface BlockBox
Parameters:
offset - offset identifying the current line.
See Also:
BlockBox.getLineStartOffset(int)

getMarginBottom

public int getMarginBottom()
Description copied from interface: BlockBox
Returns the bottom margin of this box. The actual bottom margin may be different than specified by the style sheet since it may be increased by a child box.

Specified by:
getMarginBottom in interface BlockBox
See Also:
BlockBox.getMarginBottom()

getMarginTop

public int getMarginTop()
Description copied from interface: BlockBox
Returns the top margin of this box. The actual top margin may be different than specified by the style sheet since it may be increased by a child box.

Specified by:
getMarginTop in interface BlockBox
See Also:
BlockBox.getMarginTop()

getNextLineOffset

public int getNextLineOffset(LayoutContext context,
                             int offset,
                             int x)
Description copied from interface: BlockBox
Returns the offset on the next line that is closest to the given x coordinate. The given offset may be before the start of this box in which case this method should return the offset of the first line in this box.

Specified by:
getNextLineOffset in interface BlockBox
Parameters:
context - LayoutContext used for the layout
offset - the current offset
x - the x coordinate
See Also:
BlockBox.getNextLineOffset(net.sf.vex.layout.LayoutContext, int, int)

getPreviousLineOffset

public int getPreviousLineOffset(LayoutContext context,
                                 int offset,
                                 int x)
Description copied from interface: BlockBox
Returns the offset on the previous line that is closest to the given x coordinate. The given offset may be after the end of this box in which case this method should return the offset of the last line in this box.

Specified by:
getPreviousLineOffset in interface BlockBox
Parameters:
context - LayoutContext used for the layout
offset - the current offset
x - the x coordinate
See Also:
BlockBox.getPreviousLineOffset(net.sf.vex.layout.LayoutContext, int, int)

layout

public void layout(LayoutContext context,
                   int width,
                   boolean force)
Description copied from interface: BlockBox
Layout this box. This method is responsible for the following.

Boxes with no children should simply calculate their width and height here

Specified by:
layout in interface BlockBox
Parameters:
context - The layout context to be used.
width - Width available for this box. This is typically ignored by inline-formatted boxes.
See Also:
BlockBox.layout(net.sf.vex.layout.LayoutContext, int, boolean)

paint

public void paint(LayoutContext context,
                  int x,
                  int y)
Draw boxes before painting our child.

Specified by:
paint in interface Box
Overrides:
paint in class AbstractBox
Parameters:
context - LayoutContext containing the Graphics object into which the box should be painted
x - the x-offset at which the box should be painted
y - the y-offset at which the box should be painted
See Also:
Box.paint(net.sf.vex.layout.LayoutContext, int, int)