/** * Returns the bounds of the area covered by this node's primitive paint. */ public Rectangle2D getPrimitiveBounds(){ if (primitiveBounds == null) { if (aci != null) { primitiveBounds = textPainter.getBounds2D(this); } } return primitiveBounds; }
/** * Get the geometry bounds. * This uses the StrokingTextPainter to get the bounds * since in theory it should be the same. * * @param node the text node * @return the bounds of the text */ public Rectangle2D getGeometryBounds(TextNode node) { return proxyTextPainter.getGeometryBounds(node); }
/** * Returns the outline of this node. */ public Shape getOutline() { if (outline == null) { if (aci != null) { outline = textPainter.getOutline(this); } } return outline; }
/** * Selects all the text in this TextNode. The coordinates are ignored. * @param x the x coordinate of the point the selection was made * @param y the y coordinate of the point the selection was made */ public boolean selectAll(double x, double y) { beginMark = textPainter.selectFirst(this); endMark = textPainter.selectLast(this); return true; // assume this always changes selection, for now. }
/** * Paints this node without applying Filter, Mask, Composite, and clip. * * @param g2d the Graphics2D to use */ public void primitivePaint(Graphics2D g2d) { // // DO NOT REMOVE: THE FOLLOWING IS A WORK AROUND // A BUG IN THE JDK 1.2 RENDERING PIPELINE WHEN // THE CLIP IS A RECTANGLE // Shape clip = g2d.getClip(); if (clip != null && !(clip instanceof GeneralPath)) { g2d.setClip(new GeneralPath(clip)); } // Paint the text textPainter.paint(this, g2d); }
/** * Initializes the current selection to begin with the character at (x, y). * @param x the x coordinate of the start of the selection * @param y the y coordinate of the start of the selection */ public boolean selectAt(double x, double y) { beginMark = textPainter.selectAt(x, y, this); return true; // assume this always changes selection, for now. }
/** * Return the marker for the character at index in this nodes * AttributedCharacterIterator. Before Char indicates if the * Marker should be considered before or after char. */ public Mark getMarkerForChar(int index, boolean beforeChar) { return textPainter.getMark(this, index, beforeChar); }
/** * Returns the shape used to outline this text node. * * @return a Shape which encloses the current text selection. */ public Shape getHighlightShape() { Shape highlightShape = textPainter.getHighlightShape(beginMark, endMark); AffineTransform t = getGlobalTransform(); highlightShape = t.createTransformedShape(highlightShape); return highlightShape; }
/** * Gets the current text selection. * * @return an object containing the selected content. */ public Object getSelection() { Object o = null; if (aci == null) return o; int[] ranges = textPainter.getSelected(beginMark, endMark); // TODO: later we can return more complex things like // noncontiguous selections if ((ranges != null) && (ranges.length > 1)) { // make sure that they are in order if (ranges[0] > ranges[1]) { int temp = ranges[1]; ranges[1] = ranges[0]; ranges[0] = temp; } o = new AttributedCharacterSpanIterator (aci, ranges[0], ranges[1]+1); } return o; }
/** * Selects all the text in this TextNode. The coordinates are ignored. * @param x the x coordinate of the point the selection was made * @param y the y coordinate of the point the selection was made */ public boolean selectAll(double x, double y) { beginMark = textPainter.selectFirst(this); endMark = textPainter.selectLast(this); return true; // assume this always changes selection, for now. }
/** * Paints this node without applying Filter, Mask, Composite, and clip. * * @param g2d the Graphics2D to use */ public void primitivePaint(Graphics2D g2d) { // // DO NOT REMOVE: THE FOLLOWING IS A WORK AROUND // A BUG IN THE JDK 1.2 RENDERING PIPELINE WHEN // THE CLIP IS A RECTANGLE // Shape clip = g2d.getClip(); if (clip != null && !(clip instanceof GeneralPath)) { g2d.setClip(new GeneralPath(clip)); } // Paint the text textPainter.paint(this, g2d); }
/** * Initializes the current selection to begin with the character at (x, y). * @param x the x coordinate of the start of the selection * @param y the y coordinate of the start of the selection */ public boolean selectAt(double x, double y) { beginMark = textPainter.selectAt(x, y, this); return true; // assume this always changes selection, for now. }
/** * Return the marker for the character at index in this nodes * AttributedCharacterIterator. Before Char indicates if the * Marker should be considered before or after char. */ public Mark getMarkerForChar(int index, boolean beforeChar) { return textPainter.getMark(this, index, beforeChar); }
/** * Returns the shape used to outline this text node. * * @return a Shape which encloses the current text selection. */ public Shape getHighlightShape() { Shape highlightShape = textPainter.getHighlightShape(beginMark, endMark); AffineTransform t = getGlobalTransform(); highlightShape = t.createTransformedShape(highlightShape); return highlightShape; }
/** * Gets the current text selection. * * @return an object containing the selected content. */ public Object getSelection() { Object o = null; if (aci == null) return o; int[] ranges = textPainter.getSelected(beginMark, endMark); // TODO: later we can return more complex things like // noncontiguous selections if ((ranges != null) && (ranges.length > 1)) { // make sure that they are in order if (ranges[0] > ranges[1]) { int temp = ranges[1]; ranges[1] = ranges[0]; ranges[0] = temp; } o = new AttributedCharacterSpanIterator (aci, ranges[0], ranges[1]+1); } return o; }
/** * Selects all the text in this TextNode. The coordinates are ignored. * @param x the x coordinate of the point the selection was made * @param y the y coordinate of the point the selection was made */ public boolean selectAll(double x, double y) { beginMark = textPainter.selectFirst(this); endMark = textPainter.selectLast(this); return true; // assume this always changes selection, for now. }
/** * Returns the bounds of the area covered by this node's primitive paint. */ public Rectangle2D getPrimitiveBounds(){ if (primitiveBounds == null) { if (aci != null) { primitiveBounds = textPainter.getBounds2D(this); } } return primitiveBounds; }
/** * Get the outline shape of the text characters. * This uses the StrokingTextPainter to get the outline * shape since in theory it should be the same. * * @param node the text node * @return the outline shape of the text characters */ public Shape getOutline(TextNode node) { return proxyTextPainter.getOutline(node); }
/** * Returns the bounds of the area covered by this node, without * taking any of its rendering attribute into account. That is, * exclusive of any clipping, masking, filtering or stroking, for * example. */ public Rectangle2D getGeometryBounds(){ if (geometryBounds == null){ if (aci != null) { geometryBounds = textPainter.getGeometryBounds(this); } } return geometryBounds; }
/** * Paints this node without applying Filter, Mask, Composite, and clip. * * @param g2d the Graphics2D to use */ public void primitivePaint(Graphics2D g2d) { // // DO NOT REMOVE: THE FOLLOWING IS A WORK AROUND // A BUG IN THE JDK 1.2 RENDERING PIPELINE WHEN // THE CLIP IS A RECTANGLE // Shape clip = g2d.getClip(); if (clip != null && !(clip instanceof GeneralPath)) { g2d.setClip(new GeneralPath(clip)); } // Paint the text textPainter.paint(this, g2d); }