001/* ---------------------------------------------------------------------------- 002 The Kiwi Toolkit - A Java Class Library 003 Copyright (C) 1998-2004 Mark A. Lindner 004 005 This library is free software; you can redistribute it and/or 006 modify it under the terms of the GNU General Public License as 007 published by the Free Software Foundation; either version 2 of the 008 License, or (at your option) any later version. 009 010 This library is distributed in the hope that it will be useful, 011 but WITHOUT ANY WARRANTY; without even the implied warranty of 012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 General Public License for more details. 014 015 You should have received a copy of the GNU General Public License 016 along with this library; if not, write to the Free Software 017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 018 02111-1307, USA. 019 020 The author may be contacted at: mark_a_lindner@yahoo.com 021 ---------------------------------------------------------------------------- 022 $Log: ChartModel.java,v $ 023 Revision 1.5 2004/05/05 22:39:59 markl 024 comment block updates 025 026 Revision 1.4 2003/01/19 09:33:06 markl 027 Javadoc & comment header updates. 028 029 Revision 1.3 2001/03/12 07:24:00 markl 030 Javadoc cleanup. 031 032 Revision 1.2 2001/03/12 04:11:41 markl 033 Source code cleanup. 034 035 Revision 1.1 2001/03/12 03:41:24 markl 036 Moved from kiwi.ui.graph package. 037 038 Revision 1.2 2000/10/15 09:40:28 markl 039 Added javadoc and final API polishing. 040 041 Revision 1.1 2000/10/13 02:04:18 markl 042 Added remaining classes, and integrated components with models. 043 ---------------------------------------------------------------------------- 044*/ 045 046package kiwi.ui.model; 047 048import kiwi.event.*; 049import kiwi.ui.graph.*; 050 051import java.util.*; 052import javax.swing.event.*; 053import javax.swing.table.*; 054 055/** This interface defines the behavior for a data model for charts. A 056 * <code>ChartModel</code> consists of a collection of 057 * <code>DataSample</code>s. A <code>ChartView</code> plots these data 058 * samples graphically. 059 * 060 * @see kiwi.ui.graph.ChartView 061 * 062 * @author Mark Lindner 063 */ 064 065public interface ChartModel 066 { 067 068 /** Add a <code>ChartModelListener</code> to this model's list of listeners. 069 * 070 * @param listener The listener to add. 071 */ 072 073 public void addChartModelListener(ChartModelListener listener); 074 075 /** Remove a <code>ChartModelListener</code> from this model's list of 076 * listeners. 077 * 078 * @param listener The listener to remove. 079 */ 080 081 public void removeChartModelListener(ChartModelListener listener); 082 083 /** Get the number of data samples in this model. 084 * 085 * @return The number of data samples. 086 */ 087 088 public int getDataSampleCount(); 089 090 /** Get the data sample at the specified index. 091 * 092 * @param index The index of the desired data sample. 093 * @return The <code>DataSample</code> at the specified index, or 094 * <code>null</code> if there is no data sample at that index. 095 */ 096 097 public DataSample getDataSample(int index); 098 099 /** Get all of the data samples in this model. 100 * 101 * @return An <code>Enumeration</code> of the <code>DataSample</code> 102 * objects in this model. 103 */ 104 105 public Enumeration getDataSamples(); 106 107 /** Add a data sample to this model. 108 * 109 * @param ds The data sample to add. 110 */ 111 112 public void addDataSample(DataSample ds); 113 114 /** Remove the data sample at the specified index from this model. 115 * 116 * @param index The index of the data sample to remove. 117 */ 118 119 public void removeDataSample(int index); 120 121 /** Remove all data samples from this model. 122 */ 123 124 public void clear(); 125 } 126 127/* end of source file */