001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-present, by David Gilbert and Contributors. 006 * 007 * Project Info: http://www.jfree.org/jfreechart/index.html 008 * 009 * This library is free software; you can redistribute it and/or modify it 010 * under the terms of the GNU Lesser General Public License as published by 011 * the Free Software Foundation; either version 2.1 of the License, or 012 * (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but 015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 017 * License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this library; if not, write to the Free Software 021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 022 * USA. 023 * 024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 025 * Other names may be trademarks of their respective owners.] 026 * 027 * -------------- 028 * DialLayer.java 029 * -------------- 030 * (C) Copyright 2006-present, by David Gilbert. 031 * 032 * Original Author: David Gilbert; 033 * Contributor(s): -; 034 * 035 */ 036 037package org.jfree.chart.plot.dial; 038 039import java.awt.Graphics2D; 040import java.awt.geom.Rectangle2D; 041import java.io.Serializable; 042import java.util.EventListener; 043 044/** 045 * A dial layer draws itself within a reference frame. The view frame is a 046 * subset of the reference frame, and defines the area that is actually 047 * visible. 048 * <br><br> 049 * Classes that implement this interface should be {@link Serializable}, 050 * otherwise chart serialization may fail. 051 */ 052public interface DialLayer { 053 054 /** 055 * Returns a flag that indicates whether or not the layer is visible. 056 * 057 * @return A boolean. 058 */ 059 boolean isVisible(); 060 061 /** 062 * Registers a listener with this layer, so that it receives notification 063 * of changes to this layer. 064 * 065 * @param listener the listener. 066 */ 067 void addChangeListener(DialLayerChangeListener listener); 068 069 /** 070 * Deregisters a listener, so that it no longer receives notification of 071 * changes to this layer. 072 * 073 * @param listener the listener. 074 */ 075 void removeChangeListener(DialLayerChangeListener listener); 076 077 /** 078 * Returns {@code true} if the specified listener is currently 079 * registered with the this layer. 080 * 081 * @param listener the listener. 082 * 083 * @return A boolean. 084 */ 085 boolean hasListener(EventListener listener); 086 087 /** 088 * Returns {@code true} if the drawing should be clipped to the 089 * dial window (which is defined by the {@link DialFrame}), and 090 * {@code false} otherwise. 091 * 092 * @return A boolean. 093 */ 094 boolean isClippedToWindow(); 095 096 /** 097 * Draws the content of this layer. 098 * 099 * @param g2 the graphics target ({@code null} not permitted). 100 * @param plot the plot (typically this should not be {@code null}, 101 * but for a layer that doesn't need to reference the plot, it may 102 * be permitted). 103 * @param frame the reference frame for the dial's geometry 104 * ({@code null} not permitted). This is typically larger than 105 * the visible area of the dial (see the next parameter). 106 * @param view the visible area for the dial ({@code null} not 107 * permitted). 108 */ 109 void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, 110 Rectangle2D view); 111 112}