KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > crosstab > gui > CellAnimationEffect


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  * CellAnimationEffect.java
28  *
29  * Created on January 24, 2006, 5:21 PM
30  *
31  */

32
33 package it.businesslogic.ireport.crosstab.gui;
34
35 import it.businesslogic.ireport.crosstab.CrosstabCell;
36 import java.awt.Color JavaDoc;
37 import java.awt.Graphics2D JavaDoc;
38
39 /**
40  *
41  * @author gtoffoli
42  */

43 public class CellAnimationEffect implements Runnable JavaDoc {
44     
45     private CrosstabEditorPanel editor = null;
46     private CrosstabCell noDataCell = null;
47     /** Creates a new instance of CellAnimationEffect */
48     public CellAnimationEffect() {
49     }
50
51     public CrosstabEditorPanel getEditor() {
52         return editor;
53     }
54
55     public void setEditor(CrosstabEditorPanel editor) {
56         this.editor = editor;
57     }
58     
59     public void run()
60     {
61          Graphics2D JavaDoc g = (Graphics2D JavaDoc)editor.getGraphics();
62          g.setColor(new Color JavaDoc(255,168,0,20));
63          
64          
65          System.out.println(editor.getZoomedDim(getNoDataCell().getTop())+","+editor.getZoomedDim(getNoDataCell().getLeft()));
66          
67          
68          for (int j=1; j<=20; ++j)
69          {
70              g.setColor(new Color JavaDoc(255,168,0,j));
71              int i=10;
72              g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())-i+10, editor.getZoomedDim(getNoDataCell().getTop())-i+10,
73                         editor.getZoomedDim(getNoDataCell().getWidth())+(i*2), i);
74
75              g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())-i+10, editor.getZoomedDim(getNoDataCell().getTop())+10,
76                        i, editor.getZoomedDim(getNoDataCell().getHeight()));
77
78              g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())+10-i, editor.getZoomedDim(getNoDataCell().getTop())+editor.getZoomedDim(getNoDataCell().getHeight())+10,
79                        editor.getZoomedDim(getNoDataCell().getWidth())+(i*2), i);
80              
81              g.fillRect(editor.getZoomedDim(getNoDataCell().getLeft())+editor.getZoomedDim(getNoDataCell().getWidth())+10, editor.getZoomedDim(getNoDataCell().getTop())+10,
82                        i, editor.getZoomedDim(getNoDataCell().getHeight()));
83
84             try {
85              Thread.sleep(20);
86             } catch (Exception JavaDoc ex){}
87             
88             
89          }
90           
91          getNoDataCell().setPaintSelection(true);
92          getNoDataCell().drawCellBox(g,editor.getZoomFactor(),false,false);
93     }
94
95     public CrosstabCell getNoDataCell() {
96         return noDataCell;
97     }
98
99     public void setNoDataCell(CrosstabCell noDataCell) {
100         this.noDataCell = noDataCell;
101     }
102 }
103
Popular Tags