001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * ReportElementChangedEvent.java
028: *
029: * Created on 17 giugno 2003, 1.12
030: *
031: */
032:
033: package it.businesslogic.ireport.gui.event;
034:
035: import it.businesslogic.ireport.*;
036: import it.businesslogic.ireport.CrosstabReportElement;
037: import it.businesslogic.ireport.gui.*;
038: import java.util.*;
039:
040: /**
041: * Save all info required by a ReportListenerElementsSelectionEvent
042: * Return the vector of selected elements (taked by the JReportFrame...)
043: * @author Administrator
044: */
045: public class ReportElementChangedEvent {
046:
047: private JReportFrame jReportFrame;
048: private CrosstabReportElement crosstabReportElement;
049:
050: private Object eventSource = null;
051: private String propertyChanged = null;
052: private Object newValue = null;
053:
054: /**
055: * The element was removed
056: */
057: public static final int REMOVED = 1;
058: /**
059: * An element was added
060: */
061: public static final int ADDED = 2;
062: /**
063: * The element was changed
064: */
065: public static final int CHANGED = 3;
066:
067: /**
068: * The element that is changed/removed/added
069: */
070: private Vector elements;
071:
072: /**
073: * The type of the element
074: */
075: private int type = 0;
076:
077: /** Creates a new instance of ReportListenerElementChangedEvent */
078: public ReportElementChangedEvent(JReportFrame jReportFrame,
079: CrosstabReportElement crosstabReportElement,
080: ReportElement element, int type) {
081: this .jReportFrame = jReportFrame;
082: this .crosstabReportElement = crosstabReportElement;
083: this .elements = new Vector();
084: this .elements.add(element);
085: this .type = type;
086: }
087:
088: public ReportElementChangedEvent(JReportFrame jReportFrame,
089: CrosstabReportElement crosstabReportElement,
090: Vector elements, int type) {
091: this .jReportFrame = jReportFrame;
092: this .crosstabReportElement = crosstabReportElement;
093: this .elements = elements;
094: this .type = type;
095: }
096:
097: public ReportElementChangedEvent(JReportFrame jReportFrame,
098: ReportElement element, int type) {
099: this (jReportFrame, null, element, type);
100: }
101:
102: public ReportElementChangedEvent(JReportFrame jReportFrame,
103: Vector elements, int type) {
104: this (jReportFrame, null, elements, type);
105: }
106:
107: /** Getter for property selectedElements.
108: * @return Value of property selectedElements.
109: *
110: */
111: public ReportElement getElement() {
112: if (elements.size() > 0)
113: return (ReportElement) elements.elementAt(0);
114: return null;
115: }
116:
117: /** Setter for property selectedElements.
118: * @param selectedElements New value of property selectedElements.
119: *
120: */
121: public void setElement(ReportElement element) {
122: elements.removeAllElements();
123:
124: this .elements.add(element);
125: }
126:
127: /** Getter for property type.
128: * Type can assume 3 values:
129: * REMOVED, ADDED, CHANGED
130: * @return Value of property type.
131: *
132: */
133: public int getType() {
134: return type;
135: }
136:
137: /** Setter for property type.
138: * @param type New value of property type.
139: *
140: */
141: public void setType(int type) {
142: this .type = type;
143: }
144:
145: /** Getter for property jReportFrame.
146: * @return Value of property jReportFrame.
147: *
148: */
149: public it.businesslogic.ireport.gui.JReportFrame getJReportFrame() {
150: return jReportFrame;
151: }
152:
153: /** Setter for property jReportFrame.
154: * @param jReportFrame New value of property jReportFrame.
155: *
156: */
157: public void setJReportFrame(
158: it.businesslogic.ireport.gui.JReportFrame jReportFrame) {
159: this .jReportFrame = jReportFrame;
160: }
161:
162: public Vector getElements() {
163: return elements;
164: }
165:
166: public void setElements(Vector elements) {
167: this .elements = elements;
168: }
169:
170: public CrosstabReportElement getCrosstabReportElement() {
171: return crosstabReportElement;
172: }
173:
174: public void setCrosstabReportElement(
175: CrosstabReportElement crosstabReportElement) {
176: this .crosstabReportElement = crosstabReportElement;
177: }
178:
179: public Object getEventSource() {
180: return eventSource;
181: }
182:
183: public void setEventSource(Object eventSource) {
184: this .eventSource = eventSource;
185: }
186:
187: public String getPropertyChanged() {
188: return propertyChanged;
189: }
190:
191: public void setPropertyChanged(String propertyChanged) {
192: this .propertyChanged = propertyChanged;
193: }
194:
195: public Object getNewValue() {
196: return newValue;
197: }
198:
199: public void setNewValue(Object newValue) {
200: this.newValue = newValue;
201: }
202:
203: }
|