/** * Returns the label size of the specified view in the given graph. */ public Dimension getExtraLabelSize(JGraph paintingContext, EdgeView view, int index) { Object[] labels = GraphConstants .getExtraLabels(view.getAllAttributes()); if (labels != null && index < labels.length) { String label = (paintingContext != null) ? paintingContext .convertValueToString(labels[index]) : String .valueOf(labels[index]); return getLabelSize(view, label); } return null; }
/** * Returns the label bounds of the specified view in the given graph. */ public Rectangle2D getLabelBounds(JGraph paintingContext, EdgeView view) { if (paintingContext == null && graph != null) { JGraph graph = (JGraph)this.graph.get(); paintingContext = graph; } // No need to call setView as getLabelPosition will String label = (paintingContext != null) ? paintingContext .convertValueToString(view) : String.valueOf(view.getCell()); if (label != null) { Point2D p = getLabelPosition(view); Dimension d = getLabelSize(view, label); return getLabelBounds(p, d, label); } else { return null; } }
graph.toScreen(p); Dimension d = er.getLabelSize(e, graph.convertValueToString(e)); if (p != null && d != null) { Point2D s = graph.toScreen(new Point2D.Double(d.width,