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

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.Vertex;
17 import edu.uci.ics.jung.visualization.PickedInfo;
18  
19 /**
20  * Paints each vertex according to the <code>Paint</code>
21  * parameters given in the constructor, so that picked and
22  * non-picked vertices can be made to look different.
23  */
24 public class PickableVertexPaintFunction implements VertexPaintFunction {
25  
26     protected Paint draw_paint;
27     protected Paint fill_paint;
28     protected Paint picked_paint;
29     protected PickedInfo pi;
30     
31     /**
32      *
33      * @param pi specifies which vertices report as "picked"
34      * @param draw_paint <code>Paint</code> used to draw vertex shapes
35      * @param fill_paint <code>Paint</code> used to fill vertex shapes
36      * @param picked_paint <code>Paint</code> used to fill picked vertex shapes
37      */
38     public PickableVertexPaintFunction(PickedInfo pi, Paint draw_paint, Paint fill_paint, Paint picked_paint)
390    {
400        if (pi == null)
410            throw new IllegalArgumentException("PickedInfo instance must be non-null");
420        this.pi = pi;
430        this.draw_paint = draw_paint;
440        this.fill_paint = fill_paint;
450        this.picked_paint = picked_paint;
460    }
47  
48     public Paint getDrawPaint(Vertex v)
49     {
500        return draw_paint;
51     }
52  
53     public Paint getFillPaint(Vertex v)
54     {
550        if (pi.isPicked(v))
560            return picked_paint;
57         else
580            return fill_paint;
59     }
60  
61 }

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.