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

📄 mainframe.java

📁 优秀的打印控件全源代码,类似水晶表的设计器!
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* * MainFrame.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  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 5 febbraio 2003, 12.45 */package it.businesslogic.ireport.gui;import it.businesslogic.ireport.gui.event.*;import it.businesslogic.ireport.*;import it.businesslogic.ireport.util.*;import javax.swing.tree.*;import java.util.*;import java.io.*;import javax.swing.*;import java.awt.event.*;import java.beans.PropertyVetoException;import jcmdline.*;import org.apache.xerces.parsers.DOMParser;import org.w3c.dom.*;import org.xml.sax.SAXException;/** * This class is the core of the GUI of iReport. From this class we control all * events related to the open and close files, handling of properties files, * handling JMDIDestopPane, Menus.... * * @author  Administrator */public class MainFrame extends javax.swing.JFrame implements ReportListener, Runnable, LanguageChangedListener {		public int docCounter=0;		private Thread checkModifiedFielsThread = null;	public static String constTitle = "iReport 0.3.2 ";	private String homeDirectory = ".";	private java.util.Vector toolBarControls;       	private java.util.HashMap pluginEntries;	private ElementPropertiesDialog elementPropertiesDialog;	private EventsForm eventsForm;	private ValuesDialog valuesDialog;	private GroupsDialog groupsDialog;	private BandsDialog bandsDialog;	private FontsDialog fontsDialog;	private ReportQueryDialog reportQueryDialog;	private PluginConfigurationDialog pluginConfigurationDialog = null;	        private Vector ttfFonts;	private Vector connections;	private Properties properties;	private Vector recentFilesList;	private Vector favoriteFilesList;	private Vector recentProjectsList;	private Vector clipboards[];        private it.businesslogic.ireport.ReportElement styleClipboards[];	private int activeClipboard = 0;        private int activeStyleClipboard = 0;	private boolean catchFormActivated = true;	private boolean embeddedIreport = false;                public static ReportClassLoader reportClassLoader = null;                        private static MainFrame mainInstance =  null;		private boolean dontHandleEvent;		private StringBuffer outputBuffer;		public static String IREPORT_HOME_DIR;		public static String IREPORT_USER_HOME_DIR;		public static String IREPORT_TMP_DIR;		public static String IREPORT_RECENT_FILES_FILE;		public static String IREPORT_FAVORITE_FILES_FILE;		public static String IREPORT_RECENT_PROJECTS_FILE;		public static String IREPORT_CONFIG_FILE;		public static String IREPORT_DEFAULT_HOME_DIR;		public static final int IREPORT_JAVA_VIEWER = 1;		public static final int IREPORT_PDF_VIEWER = 2;		public static final int IREPORT_HTML_VIEWER = 4;		public static final int IREPORT_XLS_VIEWER = 8;		public static final int IREPORT_CSV_VIEWER = 16;		public static final int IREPORT_JASPER_VIEWER = 32;		public static final int IREPORT_TXT_VIEWER = 64;	        /**         * Return the main instance of the MainFrame. This method assume that there is only         * one iReport instanced per JVM, so the first istance of MainFrame is the only possible.         */        public static MainFrame getMainInstance()        {            return mainInstance;        }                static {                        reportClassLoader = new ReportClassLoader();                } //end static section for simple init        /*	 *  You can override ireport home setting ireport.home variable or using line command options.	 *	 */	public void setiReportPaths(String ireport_home, String ireport_user_home, String ireport_tmp_dir) {				// Setting User home directory		if ( ireport_user_home == null) {			ireport_user_home =  System.getProperty("user.home") + File.separator + ".ireport";			IREPORT_USER_HOME_DIR = ireport_user_home;						//setHomeDirectory(Misc.nvl(System.getProperty("ireport.home"), IREPORT_DEFAULT_HOME_DIR));		}		else {			if (ireport_user_home.endsWith(File.separator)) {				ireport_user_home = ireport_user_home.substring(0, ireport_user_home.length()-1);			}			IREPORT_USER_HOME_DIR = ireport_user_home;		}								// Setting iReport directory		if ( ireport_home == null) {			ireport_home =  System.getProperty("ireport.home",".");			IREPORT_HOME_DIR = ireport_home;			setHomeDirectory(IREPORT_HOME_DIR);		}		else {			if (ireport_home.endsWith(File.separator)) {				ireport_home = ireport_home.substring(0, ireport_home.length()-1);			}			IREPORT_HOME_DIR = ireport_home;		}				// Setting temp dir...                if (IREPORT_TMP_DIR == null || IREPORT_TMP_DIR.trim().length() == 0)                {                    if ( ireport_tmp_dir == null) {                            ireport_user_home =  System.getProperty("user.home") + File.separator + ".ireport";                            IREPORT_TMP_DIR = ireport_home;                            //setHomeDirectory(Misc.nvl(System.getProperty("ireport.home"), IREPORT_DEFAULT_HOME_DIR));                    }                    else {                            if (ireport_tmp_dir.endsWith(File.separator)) {                                    ireport_tmp_dir = ireport_tmp_dir.substring(0, ireport_tmp_dir.length()-1);                            }                            IREPORT_TMP_DIR = ireport_tmp_dir;                    }                }				IREPORT_DEFAULT_HOME_DIR = IREPORT_HOME_DIR;		setHomeDirectory(IREPORT_HOME_DIR);				IREPORT_RECENT_FILES_FILE = IREPORT_USER_HOME_DIR + File.separator + "recentFiles.xml";		IREPORT_RECENT_PROJECTS_FILE = IREPORT_USER_HOME_DIR + File.separator + "recentProjects.xml";		IREPORT_FAVORITE_FILES_FILE = IREPORT_USER_HOME_DIR + File.separator + "favoriteFiles.xml";		IREPORT_CONFIG_FILE = IREPORT_USER_HOME_DIR + File.separator + "config.xml";				//System.out.println(IREPORT_DEFAULT_HOME_DIR);		//System.out.println(IREPORT_HOME_DIR);		try {			//nothing in here yet.		}		catch(Throwable e) {			e.printStackTrace(System.err);		}	} 		public MainFrame() {		this(new HashMap());	}	/** Creates new form MainFrame */	public MainFrame(Map args) {                            if (mainInstance==null)                {                    mainInstance = this;                }                		properties = new Properties();		outputBuffer = new StringBuffer();		connections = new Vector();		recentFilesList = new Vector();		favoriteFilesList = new Vector();		recentProjectsList = new Vector();                pluginEntries = new java.util.HashMap();				setiReportPaths((String)args.get("ireport-home"),		(String)args.get("user-home"),		(String)args.get("tmp-dir"));		                // Set the classloader...                                //Thread.currentThread().setContextClassLoader( reportClassLoader );                 		if (args.containsKey("config-file")) {			loadiReportConfiguration((String)args.get("config-file"));		}		else {			loadiReportConfiguration();		}				Misc.setPLAF( properties.getProperty("LookAndFeel") );		it.businesslogic.ireport.util.I18n.setCurrentLocale( properties.getProperty("Language"), properties.getProperty("Country") );		initComponents();		applyI18n();                I18n.addOnLanguageChangedListener( this );				this.ttfFonts = FontListLoader.loadTTFFonts();				if (ttfFonts == null) ttfFonts = new Vector();				System.setProperty("org.xml.sax.driver","org.apache.xerces.parsers.SAXParser");				//jMDIDesktopPane.addInternalFrameActivatedListener(this);		this.setTitle(constTitle+ " - (c) 2002-2004 by Giulio Toffoli");		toolBarControls = new java.util.Vector();				elementPropertiesDialog = new ElementPropertiesDialog(this,false);		elementPropertiesDialog.updateFonts(ttfFonts);		valuesDialog = new ValuesDialog(this,false);		groupsDialog = new GroupsDialog(this,false);		bandsDialog = new BandsDialog(this,false);		fontsDialog = new FontsDialog(this,false);		reportQueryDialog = new ReportQueryDialog(this,false);		eventsForm = new EventsForm();				jNumberComboBoxZoom.addValueChangedListener(new ValueChangedListener() {			public void valueChanged(ValueChangedEvent evt) {				jNumberComboBoxZoomValueChanged(evt);			}		});		//user pressed enter		jNumberComboBoxZoom.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent evt) {				//simulate focus lost to force zoom update				jNumberComboBoxZoom.focusLost(new FocusEvent(MainFrame.this, FocusEvent.COMPONENT_SHOWN));							}		});				jMDIDesktopPane.addInternalFrameActivatedListener(new InternalFrameActivatedListener() {			public void internalFrameActivated( InternalFrameActivatedEvent evt) {				jMDIDesktopPaneInternalFrameActivated(evt);			}

⌨️ 快捷键说明

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