protected fun drawView( g: java.awt.Graphics2D, r: java.awt.Rectangle, view: View, fontHeight: Int, y: Int )  { var y = y var x: Float = r.x.toFloat() val h: javax.swing.text.LayeredHighlighter = attr.host.getHighlighter() as javax.swing.text.LayeredHighlighter val document: RSyntaxDocument = com.sun.org.apache.xerces.internal.util.DOMUtil.getDocument() as RSyntaxDocument val map: Element = getElement() var p0: Int = view.getStartOffset() val lineNumber: Int = map.getElementIndex(p0) val p1: Int = view.getEndOffset() setSegment(p0, p1 - 1, document, drawSeg) val start: Int = p0 - drawSeg.offset var token: Token = document.getTokenListForLine(lineNumber)if (token != null && token.type === Token.NULL) { h.paintLayeredHighlights(g, p0, p1, r, attr.host, this) return } while (token != null && token.isPaintable()) { val p: Int = calculateBreakPosition(p0, token, x) x = r.x.toFloat() h.paintLayeredHighlights(g, p0, p, r, attr.host, this) while (token != null && token.isPaintable() && token.offset + token.textCount - 1 < p) { x = token.paint(g, x, y, attr.host, this) token = token.getNextToken() } if (token != null && token.isPaintable() && token.offset < p) { val tokenOffset: Int = token.offset var temp: Token? = DefaultToken( drawSeg, tokenOffset - start, p - 1 - start, tokenOffset, token.type ) temp.paint(g, x, y, attr.host, this) temp = null token.makeStartAt(p) } p0 = if (p == p0) p1 else p y += fontHeight } if (attr.host.getEOLMarkersVisible()) { g.setColor(attr.host.getForegroundForTokenType(Token.WHITESPACE)) g.setFont(attr.host.getFontForTokenType(Token.WHITESPACE)) g.drawString("¶", x, (y - fontHeight).toFloat()) } }
Draws a single view ( i.e. , a line of text for a wrapped view ) , wrapping the text onto multiple lines if necessary .