net.sf.vex.layout
Class InlineElementBox

java.lang.Object
  |
  +--net.sf.vex.layout.AbstractBox
        |
        +--net.sf.vex.layout.CompositeInlineBox
              |
              +--net.sf.vex.layout.InlineElementBox
All Implemented Interfaces:
Box, InlineBox

public class InlineElementBox
extends CompositeInlineBox

An inline box that represents an inline element. This box is responsible for creating and laying out its child boxes.


Nested Class Summary
 
Nested classes inherited from class net.sf.vex.layout.InlineBox
InlineBox.Pair
 
Constructor Summary
InlineElementBox(LayoutContext context, Element element)
          Class constructor.
 
Method Summary
 boolean canBreakAtEnd()
          Returns true if a line break can occur after this box.
 int getBaseline()
          Returns the distance from the top of the inline box to the baseline.
 Box[] getChildren()
          Returns an array of this box's children.
 Element getElement()
          Returns the element associated with this box.
 int getEndOffset()
          Returns the offset of the end of the content that the box covers.
 int getStartOffset()
          Returns the offset of the start of the content that the box covers.
 boolean hasContent()
          Returns true if this box represents a portion of the XML document's content.
 void paint(LayoutContext context, int x, int y)
          Override to paint background and borders.
 InlineBox.Pair split(LayoutContext context, InlineBox[] lefts, InlineBox[] rights)
          Creates a Pair of InlineBoxes, each with its own set of children.
 java.lang.String toString()
           
 
Methods inherited from class net.sf.vex.layout.CompositeInlineBox
getCaretShapes, split, viewToModel
 
Methods inherited from class net.sf.vex.layout.AbstractBox
containsOffset, getHeight, getWidth, getX, getY, setHeight, setWidth, setX, setY, skipPaint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.vex.layout.Box
containsOffset, getHeight, getWidth, getX, getY, setX, setY
 

Constructor Detail

InlineElementBox

public InlineElementBox(LayoutContext context,
                        Element element)
Class constructor.

Parameters:
context - LayoutContext used for this layout
element - Element to which this box corresponds.
Method Detail

canBreakAtEnd

public boolean canBreakAtEnd()
Description copied from interface: InlineBox
Returns true if a line break can occur after this box. For example, this would be true for text boxes that end with a space.

See Also:
InlineBox.canBreakAtEnd()

getBaseline

public int getBaseline()
Description copied from interface: InlineBox
Returns the distance from the top of the inline box to the baseline.

See Also:
InlineBox.getBaseline()

getChildren

public Box[] getChildren()
Description copied from interface: Box
Returns an array of this box's children.

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

getElement

public Element getElement()
Returns the element associated with this box.

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

getEndOffset

public int getEndOffset()
Description copied from interface: Box
Returns the offset of the end of the content that the box covers.

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

getStartOffset

public int getStartOffset()
Description copied from interface: Box
Returns the offset of the start of the content that the box covers.

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

hasContent

public boolean hasContent()
Description copied from interface: Box
Returns true if this box represents a portion of the XML document's content. If false is returned, the following methods are not supported by this box.

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

paint

public void paint(LayoutContext context,
                  int x,
                  int y)
Override to paint background and borders.

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:
AbstractBox.paint(net.sf.vex.layout.LayoutContext, int, int)

split

public InlineBox.Pair split(LayoutContext context,
                            InlineBox[] lefts,
                            InlineBox[] rights)
Description copied from class: CompositeInlineBox
Creates a Pair of InlineBoxes, each with its own set of children.

Specified by:
split in class CompositeInlineBox
Parameters:
context - LayoutContext used for this layout.
lefts - Child boxes to be given to the left box.
rights - Child boxes to be given to the right box.
Returns:
See Also:
CompositeInlineBox.split(net.sf.vex.layout.LayoutContext, net.sf.vex.layout.InlineBox[], net.sf.vex.layout.InlineBox[])

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object