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: * CellAnimationEffect.java
028: *
029: * Created on January 24, 2006, 5:21 PM
030: *
031: */
032:
033: package it.businesslogic.ireport.crosstab.gui;
034:
035: import it.businesslogic.ireport.crosstab.CrosstabCell;
036: import java.awt.Color;
037: import java.awt.Graphics2D;
038:
039: /**
040: *
041: * @author gtoffoli
042: */
043: public class CellAnimationEffect implements Runnable {
044:
045: private CrosstabEditorPanel editor = null;
046: private CrosstabCell noDataCell = null;
047:
048: /** Creates a new instance of CellAnimationEffect */
049: public CellAnimationEffect() {
050: }
051:
052: public CrosstabEditorPanel getEditor() {
053: return editor;
054: }
055:
056: public void setEditor(CrosstabEditorPanel editor) {
057: this .editor = editor;
058: }
059:
060: public void run() {
061: Graphics2D g = (Graphics2D) editor.getGraphics();
062: g.setColor(new Color(255, 168, 0, 20));
063:
064: System.out.println(editor
065: .getZoomedDim(getNoDataCell().getTop())
066: + "," + editor.getZoomedDim(getNoDataCell().getLeft()));
067:
068: for (int j = 1; j <= 20; ++j) {
069: g.setColor(new Color(255, 168, 0, j));
070: int i = 10;
071: g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())
072: - i + 10, editor.getZoomedDim(getNoDataCell()
073: .getTop())
074: - i + 10, editor.getZoomedDim(getNoDataCell()
075: .getWidth())
076: + (i * 2), i);
077:
078: g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())
079: - i + 10, editor.getZoomedDim(getNoDataCell()
080: .getTop()) + 10, i, editor
081: .getZoomedDim(getNoDataCell().getHeight()));
082:
083: g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())
084: + 10 - i, editor.getZoomedDim(getNoDataCell()
085: .getTop())
086: + editor.getZoomedDim(getNoDataCell().getHeight())
087: + 10, editor.getZoomedDim(getNoDataCell()
088: .getWidth())
089: + (i * 2), i);
090:
091: g
092: .fillRect(editor.getZoomedDim(getNoDataCell()
093: .getLeft())
094: + editor.getZoomedDim(getNoDataCell()
095: .getWidth()) + 10,
096: editor.getZoomedDim(getNoDataCell()
097: .getTop()) + 10, i, editor
098: .getZoomedDim(getNoDataCell()
099: .getHeight()));
100:
101: try {
102: Thread.sleep(20);
103: } catch (Exception ex) {
104: ex.printStackTrace();
105: }
106:
107: }
108:
109: getNoDataCell().setPaintSelection(true);
110: getNoDataCell().drawCellBox(g, editor.getZoomFactor(), false,
111: false);
112: }
113:
114: public CrosstabCell getNoDataCell() {
115: return noDataCell;
116: }
117:
118: public void setNoDataCell(CrosstabCell noDataCell) {
119: this.noDataCell = noDataCell;
120: }
121: }
|