|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.text.GlyphView.GlyphPainter | +--javax.swing.text.GlyphPainter2
A class to perform rendering of the glyphs. This can be implemented to be stateless, or to hold some information as a cache to facilitate faster rendering and model/view translation. At a minimum, the GlyphPainter allows a View implementation to perform its duties independent of a particular version of JVM and selection of capabilities (i.e. shaping for i18n, etc).
This implementation is intended for operation under the Java 2 SDK. It uses the java.awt.font.TextLayout class to do i18n capable rendering.
GlyphView
Field Summary | |
(package private) java.awt.font.TextLayout |
layout
|
Constructor Summary | |
GlyphPainter2(java.awt.font.TextLayout layout)
|
Method Summary | |
float |
getAscent(GlyphView v)
Fetch the ascent above the baseline for the glyphs corresponding to the given range in the model. |
int |
getBoundedPosition(GlyphView v,
int p0,
float x,
float len)
Determines the model location that represents the maximum advance that fits within the given span. |
float |
getDescent(GlyphView v)
Fetch the descent below the baseline for the glyphs corresponding to the given range in the model. |
float |
getHeight(GlyphView v)
|
int |
getNextVisualPositionFrom(GlyphView v,
int pos,
javax.swing.text.Position.Bias b,
Shape a,
int direction,
javax.swing.text.Position.Bias[] biasRet)
Provides a way to determine the next visually represented model location that one might place a caret. |
javax.swing.text.GlyphView.GlyphPainter |
getPainter(GlyphView v,
int p0,
int p1)
Create a painter to use for the given GlyphView. |
float |
getSpan(GlyphView v,
int p0,
int p1,
TabExpander e,
float x)
Determine the span the glyphs given a start location (for tab expansion). |
Shape |
modelToView(GlyphView v,
int pos,
javax.swing.text.Position.Bias bias,
Shape a)
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
void |
paint(GlyphView v,
Graphics g,
Shape a,
int p0,
int p1)
Paint the glyphs for the given view. |
int |
viewToModel(GlyphView v,
float x,
float y,
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
java.awt.font.TextLayout layout
Constructor Detail |
public GlyphPainter2(java.awt.font.TextLayout layout)
Method Detail |
public javax.swing.text.GlyphView.GlyphPainter getPainter(GlyphView v, int p0, int p1)
getPainter
in class javax.swing.text.GlyphView.GlyphPainter
public float getSpan(GlyphView v, int p0, int p1, TabExpander e, float x)
getSpan
in class javax.swing.text.GlyphView.GlyphPainter
public float getHeight(GlyphView v)
getHeight
in class javax.swing.text.GlyphView.GlyphPainter
public float getAscent(GlyphView v)
getAscent
in class javax.swing.text.GlyphView.GlyphPainter
public float getDescent(GlyphView v)
getDescent
in class javax.swing.text.GlyphView.GlyphPainter
public void paint(GlyphView v, Graphics g, Shape a, int p0, int p1)
paint
in class javax.swing.text.GlyphView.GlyphPainter
public Shape modelToView(GlyphView v, int pos, javax.swing.text.Position.Bias bias, Shape a) throws BadLocationException
javax.swing.text.GlyphView.GlyphPainter
modelToView
in class javax.swing.text.GlyphView.GlyphPainter
pos
- the position to converta
- the allocated region to render into
BadLocationException
View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)
public int viewToModel(GlyphView v, float x, float y, Shape a, javax.swing.text.Position.Bias[] biasReturn)
viewToModel
in class javax.swing.text.GlyphView.GlyphPainter
v
- the view containing the view coordinatesx
- the X coordinatey
- the Y coordinatea
- the allocated region to render intobiasReturn
- either Position.Bias.Forward
or Position.Bias.Backward
is returned as the
zero-th element of this array
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public int getBoundedPosition(GlyphView v, int p0, float x, float len)
getBoundedPosition
in class javax.swing.text.GlyphView.GlyphPainter
v
- the view to find the model location to break at.p0
- the location in the model where the
fragment should start it's representation >= 0.len
- specifies the distance into the view
where a potential break is desired >= 0.
View.breakView(int, int, float, float)
public int getNextVisualPositionFrom(GlyphView v, int pos, javax.swing.text.Position.Bias b, Shape a, int direction, javax.swing.text.Position.Bias[] biasRet) throws BadLocationException
getNextVisualPositionFrom
in class javax.swing.text.GlyphView.GlyphPainter
v
- the view to usepos
- the position to convert >= 0a
- the allocated region to render intodirection
- the direction from the current position that can
be thought of as the arrow keys typically found on a keyboard.
This may be SwingConstants.WEST, SwingConstants.EAST,
SwingConstants.NORTH, or SwingConstants.SOUTH.
BadLocationException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |