⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jreportframe.java

📁 iReport-0.4.1-src是iReport的源代码,iReport是一个开源的报表项目,可以生成PDF等格式报表
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * JReportFrame.java
 *
 * iReport  --  Visual designer for generating JasperReports Documents
 *  Copyright (C) 2002-2003  Giulio Toffoli gt@businesslogic.it
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  Giulio Toffoli
 *  Via T.Aspetti, 233
 *  35100 Padova ITALY
 *  gt@businesslogic.it
 *
 * Created on 12 febbraio 2003, 21.51
 *
 * Updated 13 July 2004, Robert Lamping,
 * - added: getNextElementKey(String keyElement)
 * - updated: paste(): Copied elements will get a modified key value based on previous
 *  prefix + "-"  + <next highest number for that prefix>.
 * -updated: jPanelReportMouseReleased
 *   new elements get the same treatment.
 *   new elements now get there own specific name
 
 
 */

package it.businesslogic.ireport.gui;
import it.businesslogic.ireport.gui.event.*;
import it.businesslogic.ireport.undo.*;
import it.businesslogic.ireport.util.*;
import it.businesslogic.ireport.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
/**
 *
 * @author  Administrator
 */
public class JReportFrame extends JMDIFrame {
    
    static int id = 0;
    static java.awt.Cursor hsplit = null;
    //private Graphics2D offscreen = null;
    //private Graphics2D offscreenDoc = null;
    //private BufferedImage offscreenImage = null;
    //private BufferedImage offscreenImageDoc = null;
    private int offscreenWidth = 0;
    private Dimension offscreenDimension = null;
    private boolean isDocDirty = true;
    
    private MainFrame mf = null;
    private BufferedImage[] shadowsImages = null;
    
    /** This point rappresent coords of left top corner of the popup menu.... */
    private java.awt.Point popup_opened_at = null;
    
    /** true if the the user is trnsforming a new element....*/
    private boolean transforming = false;
    
    /** We are dragging a band ?  */
    boolean band_dragging=false;
    /** We have started to drag a band from here */
    int band_dragging_origin=0;
    /** We are dragging this band... */
    Band band_dragging_band=null;
    /** State for XOR operation in band dragging... */
    boolean first_draw_band=true;
    boolean firstXORDraw = false ; //= false;   // why not true?
    boolean firstXORDrawTransforming = false;
    
    /**
     * This flag is true if we are selecting elements drawing a rectangle...
     */
    private boolean drag_selection_mode = false;
    /**
     * The origin of the selection rectangle...
     */
    private java.awt.Point drag_selection_origin = null;
    /**
     * The end of the selection rectangle...
     */
    private java.awt.Point drag_selection_end = null;
    /**
     * The flag is used to handle XOR operation on rectangle selection
     */
    private boolean first_draw_selection_rect = true;
    
    /**
     * Stroke to use when draw selection rectangle
     */
    private java.awt.Stroke selectionStroke = null;
    
    // Menus...
    private javax.swing.JMenu jMenuAlign;
    private javax.swing.JMenuItem jMenuItemAlignLeft;
    private javax.swing.JMenuItem jMenuItemAlignRight;
    private javax.swing.JMenuItem jMenuItemAlignTop;
    private javax.swing.JMenuItem jMenuItemAlignBottom;
    private javax.swing.JSeparator jSeparator19;
    private javax.swing.JMenuItem jMenuItemAlignVerticalAxis;
    private javax.swing.JMenuItem jMenuItemAlignHorizontalAxis ;
    private javax.swing.JSeparator jSeparator20;
    private javax.swing.JMenuItem jMenuItemAlignToBandTop;
    private javax.swing.JMenuItem jMenuItemAlignToBandBottom;
    private javax.swing.JMenu jMenuSize;
    private javax.swing.JMenuItem jMenuItemSameWidth;
    private javax.swing.JMenuItem jMenuItemSameWidthMax;
    private javax.swing.JMenuItem jMenuItemSameWidthMin;
    private javax.swing.JSeparator jSeparator17;
    private javax.swing.JMenuItem jMenuItemSameHeight;
    private javax.swing.JMenuItem jMenuItemSameHeightMax;
    private javax.swing.JMenuItem jMenuItemSameHeightMin;
    private javax.swing.JSeparator jSeparator18;
    private javax.swing.JMenuItem jMenuItemSameSize;
    private javax.swing.JMenu jMenuPosition;
    private javax.swing.JMenuItem jMenuItemCenterH;
    private javax.swing.JMenuItem jMenuItemCenterV;
    private javax.swing.JMenuItem jMenuItemCenterInBand;
    private javax.swing.JMenuItem jMenuItemCenterBackground;
    private javax.swing.JMenuItem jMenuItemJoinLeft;
    private javax.swing.JMenuItem jMenuItemJoinRight;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JMenuItem jMenuHSpacing;
    private javax.swing.JMenuItem jMenuItemHSMakeEqual;
    private javax.swing.JMenuItem jMenuItemHSIncrease;
    private javax.swing.JMenuItem jMenuItemHSDecrease;
    private javax.swing.JMenuItem jMenuItemHSRemove;
    private javax.swing.JMenuItem jMenuVSpacing;
    private javax.swing.JMenuItem jMenuItemVSMakeEqual;
    private javax.swing.JMenuItem jMenuItemVSIncrease;
    private javax.swing.JMenuItem jMenuItemVSDecrease;
    private javax.swing.JMenuItem jMenuItemVSRemove;
    private javax.swing.JSeparator jSeparator8;
    private javax.swing.JMenuItem jMenuItemBringToFront;
    private javax.swing.JMenuItem jMenuItemSendToBack;
    private javax.swing.JPopupMenu jPopupMenuElementMS;
    private javax.swing.JMenuItem jMenuItemOrganize;
    private javax.swing.JMenuItem jMenuItemRightMargin;
    private javax.swing.JMenuItem jMenuItemLeftMargin;
    
    
    
