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: * CrosstabEditor.java
028: *
029: * Created on 3 gennaio 2006, 13.39
030: *
031: */
032:
033: package it.businesslogic.ireport.crosstab.gui;
034:
035: import it.businesslogic.ireport.CrosstabReportElement;
036: import it.businesslogic.ireport.crosstab.CrosstabCell;
037: import it.businesslogic.ireport.crosstab.CrosstabGroup;
038: import it.businesslogic.ireport.gui.event.CrosstabLayoutChangedEvent;
039: import it.businesslogic.ireport.gui.event.CrosstabLayoutChangedListener;
040: import java.awt.image.ImageObserver;
041: import java.util.ArrayList;
042: import java.util.List;
043:
044: /**
045: *
046: * @author Administrator
047: */
048: public class CrosstabEditor extends javax.swing.JPanel implements
049: ImageObserver, CrosstabLayoutChangedListener {
050:
051: private CrosstabReportElement crosstabElement = null;
052:
053: /** Creates new form CrosstabEditor */
054: public CrosstabEditor(CrosstabReportElement crossTabElement) {
055: initComponents();
056: this .setCrosstabElement(crossTabElement);
057: getCrosstabElement().addCrosstabLayoutChangedListener(this );
058: this .crosstabEditorPanel1.setEditor(this );
059: this .jScrollPane1.getVerticalScrollBar().setBlockIncrement(30);
060: this .jScrollPane1.getVerticalScrollBar().setUnitIncrement(30);
061: }
062:
063: public CrosstabReportElement getCrosstabElement() {
064: return crosstabElement;
065: }
066:
067: public void setCrosstabElement(CrosstabReportElement crossTabElement) {
068: this .crosstabElement = crossTabElement;
069: }
070:
071: public double getZoomFactor() {
072: return crosstabEditorPanel1.getZoomFactor();
073: }
074:
075: public void setZoomFactor(double zoomFactor) {
076: crosstabEditorPanel1.setZoomFactor(zoomFactor);
077: }
078:
079: public void crosstabLayoutChanged(CrosstabLayoutChangedEvent evt) {
080: this .crosstabEditorPanel1.updateGrid();
081: this .crosstabEditorPanel1.repaint();
082: }
083:
084: public void updatePanel() {
085: this .crosstabEditorPanel1.setEditor(this );
086: }
087:
088: public it.businesslogic.ireport.crosstab.gui.CrosstabEditorPanel getPanelEditor() {
089: return this .crosstabEditorPanel1;
090: }
091:
092: /** This method is called from within the constructor to
093: * initialize the form.
094: * WARNING: Do NOT modify this code. The content of this method is
095: * always regenerated by the Form Editor.
096: */
097: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
098: private void initComponents() {
099: java.awt.GridBagConstraints gridBagConstraints;
100:
101: jPanel1 = new javax.swing.JPanel();
102: jPanel2 = new javax.swing.JPanel();
103: jPanel3 = new javax.swing.JPanel();
104: jScrollPane1 = new javax.swing.JScrollPane();
105: crosstabEditorPanel1 = new it.businesslogic.ireport.crosstab.gui.CrosstabEditorPanel();
106:
107: setLayout(new java.awt.GridBagLayout());
108:
109: setBackground(new java.awt.Color(204, 204, 204));
110: addFocusListener(new java.awt.event.FocusAdapter() {
111: public void focusGained(java.awt.event.FocusEvent evt) {
112: formFocusGained(evt);
113: }
114: });
115: addKeyListener(new java.awt.event.KeyAdapter() {
116: public void keyPressed(java.awt.event.KeyEvent evt) {
117: formKeyPressed(evt);
118: }
119: });
120:
121: jPanel1
122: .setBorder(javax.swing.BorderFactory
123: .createBevelBorder(javax.swing.border.BevelBorder.RAISED));
124: jPanel1.setMaximumSize(new java.awt.Dimension(16, 16));
125: jPanel1.setMinimumSize(new java.awt.Dimension(16, 16));
126: jPanel1.setPreferredSize(new java.awt.Dimension(16, 16));
127: gridBagConstraints = new java.awt.GridBagConstraints();
128: gridBagConstraints.gridx = 0;
129: gridBagConstraints.gridy = 0;
130: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
131: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
132: add(jPanel1, gridBagConstraints);
133:
134: jPanel2.setBackground(new java.awt.Color(255, 255, 255));
135: jPanel2.setMaximumSize(new java.awt.Dimension(32767, 16));
136: jPanel2.setPreferredSize(new java.awt.Dimension(10, 16));
137: gridBagConstraints = new java.awt.GridBagConstraints();
138: gridBagConstraints.gridx = 1;
139: gridBagConstraints.gridy = 0;
140: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
141: gridBagConstraints.weightx = 1.0;
142: add(jPanel2, gridBagConstraints);
143:
144: jPanel3.setBackground(new java.awt.Color(255, 255, 255));
145: jPanel3.setMaximumSize(new java.awt.Dimension(10, 32767));
146: jPanel3.setMinimumSize(new java.awt.Dimension(16, 10));
147: jPanel3.setPreferredSize(new java.awt.Dimension(16, 10));
148: gridBagConstraints = new java.awt.GridBagConstraints();
149: gridBagConstraints.gridx = 0;
150: gridBagConstraints.gridy = 1;
151: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
152: gridBagConstraints.weighty = 1.0;
153: add(jPanel3, gridBagConstraints);
154:
155: jScrollPane1.setAutoscrolls(true);
156: jScrollPane1
157: .addFocusListener(new java.awt.event.FocusAdapter() {
158: public void focusGained(
159: java.awt.event.FocusEvent evt) {
160: jScrollPane1FocusGained(evt);
161: }
162: });
163: jScrollPane1.addKeyListener(new java.awt.event.KeyAdapter() {
164: public void keyTyped(java.awt.event.KeyEvent evt) {
165: jScrollPane1KeyTyped(evt);
166: }
167: });
168:
169: crosstabEditorPanel1.setPreferredSize(new java.awt.Dimension(
170: 1000, 1000));
171: crosstabEditorPanel1
172: .addFocusListener(new java.awt.event.FocusAdapter() {
173: public void focusGained(
174: java.awt.event.FocusEvent evt) {
175: crosstabEditorPanel1FocusGained(evt);
176: }
177: });
178: crosstabEditorPanel1
179: .addKeyListener(new java.awt.event.KeyAdapter() {
180: public void keyPressed(java.awt.event.KeyEvent evt) {
181: crosstabEditorPanel1KeyPressed(evt);
182: }
183: });
184:
185: jScrollPane1.setViewportView(crosstabEditorPanel1);
186:
187: gridBagConstraints = new java.awt.GridBagConstraints();
188: gridBagConstraints.gridx = 1;
189: gridBagConstraints.gridy = 1;
190: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
191: gridBagConstraints.weightx = 1.0;
192: gridBagConstraints.weighty = 1.0;
193: add(jScrollPane1, gridBagConstraints);
194:
195: }// </editor-fold>//GEN-END:initComponents
196:
197: private void jScrollPane1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jScrollPane1FocusGained
198:
199: }//GEN-LAST:event_jScrollPane1FocusGained
200:
201: private void formFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_formFocusGained
202:
203: }//GEN-LAST:event_formFocusGained
204:
205: private void crosstabEditorPanel1FocusGained(
206: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_crosstabEditorPanel1FocusGained
207:
208: }//GEN-LAST:event_crosstabEditorPanel1FocusGained
209:
210: private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
211:
212: }//GEN-LAST:event_formKeyPressed
213:
214: private void jScrollPane1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jScrollPane1KeyTyped
215:
216: }//GEN-LAST:event_jScrollPane1KeyTyped
217:
218: private void crosstabEditorPanel1KeyPressed(
219: java.awt.event.KeyEvent evt) {//GEN-FIRST:event_crosstabEditorPanel1KeyPressed
220:
221: }//GEN-LAST:event_crosstabEditorPanel1KeyPressed
222:
223: public void crosstabMeasureChanged(CrosstabLayoutChangedEvent evt) {
224: }
225:
226: // Variables declaration - do not modify//GEN-BEGIN:variables
227: private it.businesslogic.ireport.crosstab.gui.CrosstabEditorPanel crosstabEditorPanel1;
228: private javax.swing.JPanel jPanel1;
229: private javax.swing.JPanel jPanel2;
230: private javax.swing.JPanel jPanel3;
231: private javax.swing.JScrollPane jScrollPane1;
232: // End of variables declaration//GEN-END:variables
233:
234: }
|