1 /***
2 * TableColorModelEvent.java
3 *
4 * This file is part of the creme library.
5 * The creme library intends to ease the development effort of large
6 * applications by providing easy to use support classes.
7 *
8 * Copyright (C) 2002 Denis Bregeon
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * contact information: dbregeon@sourceforge.net
25 */
26 package org.jcreme.swing.table;
27
28 import java.util.EventObject;
29
30 /***
31 * Describes what changed in a TableColorModel.
32 *
33 * @author $Author: dbregeon $
34 * @version $Revision: 1.1 $
35 */
36 public class TableColorModelEvent extends EventObject {
37
38 /***
39 * This constant signals that all the row colors changed.
40 */
41 public static final int ALL_ROWS = -1;
42
43 /***
44 * This constant signals that all the column colors changed.
45 */
46 public static final int ALL_COLUMNS = -1;
47
48 /***
49 * The first row that changed color.
50 */
51 private int minRow = ALL_ROWS;
52
53 /***
54 * The last row that changed color.
55 */
56 private int maxRow = ALL_ROWS;
57
58 /***
59 * The column that changed color.
60 */
61 private int column = ALL_COLUMNS;
62
63 /***
64 * Creates new TableColorModelEvent
65 *
66 * @param source
67 * the TableColorModel that changed.
68 */
69 public TableColorModelEvent(Object source) {
70 this(source, ALL_ROWS, ALL_COLUMNS);
71 }
72
73 /***
74 * Creates new TableColorModelEvent
75 *
76 * @param source
77 * the TableColorModel that changed.
78 * @param row
79 * the row that changed color.
80 */
81 public TableColorModelEvent(Object source, int row) {
82 this(source, row, ALL_COLUMNS);
83 }
84
85 /***
86 * Creates new TableColorModelEvent
87 *
88 * @param source
89 * the TableColorModel that changed.
90 * @param row
91 * the row that changed color.
92 * @param column
93 * the column that changed color.
94 */
95 public TableColorModelEvent(Object source, int row, int column) {
96 this(source, row, row, column);
97 }
98
99 /***
100 * Creates new TableColorModelEvent
101 *
102 * @param source
103 * the TableColorModel that changed.
104 * @param minRow
105 * the first row that changed color.
106 * @param maxRow
107 * the last row that changed color.
108 * @param column
109 * the column that changed color.
110 */
111 public TableColorModelEvent(Object source, int minRow, int maxRow,
112 int column) {
113 super(source);
114 this.minRow = minRow;
115 this.maxRow = maxRow;
116 this.column = column;
117 }
118
119 /***
120 * Gives access to the index of the column that changed.
121 *
122 * @return the column where the color changed. ALL_COLUMNS if all the
123 * columns changed.
124 */
125 public int getColumn() {
126 return this.column;
127 }
128
129 /***
130 * Gives access to the first row index that changed.
131 *
132 * @return the first row where the color changed. ALL_ROWS if all the rows
133 * changed.
134 */
135 public int getMinRow() {
136 return this.minRow;
137 }
138
139 /***
140 * Gives access to the last row index that changed.
141 *
142 * @return the last row where the color changed. ALL_ROWS if all the rows
143 * changed.
144 */
145 public int getMaxRow() {
146 return this.maxRow;
147 }
148 }