View Javadoc
1   /*
2    * Copyright (c) 2005, The JUNG Authors
3    * All rights reserved.
4    *
5    * This software is open-source under the BSD license; see either "license.txt"
6    * or https://github.com/jrtom/jung/blob/master/LICENSE for a description.
7    *
8    * 
9    */
10  package edu.uci.ics.jung.visualization.annotations;
11  
12  import java.awt.Paint;
13  import java.awt.geom.Point2D;
14  
15  /**
16   * stores an annotation, either a shape or a string
17   * 
18   * @author Tom Nelson - tomnelson@dev.java.net
19   *
20   * @param <T> the type of the annotation object
21   */
22  public class Annotation<T> {
23  	
24  	protected T annotation;
25  	protected Paint paint;
26  	protected Point2D location;
27  	protected Layer layer;
28  	protected boolean fill;
29  	public static enum Layer { LOWER, UPPER }
30  	
31  	public Annotation(T annotation, Layer layer, Paint paint, 
32  			boolean fill, Point2D location) {
33  		this.annotation = annotation;
34  		this.layer = layer;
35  		this.paint = paint;
36  		this.fill = fill;
37  		this.location = location;
38  	}
39  	/**
40  	 * @return the annotation
41  	 */
42  	public T getAnnotation() {
43  		return annotation;
44  	}
45  	/**
46  	 * @param annotation the annotation to set
47  	 */
48  	public void setAnnotation(T annotation) {
49  		this.annotation = annotation;
50  	}
51  	/**
52  	 * @return the location
53  	 */
54  	public Point2D getLocation() {
55  		return location;
56  	}
57  	/**
58  	 * @return the layer
59  	 */
60  	public Layer getLayer() {
61  		return layer;
62  	}
63  	/**
64  	 * @param layer the layer to set
65  	 */
66  	public void setLayer(Layer layer) {
67  		this.layer = layer;
68  	}
69  	/**
70  	 * @param location the location to set
71  	 */
72  	public void setLocation(Point2D location) {
73  		this.location = location;
74  	}
75  	/**
76  	 * @return the paint
77  	 */
78  	public Paint getPaint() {
79  		return paint;
80  	}
81  	/**
82  	 * @param paint the paint to set
83  	 */
84  	public void setPaint(Paint paint) {
85  		this.paint = paint;
86  	}
87  	/**
88  	 * @return the fill
89  	 */
90  	public boolean isFill() {
91  		return fill;
92  	}
93  	/**
94  	 * @param fill the fill to set
95  	 */
96  	public void setFill(boolean fill) {
97  		this.fill = fill;
98  	}
99  }