public Shape modelToView(int pos,Shape a,Position.Bias b) throws BadLocationException {
  Rectangle alloc=a.getBounds();
  RSyntaxTextArea textArea=(RSyntaxTextArea)getContainer();
  alloc.height=textArea.getLineHeight();
  alloc.width=1;
  int p0=getStartOffset();
  int p1=getEndOffset();
  int testP=(b == Position.Bias.Forward) ? pos : Math.max(p0,pos - 1);
  RSyntaxDocument doc=(RSyntaxDocument)getDocument();
  Element map=doc.getDefaultRootElement();
  int line=map.getElementIndex(p0);
  Token tokenList=doc.getTokenListForLine(line);
  float x0=alloc.x;
  while (p0 < p1) {
    x0=RSyntaxUtilities.makeTokenListStartAt(tokenList,p0,WrappedSyntaxView.this,textArea,x0);
    int p=calculateBreakPosition(p0,tokenList,x0);
    if ((pos >= p0) && (testP < p)) {
      alloc=RSyntaxUtilities.getLineWidthUpTo(textArea,s,p0,pos,WrappedSyntaxView.this,alloc,alloc.x);
      return alloc;
    }
    if (p == p1 - 1 && pos == p1 - 1) {
      if (pos > p0) {
        alloc=RSyntaxUtilities.getLineWidthUpTo(textArea,s,p0,pos,WrappedSyntaxView.this,alloc,alloc.x);
      }
      return alloc;
    }
    p0=(p == p0) ? p1 : p;
    alloc.y+=alloc.height;
  }
  throw new BadLocationException(null,pos);
}

public Shape modelToView ( int pos , Shape a , Position . Bias b ) throws BadLocationException { Rectangle alloc = a . getBounds ( ) ; RSyntaxTextArea textArea = ( RSyntaxTextArea ) getContainer ( ) ; alloc . height = textArea . getLineHeight ( ) ; alloc . width = 1 ; int p0 = getStartOffset ( ) ; int p1 = getEndOffset ( ) ; int testP = ( b == Position . Bias . Forward ) ? pos : Math . max ( p0 , pos - 1 ) ; RSyntaxDocument doc = ( RSyntaxDocument ) getDocument ( ) ; Element map = doc . getDefaultRootElement ( ) ; int line = map . getElementIndex ( p0 ) ; Token tokenList = doc . getTokenListForLine ( line ) ; float x0 = alloc . x ; while ( p0 < p1 ) { x0 = RSyntaxUtilities . makeTokenListStartAt ( tokenList , p0 , WrappedSyntaxView . this , textArea , x0 ) ; int p = calculateBreakPosition ( p0 , tokenList , x0 ) ; if ( ( pos >= p0 ) && ( testP < p ) ) { alloc = RSyntaxUtilities . getLineWidthUpTo ( textArea , s , p0 , pos , WrappedSyntaxView . this , alloc , alloc . x ) ; return alloc ; } if ( p == p1 - 1 && pos == p1 - 1 ) { if ( pos > p0 ) { alloc = RSyntaxUtilities . getLineWidthUpTo ( textArea , s , p0 , pos , WrappedSyntaxView . this , alloc , alloc . x ) ; } return alloc ; } p0 = ( p == p0 ) ? p1 : p ; alloc . y += alloc . height ; } throw new BadLocationException ( null , pos ) ; }
provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it .
