net.sf.vex.layout
Class StaticTextBox

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

public class StaticTextBox
extends TextBox

A TextBox representing a static string.


Nested Class Summary
 
Nested classes inherited from class net.sf.vex.layout.InlineBox
InlineBox.Pair
 
Constructor Summary
StaticTextBox(LayoutContext context, Element element, java.lang.String text)
          Class constructor.
 
Method Summary
 java.lang.String getText()
          Return the text that comprises this text box.
 boolean hasContent()
          Returns true if this box represents a portion of the XML document's content.
 InlineBox.Pair splitAt(LayoutContext context, int offset)
          Return a pair of boxes representing a split at the given offset.
 
Methods inherited from class net.sf.vex.layout.TextBox
calculateSize, canBreakAtEnd, getBaseline, getCaretShapes, getElement, isSplitChar, paint, split, toString
 
Methods inherited from class net.sf.vex.layout.AbstractBox
containsOffset, getChildren, getEndOffset, getHeight, getStartOffset, getWidth, getX, getY, setHeight, setWidth, setX, setY, skipPaint, viewToModel
 
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, getChildren, getEndOffset, getHeight, getStartOffset, getWidth, getX, getY, setX, setY, viewToModel
 

Constructor Detail

StaticTextBox

public StaticTextBox(LayoutContext context,
                     Element element,
                     java.lang.String text)
Class constructor.

Parameters:
context - LayoutContext used to calculate the box's size.
element - Element used to style the text.
text - Static text to display
Method Detail

getText

public java.lang.String getText()
Description copied from class: TextBox
Return the text that comprises this text box. The actual text can come from the document content or from a static string.

Specified by:
getText in class TextBox
See Also:
TextBox.getText()

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()

splitAt

public InlineBox.Pair splitAt(LayoutContext context,
                              int offset)
Description copied from class: TextBox
Return a pair of boxes representing a split at the given offset. If split is zero, then the returned left box should be null. If the split is equal to the length of the text, then the right box should be null.

Specified by:
splitAt in class TextBox
Parameters:
context - LayoutContext used to calculate the sizes of the resulting boxes.
offset - location of the split, relative to the start of the text box.
Returns:
See Also:
net.sf.vex.layout.TextBox#splitAt(int)