|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.vex.layout.AbstractBox
Base implementation of the Box
interface, implementing
some common methods.
Constructor Summary | |
AbstractBox()
Class constructor. |
Method Summary | |
boolean |
containsOffset(int offset)
Returns true if the given offset is between startOffset and endOffset, inclusive. |
java.awt.Shape[] |
getCaretShapes(LayoutContext context,
int offset)
Throws IllegalStateException . |
Box[] |
getChildren()
Returns an empty array of children. |
Element |
getElement()
Throws IllegalStateException . |
int |
getEndOffset()
Throws IllegalStateException . |
int |
getHeight()
Returns the height set with setHeight . |
int |
getStartOffset()
Throws IllegalStateException . |
int |
getWidth()
Returns the width set with setWidth . |
int |
getX()
Returns the value set with setX . |
int |
getY()
Returns the value set with setY . |
boolean |
hasContent()
Returns false. |
void |
paint(LayoutContext context,
int x,
int y)
Paint all children of this box. |
protected void |
setHeight(int height)
Sets the height of this box. |
protected void |
setWidth(int width)
Sets the width of this box. |
void |
setX(int x)
Sets the x-coordinate of the top-left corner of the box. |
void |
setY(int y)
Sets the y-coordinate of the top-left corner of the box. |
protected boolean |
skipPaint(LayoutContext context,
int x,
int y)
Returns true if this box is outside the clip region. |
int |
viewToModel(LayoutContext context,
int x,
int y)
Throws IllegalStateException . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractBox()
Method Detail |
public boolean containsOffset(int offset)
containsOffset
in interface Box
offset
- the offset to testBox.containsOffset(int)
public java.awt.Shape[] getCaretShapes(LayoutContext context, int offset)
IllegalStateException
. Boxes with content must
provide an implementation of this method.
getCaretShapes
in interface Box
context
- LayoutContext to be usedoffset
- offset for which to retrieve the caret
Shape
objectsBox.getCaretShapes(net.sf.vex.layout.LayoutContext, int)
public Box[] getChildren()
getChildren
in interface Box
Box.getChildren()
public Element getElement()
IllegalStateException
. Boxes associated with
elements must provide an implementation of this method.
getElement
in interface Box
Box.getElement()
public int getEndOffset()
IllegalStateException
. Boxes with content must
provide an implementation of this method.
getEndOffset
in interface Box
Box.getEndOffset()
public int getHeight()
setHeight
.
getHeight
in interface Box
Box.getHeight()
public int getStartOffset()
IllegalStateException
. Boxes with content must
provide an implementation of this method.
getStartOffset
in interface Box
Box.getStartOffset()
public boolean hasContent()
Box.getCaretShapes(net.sf.vex.layout.LayoutContext, int)
Box.getStartOffset()
Box.getEndOffset()
Box.viewToModel(net.sf.vex.layout.LayoutContext, int, int)
hasContent
in interface Box
Box.hasContent()
public int getWidth()
setWidth
.
getWidth
in interface Box
Box.getWidth()
public int getX()
setX
.
getX
in interface Box
Box.getX()
public int getY()
setY
.
getY
in interface Box
Box.getY()
public void paint(LayoutContext context, int x, int y)
paint
in interface Box
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 paintedBox.paint(net.sf.vex.layout.LayoutContext, int, int)
protected void setHeight(int height)
height
- new height of the boxprotected void setWidth(int width)
width
- new width of the boxpublic void setX(int x)
setX
in interface Box
x
- the new x-coordinatepublic void setY(int y)
setY
in interface Box
y
- the new y-coordinateprotected boolean skipPaint(LayoutContext context, int x, int y)
paint
should use this
to avoid unnecessary painting.
context
- LayoutContext
in effect.x
- the x-coordinate at which the box is being paintedy
- the y-coordinate at which the box is being paintedpublic int viewToModel(LayoutContext context, int x, int y)
IllegalStateException
. Boxes with content must
provide an implementation of this method.
viewToModel
in interface Box
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 |