1 /*
2 * File: ITimeBarViewState.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 /**
23 * A standard viewstate for the timebar viewer. This mainly holds the row heights/column widths.
24 *
25 * @author kliem
26 * @version $Id: ITimeBarViewState.java 790 2008-12-10 23:14:13Z kliem $
27 */
28 public interface ITimeBarViewState {
29 /**
30 * Set the default height for all rows. This height will also be used, if variable heights are not used.
31 *
32 * @param height height
33 */
34 void setDefaultRowHeight(int height);
35
36 /**
37 * Retrieve the default row height.
38 *
39 * @return the default row height
40 */
41 int getDefaultRowHeight();
42
43 /**
44 * Retrieve the height of the given row.
45 *
46 * @param row row to receive the height for
47 * @return the height of the row
48 */
49 int getRowHeight(TimeBarRow row);
50
51 /**
52 * Set the height for a specific row.
53 *
54 * @param row row to set the height for
55 * @param height the height of the row
56 */
57 void setRowHeight(TimeBarRow row, int height);
58
59 /**
60 * Check whether the intervals in a certain row should be drawn overlapping. If no value had been set, the global
61 * value from the delegate is returned.
62 *
63 * @param row row to look for
64 * @return true if the intervals shoukd be drawn overlapping
65 */
66 boolean getDrawOverlapping(TimeBarRow row);
67
68 /**
69 * Set for a single row whether the intervals should be drawn overlapping (overwriting the global setting done in
70 * the viewer/delegate).
71 *
72 * @param row the row to set the property for
73 * @param drawOverlapping <code>true</code> for overlapping drawing
74 */
75 void setDrawOverlapping(TimeBarRow row, boolean drawOverlapping);
76
77 /**
78 * Set whether to use variable row heights/widths.
79 *
80 * @param useVariableRowHeights <code>true</code> to use variable row heights/widths. This will have an impact no
81 * some performance aspects in the timebar viewer.
82 */
83 void setUseVariableRowHeights(boolean useVariableRowHeights);
84
85 /**
86 * Retrieve whether to use variable row heights/widths.
87 *
88 * @return <code>true</code> if variable row heights/width should be used
89 */
90 boolean getUseVariableRowHeights();
91
92 /**
93 * Set a strategy for height calculation.
94 *
95 * @param rowHeightStrategy the strategy for calculation or <code>null</code> to remove a strategy
96 */
97 void setRowHeightStrategy(IRowHeightStrategy rowHeightStrategy);
98
99 /**
100 * Retrieve the row height strategy if set.
101 *
102 * @return the strategy or <code>null</code>
103 */
104 IRowHeightStrategy getRowHeightStrategy();
105
106 /**
107 * Add a listener to be informed about row height/width changes.
108 *
109 * @param listener listener to be informed
110 */
111 void addTimeBarViewStateListener(ITimeBarViewStateListener listener);
112
113 /**
114 * Remove a viewstate listener.
115 *
116 * @param listener listener to be removed
117 */
118 void removeTimeBarViewStateListener(ITimeBarViewStateListener listener);
119
120 }