KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > event > ReportElementChangedEvent


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the 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, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * ReportElementChangedEvent.java
28  *
29  * Created on 17 giugno 2003, 1.12
30  *
31  */

32
33 package it.businesslogic.ireport.gui.event;
34 import it.businesslogic.ireport.*;
35 import it.businesslogic.ireport.CrosstabReportElement;
36 import it.businesslogic.ireport.gui.*;
37 import java.util.*;
38 /**
39  * Save all info required by a ReportListenerElementsSelectionEvent
40  * Return the vector of selected elements (taked by the JReportFrame...)
41  * @author Administrator
42  */

43 public class ReportElementChangedEvent {
44     
45     private JReportFrame jReportFrame;
46     private CrosstabReportElement crosstabReportElement;
47     
48     
49     private Object JavaDoc eventSource = null;
50     private String JavaDoc propertyChanged = null;
51     private Object JavaDoc newValue = null;
52     
53     /**
54      * The element was removed
55      */

56     public static final int REMOVED = 1;
57     /**
58      * An element was added
59      */

60     public static final int ADDED = 2;
61     /**
62      * The element was changed
63      */

64     public static final int CHANGED = 3;
65
66     /**
67      * The element that is changed/removed/added
68      */

69     private Vector elements;
70     
71     /**
72      * The type of the element
73      */

74     private int type = 0;
75     /** Creates a new instance of ReportListenerElementChangedEvent */
76     public ReportElementChangedEvent(JReportFrame jReportFrame, CrosstabReportElement crosstabReportElement, ReportElement element, int type) {
77         this.jReportFrame = jReportFrame;
78         this.crosstabReportElement = crosstabReportElement;
79         this.elements = new Vector();
80         this.elements.add(element);
81         this.type = type;
82     }
83     
84     public ReportElementChangedEvent(JReportFrame jReportFrame, CrosstabReportElement crosstabReportElement, Vector elements, int type) {
85         this.jReportFrame = jReportFrame;
86         this.crosstabReportElement = crosstabReportElement;
87         this.elements = elements;
88         this.type = type;
89     }
90     
91     public ReportElementChangedEvent(JReportFrame jReportFrame, ReportElement element, int type) {
92         this(jReportFrame, null, element, type);
93     }
94     
95     public ReportElementChangedEvent(JReportFrame jReportFrame, Vector elements, int type) {
96         this(jReportFrame, null, elements, type);
97     }
98     
99     /** Getter for property selectedElements.
100      * @return Value of property selectedElements.
101      *
102      */

103     public ReportElement getElement() {
104         if (elements.size() > 0) return (ReportElement)elements.elementAt(0);
105         return null;
106     }
107     
108     /** Setter for property selectedElements.
109      * @param selectedElements New value of property selectedElements.
110      *
111      */

112     public void setElement(ReportElement element) {
113         elements.removeAllElements();
114         
115         this.elements.add(element);
116     }
117     
118     /** Getter for property type.
119      * Type can assume 3 values:
120      * REMOVED, ADDED, CHANGED
121      * @return Value of property type.
122      *
123      */

124     public int getType() {
125         return type;
126     }
127     
128     /** Setter for property type.
129      * @param type New value of property type.
130      *
131      */

132     public void setType(int type) {
133         this.type = type;
134     }
135     
136     /** Getter for property jReportFrame.
137      * @return Value of property jReportFrame.
138      *
139      */

140     public it.businesslogic.ireport.gui.JReportFrame getJReportFrame() {
141         return jReportFrame;
142     }
143     
144     /** Setter for property jReportFrame.
145      * @param jReportFrame New value of property jReportFrame.
146      *
147      */

148     public void setJReportFrame(it.businesslogic.ireport.gui.JReportFrame jReportFrame) {
149         this.jReportFrame = jReportFrame;
150     }
151
152     public Vector getElements() {
153         return elements;
154     }
155
156     public void setElements(Vector elements) {
157         this.elements = elements;
158     }
159
160     public CrosstabReportElement getCrosstabReportElement() {
161         return crosstabReportElement;
162     }
163
164     public void setCrosstabReportElement(CrosstabReportElement crosstabReportElement) {
165         this.crosstabReportElement = crosstabReportElement;
166     }
167
168     public Object JavaDoc getEventSource() {
169         return eventSource;
170     }
171
172     public void setEventSource(Object JavaDoc eventSource) {
173         this.eventSource = eventSource;
174     }
175
176     public String JavaDoc getPropertyChanged() {
177         return propertyChanged;
178     }
179
180     public void setPropertyChanged(String JavaDoc propertyChanged) {
181         this.propertyChanged = propertyChanged;
182     }
183
184     public Object JavaDoc getNewValue() {
185         return newValue;
186     }
187
188     public void setNewValue(Object JavaDoc newValue) {
189         this.newValue = newValue;
190     }
191     
192 }
193
Popular Tags