    /*
     *  This variable is used to say if the resistence moving an element with mouse was
     *  exceeded
     */
    boolean resistenceExceeded = false;
    
    Point newObjectOrigin = null;
    
    boolean trasforming = false;
    int transformation_type= -1;
    Point transformation_origin=null;
    Point transformation_origin_end=null;
    Point transformation_undo_delta=null;
    
    /** Creates new form JReportFrame */
    public JReportFrame(Report report) {
        initComponents();
        jPanelReportContainer.setIgnoreRepaint(true);
        addFormatItemsToMenu(jPopupMenuElement);
        this.windowID = id++;
        
        selectionStroke = new java.awt.BasicStroke(
        (float)(2f),
        java.awt.BasicStroke.CAP_BUTT,
        java.awt.BasicStroke.JOIN_BEVEL,
        0f,
        new float[]{5f, 3f},
        0f
        );
        this.setPreferredSize(new Dimension(350,400));
        this.setNormalSize(new Dimension(350,400));
        if (hsplit == null) {
            hsplit = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
        }
        this.jPanelReport.setJrf(this);
        this.report = report;
        
        this.newObjectType = ReportElementType.NONE;
        this.report=report;
        this.report.setReportFrame(this);
        this.setTitle(this.report.getName()+" "+this.report.getWidth()+"x"+this.report.getDesignHeight()+" ["+Misc.nvl(this.report.getFilename(),"unnamed")+"]");
        System.out.println(this.getTitle());
        
        undoOperations = new Vector();
        clipboardObjects = new  Vector();
        selectedElements = new Vector();
        transformation_undo_delta = new Point(0,0);
        
        zoomFactor = 1.0;
        gridSize = 10;
        transformationMinSize =5;
        
        undoIndex = -1;
        
        // Init images...
        shadowsImages = new BufferedImage[5];
        
        shadowsImages[0] = Misc.loadBufferedImageFromResources(this,"it/businesslogic/ireport/icons/layout/sh_ur.gif");
        shadowsImages[1] = Misc.loadBufferedImageFromResources(this,"it/businesslogic/ireport/icons/layout/sh_r.gif");
        shadowsImages[2] = Misc.loadBufferedImageFromResources(this,"it/businesslogic/ireport/icons/layout/sh_lr.gif");
        shadowsImages[3] = Misc.loadBufferedImageFromResources(this,"it/businesslogic/ireport/icons/layout/sh_d.gif");
        shadowsImages[4] = Misc.loadBufferedImageFromResources(this,"it/businesslogic/ireport/icons/layout/sh_dl.gif");
        
        /*
        try {
            cursorplus = new Cursor(ResourceManager.getResource( getClass(), "cursorplus.cur"));
            cursorminus = new Cursor( ResourceManager.getResource(getClass(), "cursorminus.cur"));
        } catch (Exception ex)
        {}
         
        if (cursorplus == null )
        {
                if (com.ms.wfc.io.File.exists(com.ms.wfc.io.File.combine(  getProgramDir(), "com\\businesslogic\\ireport\\ui\\cursorplus.cur")))
                cursorplus = new Cursor(com.ms.wfc.io.File.combine(  getProgramDir(), "com\\businesslogic\\ireport\\ui\\cursorplus.cur"));
        }
         
        if (cursorminus == null )
        {
                if (com.ms.wfc.io.File.exists(com.ms.wfc.io.File.combine(  getProgramDir(), "com\\businesslogic\\ireport\\ui\\cursorminus.cur")))
                        cursorminus = new Cursor( com.ms.wfc.io.File.combine(  getProgramDir(), "com\\businesslogic\\ireport\\ui\\cursorminus.cur"));
        }
         
        if (cursorplus == null)
                cursorplus = Cursor.CROSS;
        if (cursorminus == null)
                cursorminus = Cursor.CROSS;
         */
        /*
        Enumeration enum = report.getElements().elements();
        Brush br = new Brush(imageList2.getBitmap(0));
        while (enum.hasMoreElements())
        {
                ReportElement re = (ReportElement)enum.nextElement();
                re.hached = br;
         
                if (re instanceof SubReportElement)
                {
                        ((SubReportElement)re).img = this.imageList4.getImage(0);
                }
                else if (re instanceof  ImageReportElement )
                {
         
                        ((ImageReportElement)re).defimg  = imageList3.getBitmap(0);
                }
                }
         */
        
        //offscreen.setBackground(new Color(128,128,128));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -