| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Created on Mar 10, 2005 | |
| 3 | * | |
| 4 | * Copyright (c) 2005, the JUNG Project and the Regents of the University | |
| 5 | * of California | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This software is open-source under the BSD license; see either | |
| 9 | * "license.txt" or | |
| 10 | * http://jung.sourceforge.net/license.txt for a description. | |
| 11 | */ | |
| 12 | package edu.uci.ics.jung.graph.decorators; | |
| 13 | ||
| 14 | import java.awt.Paint; | |
| 15 | ||
| 16 | import edu.uci.ics.jung.graph.Edge; | |
| 17 | import edu.uci.ics.jung.visualization.PickedInfo; | |
| 18 | ||
| 19 | /** | |
| 20 | * Paints each edge according to the <code>Paint</code> | |
| 21 | * parameters given in the constructor, so that picked and | |
| 22 | * non-picked edges can be made to look different. | |
| 23 | * | |
| 24 | * @author Tom Nelson - RABA Technologies | |
| 25 | * @author Joshua O'Madadhain | |
| 26 | * | |
| 27 | */ | |
| 28 | public class PickableEdgePaintFunction extends AbstractEdgePaintFunction | |
| 29 | { | |
| 30 | protected PickedInfo pi; | |
| 31 | protected Paint draw_paint; | |
| 32 | protected Paint picked_paint; | |
| 33 | ||
| 34 | /** | |
| 35 | * | |
| 36 | * @param pi specifies which vertices report as "picked" | |
| 37 | * @param draw_paint <code>Paint</code> used to draw edge shapes | |
| 38 | * @param picked_paint <code>Paint</code> used to draw picked edge shapes | |
| 39 | */ | |
| 40 | 0 | public PickableEdgePaintFunction(PickedInfo pi, Paint draw_paint, Paint picked_paint) { |
| 41 | 0 | if (pi == null) |
| 42 | 0 | throw new IllegalArgumentException("PickedInfo instance must be non-null"); |
| 43 | 0 | this.pi = pi; |
| 44 | 0 | this.draw_paint = draw_paint; |
| 45 | 0 | this.picked_paint = picked_paint; |
| 46 | 0 | } |
| 47 | ||
| 48 | /** | |
| 49 | * @see edu.uci.ics.jung.graph.decorators.EdgePaintFunction#getDrawPaint(edu.uci.ics.jung.graph.Edge) | |
| 50 | */ | |
| 51 | public Paint getDrawPaint(Edge e) { | |
| 52 | 0 | if (pi.isPicked(e)) { |
| 53 | 0 | return picked_paint; |
| 54 | } | |
| 55 | else { | |
| 56 | 0 | return draw_paint; |
| 57 | } | |
| 58 | } | |
| 59 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |