|
||||||||||
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.BlockElementBox
A block box corresponding to a DOM Element. Block boxes lay their
children out stacked top to bottom. Block boxes correspond to the
display: block;
CSS property.
Constructor Summary | |
BlockElementBox(BlockElementBox parent,
Element element)
Class constructor. |
Method Summary | |
BlockBox[] |
getBlockChildren()
Returns this box's children. |
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. |
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 effective bottom margin. |
int |
getMarginTop()
Returns the effective top margin. |
int |
getNextLineOffset(LayoutContext context,
int offset,
int x)
Returns the offset on the next line that is closest to the given x coordinate. |
BlockElementBox |
getParent()
|
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 |
invalidate(boolean direct)
|
void |
layout(LayoutContext context,
int width,
boolean force)
Layout this box. |
void |
paint(LayoutContext context,
int x,
int y)
Draws the box's content in the given Graphics context. |
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, 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 |
public BlockElementBox(BlockElementBox parent, Element element)
parent
- This box's parent box.element
- Element to which this box corresponds.Method Detail |
public BlockBox[] getBlockChildren()
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
objectsBox.getCaretShapes(net.sf.vex.layout.LayoutContext, int)
public 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
net.sf.vex.layout.ElementBox#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 int getLineEndOffset(int offset)
BlockBox
getLineEndOffset
in interface BlockBox
offset
- offset identifying the current line.BlockBox.getLineEndOffset(int)
public int getLineStartOffset(int offset)
BlockBox
getLineStartOffset
in interface BlockBox
offset
- offset identifying the current line.public int getMarginBottom()
getMarginBottom
in interface BlockBox
public int getMarginTop()
getMarginTop
in interface BlockBox
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 BlockElementBox getParent()
public 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 invalidate(boolean direct)
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 void paint(LayoutContext context, int x, int y)
Box
paint
in interface Box
paint
in class AbstractBox
context
- LayoutContext
containing the
Graphics
object into which the box should be
paintedx
- the x-offset at which the box should be paintedy
- the y-offset at which the box should be paintedpublic 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 |