1 /*
2 * File: IRelationRenderer.java
3 * Copyright (c) 2004-2008 Peter Kliem (Peter.Kliem@jaret.de)
4 * A commercial license is available, see http://www.jaret.de.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 package de.jaret.util.ui.timebars.swing.renderer;
21
22 import java.awt.Graphics;
23 import java.util.List;
24
25 import de.jaret.util.ui.timebars.TimeBarViewerDelegate;
26 import de.jaret.util.ui.timebars.model.IIntervalRelation;
27
28 /**
29 * Interface describing the rendering part for relations between intervals. The relation renderer is responsible for all
30 * the calculations to be done when rendering (so it can decide whether to paint lines for relations between intervals
31 * that are not shown). It is also responsible for supplying a hit detection for selecting of relations.
32 *
33 * @author kliem
34 * @version $Id: IRelationRenderer.java 798 2008-12-27 21:51:27Z kliem $
35 */
36 public interface IRelationRenderer {
37
38 /**
39 * Do the complete relation rendering.
40 *
41 * @param delegate the delegate
42 * @param graphics Graphics to paint on
43 */
44 void renderRelations(TimeBarViewerDelegate delegate, Graphics graphics);
45
46 /**
47 * Retrieve the list of relations that are hit a the given coordinate.
48 *
49 * @param x x coordinate
50 * @param y y coordinate
51 * @return List of realations that may be empty but must not be <code>null</code>
52 */
53 List<IIntervalRelation> getRelationsForCoord(int x, int y);
54
55 /**
56 * Supply a tooltip for a position in the diagram area.
57 *
58 * @param x x coordinate
59 * @param y y coordinate
60 * @return <code>null</code> for no tooltip contribution or tooltip to be displayed
61 */
62 String getTooltip(int x, int y);
63 }