Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
class: GlyphPainter2 [javadoc | source]
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 JDK. It uses the java.awt.font.TextLayout class to do i18n capable rendering.

Field Summary
 TextLayout layout     
Constructor:
 public GlyphPainter2(TextLayout layout) 
Method from javax.swing.text.GlyphPainter2 Summary:
getAscent,   getBoundedPosition,   getDescent,   getHeight,   getNextVisualPositionFrom,   getPainter,   getSpan,   modelToView,   paint,   viewToModel
Methods from javax.swing.text.GlyphView$GlyphPainter:
getAscent,   getBoundedPosition,   getDescent,   getHeight,   getNextVisualPositionFrom,   getPainter,   getSpan,   modelToView,   paint,   viewToModel
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.GlyphPainter2 Detail:
 public float getAscent(GlyphView v) 
    Fetch the ascent above the baseline for the glyphs corresponding to the given range in the model.
 public 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. This could be used to break the given view. The result should be a location just shy of the given advance. This differs from viewToModel which returns the closest position which might be proud of the maximum advance.
 public float getDescent(GlyphView v) 
    Fetch the descent below the baseline for the glyphs corresponding to the given range in the model.
 public float getHeight(GlyphView v) 
 public int getNextVisualPositionFrom(GlyphView v,
    int pos,
    Bias b,
    Shape a,
    int direction,
    Bias[] biasRet) throws BadLocationException 
    Provides a way to determine the next visually represented model location that one might place a caret. Some views may not be visible, they might not be in the same order found in the model, or they just might not allow access to some of the locations in the model.
 public GlyphPainter getPainter(GlyphView v,
    int p0,
    int p1) 
    Create a painter to use for the given GlyphView.
 public float getSpan(GlyphView v,
    int p0,
    int p1,
    TabExpander e,
    float x) 
    Determine the span the glyphs given a start location (for tab expansion). This implementation assumes it has no tabs (i.e. TextLayout doesn't deal with tab expansion).
 public Shape modelToView(GlyphView v,
    int pos,
    Bias bias,
    Shape a) throws BadLocationException 
 public  void paint(GlyphView v,
    Graphics g,
    Shape a,
    int p0,
    int p1) 
    Paint the glyphs for the given view. This is implemented to only render if the Graphics is of type Graphics2D which is required by TextLayout (and this should be the case if running on the JDK).
 public int viewToModel(GlyphView v,
    float x,
    float y,
    Shape a,
    Bias[] biasReturn) 
    Provides a mapping from the view coordinate space to the logical coordinate space of the model.