|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.vex.layout.AbstractBox | +--net.sf.vex.layout.ParagraphBox
A box that wraps inline content into a paragraph.
Method Summary | |
static ParagraphBox |
create(LayoutContext context,
Element element,
InlineBox[] inlines,
int width)
Create a paragraph by word-wrapping a list of inline boxes. |
static ParagraphBox |
create(LayoutContext context,
Element element,
java.util.List inlines,
int width)
Create a paragraph by word-wrapping a list of inline boxes. |
java.awt.Shape[] |
getCaretShapes(LayoutContext context,
int offset)
Returns shapes for the primary and secondary carets for the given offset. |
Box[] |
getChildren()
Returns an array of this box's children. |
Element |
getElement()
Returns the Element with which this box is associated, or null if there is no such box. |
int |
getEndOffset()
Returns the offset of the end of the content that the box covers. |
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. |
LineBox |
getLineAt(int offset)
Returns the LineBox at the given offset. |
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. |
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 |
layout(LayoutContext context,
int width,
boolean force)
Layout this box. |
java.lang.String |
toString()
|
int |
viewToModel(LayoutContext context,
int x,
int y)
Returns the offset in the content closest to the given view position. |
Methods inherited from class net.sf.vex.layout.AbstractBox |
containsOffset, getHeight, getWidth, getX, getY, paint, 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, paint, setX, setY |
Method Detail |
public static ParagraphBox create(LayoutContext context, Element element, java.util.List inlines, int width)
context
- LayoutContext used for this layout.element
- Element that controls the styling for this paragraph.inlines
- List of InlineBox objects to be wrappedwidth
- width to which the paragraph is to be wrapped
public static ParagraphBox create(LayoutContext context, Element element, InlineBox[] inlines, int width)
context
- LayoutContext used for this layoutelement
- Element that controls the styling of this paragraph,
in particular text alignment.inlines
- Array of InlineBox objects to be wrapped.width
- width to which the paragraph is to be wrapped.public java.awt.Shape[] getCaretShapes(LayoutContext context, int offset)
Box
getCaretShapes
in interface Box
getCaretShapes
in class AbstractBox
context
- LayoutContext to be usedoffset
- offset for which to retrieve the caret
Shape
objectspublic Box[] getChildren()
Box
getChildren
in interface Box
getChildren
in class AbstractBox
Box.getChildren()
public Element getElement()
Box
getElement
in interface Box
getElement
in class AbstractBox
Box.getElement()
public int getEndOffset()
Box
getEndOffset
in interface Box
getEndOffset
in class AbstractBox
Box.getEndOffset()
public LineBox getFirstLine()
BlockBox
getFirstLine
in interface BlockBox
BlockBox.getFirstLine()
public LineBox getLastLine()
BlockBox
getLastLine
in interface BlockBox
BlockBox.getLastLine()
public LineBox getLineAt(int offset)
offset
- the offset to check.public int getLineEndOffset(int offset)
BlockBox
getLineEndOffset
in interface BlockBox
offset
- offset identifying the current line.public int getLineStartOffset(int offset)
BlockBox
getLineStartOffset
in interface BlockBox
offset
- offset identifying the current line.public int getMarginBottom()
BlockBox
getMarginBottom
in interface BlockBox
BlockBox.getMarginBottom()
public int getMarginTop()
BlockBox
getMarginTop
in interface BlockBox
BlockBox.getMarginTop()
public int getNextLineOffset(LayoutContext context, int offset, int x)
BlockBox
getNextLineOffset
in interface BlockBox
context
- LayoutContext used for the layoutoffset
- the current offsetx
- the x coordinatepublic int getPreviousLineOffset(LayoutContext context, int offset, int x)
BlockBox
getPreviousLineOffset
in interface BlockBox
context
- LayoutContext used for the layoutoffset
- the current offsetx
- the x coordinatepublic int getStartOffset()
Box
getStartOffset
in interface Box
getStartOffset
in class AbstractBox
Box.getStartOffset()
public boolean hasContent()
Box
hasContent
in interface Box
hasContent
in class AbstractBox
Box.hasContent()
public void layout(LayoutContext context, int width, boolean force)
BlockBox
Boxes with no children should simply calculate their width and height here
layout
in interface BlockBox
context
- The layout context to be used.width
- Width available for this box. This is typically ignored
by inline-formatted boxes.public java.lang.String toString()
toString
in class java.lang.Object
public int viewToModel(LayoutContext context, int x, int y)
Box
viewToModel
in interface Box
viewToModel
in class AbstractBox
context
- LayoutContext
for this box treex
- x offset of the view position for which the model
offset is to be determined.y
- y offset of the view position for which the model
offset is to be determined.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |