|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.inet.html.views.ContentPainter
public class ContentPainter
This class is similar to the JRE GlyphView.GlyphPainter
. But since HTML does not support tabs and has
no predefined Break length, these parts of the functions are removed.
Constructor Summary | |
---|---|
ContentPainter(ContentView view)
Creates the painter |
Method Summary | |
---|---|
ContentPainter |
copy(ContentView target)
Returns a copy of this painter |
int |
getAscent()
Fetches the ascent above the baseline. |
float[] |
getCharOffsets()
Returns the char offsets buffer of this painter. |
int |
getDescent()
Fetches the descent below the baseline. |
int |
getHeight()
Fetches the height of the font in PX |
float |
getSpan()
Determines the span the glyphs given a start location (for tab expansion). |
boolean |
isCharOffsetsSet()
If this returns true, the char offsets were set. |
boolean |
isReversed()
Returns true if this painter paints an RTL content |
java.awt.Shape |
modelToView(int pos,
javax.swing.text.Position.Bias bias,
java.awt.Shape a)
Returns the display shape for a model position |
void |
paint(java.awt.Graphics g,
java.awt.Shape a,
int start,
int length,
int baseline)
Paints the glyphs representing the given range. |
void |
reset()
Causes this painter to recalculate on the next run; |
void |
setCharOffsets(float[] charOffsets)
Sets the char offset buffer of this painter |
void |
setReversed()
Marks this painter als RTL. |
void |
setView(ContentView view)
Sets the view this painter is bound to |
void |
sync()
This method has to be called whenever there are changes to the render environment of the painted view. |
int |
viewToModel(float x,
float y,
java.awt.Shape a,
javax.swing.text.Position.Bias[] biasReturn)
Provides a mapping from the view coordinate space to the logical coordinate space of the model. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContentPainter(ContentView view)
view
- the view, whose content will be painted by this painter, can be nullMethod Detail |
---|
public void setView(ContentView view)
view
- the view, whose content will be painted by this painterpublic float getSpan()
public int getAscent()
public int getDescent()
public int getHeight()
public void paint(java.awt.Graphics g, java.awt.Shape a, int start, int length, int baseline)
g
- the graphics to paint toa
- the allocation to paint tostart
- the start index within the text of the viewlength
- the end index within the text of the viewbaseline
- the offset from the top of the shape to the baseline of the current linepublic java.awt.Shape modelToView(int pos, javax.swing.text.Position.Bias bias, java.awt.Shape a) throws javax.swing.text.BadLocationException
pos
- the model positionbias
- forward or backward search biasa
- the shape of the parent view
javax.swing.text.BadLocationException
- thrown on location errorspublic int viewToModel(float x, float y, java.awt.Shape a, javax.swing.text.Position.Bias[] biasReturn)
x
- the X coordinatey
- the Y coordinatea
- the allocated region to render intobiasReturn
- always returns Position.Bias.Forward
as the zero-th element of this array
public void sync()
public float[] getCharOffsets()
public void setCharOffsets(float[] charOffsets)
charOffsets
- the char offset buffer of this painterpublic boolean isCharOffsetsSet()
public ContentPainter copy(ContentView target)
target
- the view to bind to
public void setReversed()
public boolean isReversed()
public void reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |