1 /*
2 * File: TimeBarModel.java
3 * Copyright (c) 2004-2007 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.model;
21
22 import de.jaret.util.date.Interval;
23 import de.jaret.util.date.JaretDate;
24
25 /**
26 * Model for a number of rows containing intervals.
27 *
28 * @author Peter Kliem
29 * @version $Id: TimeBarModel.java 800 2008-12-27 22:27:33Z kliem $
30 */
31 public interface TimeBarModel {
32 /**
33 * Return the row for the given index.
34 *
35 * @param row index of the row
36 * @return the row for the given index
37 */
38 TimeBarRow getRow(int row);
39
40 /**
41 * Get the number of rows in the model.
42 *
43 * @return number of rows
44 */
45 int getRowCount();
46
47 /**
48 * Retrieve the earliest date in the model.
49 *
50 * @return earliest date in the model
51 */
52 JaretDate getMinDate();
53
54 /**
55 * Retrieve tha latesr dat ein the model.
56 *
57 * @return the latest date in the model
58 */
59 JaretDate getMaxDate();
60
61 /**
62 * Retrieve the TimeBarRow for a given interval.
63 *
64 * @param interval interval to gt the row for.
65 * @return TimeBarRow that contains the interval or <code>null</code> if no row could be determined.
66 */
67 TimeBarRow getRowForInterval(Interval interval);
68
69 /**
70 * Add a listener to listen for changes in the model.
71 *
72 * @param tbml TimeBarModelListener for watching the model
73 */
74 void addTimeBarModelListener(TimeBarModelListener tbml);
75
76 /**
77 * Removes a previously added listener.
78 *
79 * @param tbml TimeBarModelListener to be removed
80 */
81 void remTimeBarModelListener(TimeBarModelListener tbml);
82
83 }