Coverage details for edu.uci.ics.jung.graph.decorators.PickableEdgePaintFunction

LineHitsSource
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      */
400    public PickableEdgePaintFunction(PickedInfo pi, Paint draw_paint, Paint picked_paint) {
410        if (pi == null)
420            throw new IllegalArgumentException("PickedInfo instance must be non-null");
430        this.pi = pi;
440        this.draw_paint = draw_paint;
450        this.picked_paint = picked_paint;
460    }
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) {
520        if (pi.isPicked(e)) {
530            return picked_paint;
54         }
55         else {
560            return draw_paint;
57         }
58     }
59 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.