|
||||||||||
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.PlaceholderBox
A zero-width box that represents a single offset in the document.
Nested Class Summary |
Nested classes inherited from class net.sf.vex.layout.InlineBox |
InlineBox.Pair |
Constructor Summary | |
PlaceholderBox(LayoutContext context,
Element element,
int relOffset)
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. |
java.awt.Shape[] |
getCaretShapes(LayoutContext context,
int offset)
Returns shapes for the primary and secondary carets for the given offset. |
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. |
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. |
InlineBox.Pair |
split(LayoutContext context,
int maxWidth,
boolean force)
Splits this inline box into two. |
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, getChildren, 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, getChildren, getHeight, getWidth, getX, getY, paint, setX, setY |
Constructor Detail |
public PlaceholderBox(LayoutContext context, Element element, int relOffset)
element
- Element containing this placeholder. the element is used
both to determine the size of the box and its caret, but also as a base
point for relOffset.Method Detail |
public boolean canBreakAtEnd()
InlineBox
canBreakAtEnd
in interface InlineBox
InlineBox.canBreakAtEnd()
public int getBaseline()
InlineBox
getBaseline
in interface InlineBox
InlineBox.getBaseline()
public InlineBox.Pair split(LayoutContext context, int maxWidth, boolean force)
InlineBox
force
is false, this
method should find a natural split point (e.g. after a space) and
return two boxes representing a split at that point. The width of the
last box must not exceed maxWidth
. If no such natural split
exists, null should be returned as the left box and this
returned as the right box.
If force
is true, it means we are adding the first inline
box to a line, therefore we must return something as the left box.
In some cases, we may find a suboptimal split (e.g. between characters)
that satisfies this. In other cases, this
should be returned
as the left box even though it exceeds maxWidth.
In both cases, the right box should contain null if this box fits
into maxWidth
split
in interface InlineBox
context
- the layout context to be used.maxWidth
- Maximum width of the left part of the box.force
- if true, force a suboptimal splitInlineBox.split(net.sf.vex.layout.LayoutContext, int, boolean)
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 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 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 java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
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.Box.viewToModel(net.sf.vex.layout.LayoutContext, int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |