jrvariabledialog.java

来自「优秀的打印控件全源代码,类似水晶表的设计器!」· Java 代码 · 共 486 行 · 第 1/2 页

JAVA
486
字号
/* * JRParameterDialog.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 9 maggio 2003, 17.25 */package it.businesslogic.ireport.gui;import it.businesslogic.ireport.util.*;import it.businesslogic.ireport.*;/** * * @author  Administrator */public class JRVariableDialog extends javax.swing.JDialog {    /** Creates new form JRParameterDialog */    JRVariable tmpVariable = null;        Report report = null;        public JRVariableDialog(Report report, java.awt.Frame parent, boolean modal) {                super(parent, modal);        initComponents();                this.report = report;        updateGroups();                this.jRTextExpressionAreaExpression.setText("");        this.jRTextExpressionAreaInitialExpression.setText("");        setTypes();                       this.jComboBoxClassType.setSelectedItem("java.lang.String");        this.jComboBoxCalculationType.setSelectedItem("Nothing");        this.jComboBoxResetType.setSelectedItem("Report");                updateGroups();	pack();    }        public void setTypes()    {        this.jComboBoxClassType.addItem("java.lang.String");        this.jComboBoxClassType.addItem("java.lang.Object");        this.jComboBoxClassType.addItem("java.lang.Boolean");        this.jComboBoxClassType.addItem("java.lang.Byte");        this.jComboBoxClassType.addItem("java.util.Date");        this.jComboBoxClassType.addItem("java.sql.Timestamp");        this.jComboBoxClassType.addItem("java.sql.Time");        this.jComboBoxClassType.addItem("java.lang.Double");        this.jComboBoxClassType.addItem("java.lang.Float");        this.jComboBoxClassType.addItem("java.lang.Integer");        this.jComboBoxClassType.addItem("java.io.InputStream");        this.jComboBoxClassType.addItem("java.lang.Long");        this.jComboBoxClassType.addItem("java.lang.Short");        this.jComboBoxClassType.addItem("java.math.BigDecimal");        this.jComboBoxClassType.addItem("dori.jasper.engine.JREmptyDataSource");                this.jComboBoxCalculationType.addItem("Nothing");        this.jComboBoxCalculationType.addItem("Count");        this.jComboBoxCalculationType.addItem("Sum");        this.jComboBoxCalculationType.addItem("Average");        this.jComboBoxCalculationType.addItem("Lowest");        this.jComboBoxCalculationType.addItem("Highest");        this.jComboBoxCalculationType.addItem("StandardDeviation");        this.jComboBoxCalculationType.addItem("Variance");        this.jComboBoxCalculationType.addItem("System");                this.jComboBoxResetType.addItem("None");        this.jComboBoxResetType.addItem("Report");        this.jComboBoxResetType.addItem("Page");        this.jComboBoxResetType.addItem("Column");        this.jComboBoxResetType.addItem("Group");    }        public void updateGroups()    {        if (getReport() != null)        {            Misc.updateStringComboBox( jComboBoxResetGroup , getReport().getGroups(), true );        }        else        {            jComboBoxResetGroup.removeAllItems();            jComboBoxResetGroup.addItem("");        }    }    /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */        private void initComponents() {//GEN-BEGIN:initComponents                java.awt.GridBagConstraints gridBagConstraints;                jLabel1 = new javax.swing.JLabel();                jTextFieldName = new javax.swing.JTextField();                jLabel2 = new javax.swing.JLabel();                jComboBoxResetGroup = new javax.swing.JComboBox();                jLabel3 = new javax.swing.JLabel();                jLabel4 = new javax.swing.JLabel();                jLabel5 = new javax.swing.JLabel();                jComboBoxResetType = new javax.swing.JComboBox();                jComboBoxCalculationType = new javax.swing.JComboBox();                jLabel6 = new javax.swing.JLabel();                jComboBoxClassType = new javax.swing.JComboBox();                jLabel7 = new javax.swing.JLabel();                jRTextExpressionAreaInitialExpression = new it.businesslogic.ireport.gui.JRTextExpressionArea();                jRTextExpressionAreaExpression = new it.businesslogic.ireport.gui.JRTextExpressionArea();                jLabel8 = new javax.swing.JLabel();                jTextFieldNameIncrementerFactoryClass = new javax.swing.JTextField();                jPanel1 = new javax.swing.JPanel();                jButtonOK = new javax.swing.JButton();                jButtonCancel = new javax.swing.JButton();                getContentPane().setLayout(new java.awt.GridBagLayout());                setTitle("Add/modify variable");                setResizable(false);                setModal(true);                addWindowListener(new java.awt.event.WindowAdapter() {                        public void windowClosing(java.awt.event.WindowEvent evt) {                                closeDialog(evt);                        }                });                jLabel1.setFont(new java.awt.Font("Dialog", 0, 11));                jLabel1.setText("Variable name");                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 0;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jLabel1, gridBagConstraints);                jTextFieldName.setFont(new java.awt.Font("Dialog", 0, 11));                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 1;                gridBagConstraints.gridwidth = 3;                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jTextFieldName, gridBagConstraints);                jLabel2.setFont(new java.awt.Font("Dialog", 0, 11));                jLabel2.setText("Calculation type");                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 1;                gridBagConstraints.gridy = 2;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jLabel2, gridBagConstraints);                jComboBoxResetGroup.setFont(new java.awt.Font("Dialog", 0, 11));                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 1;                gridBagConstraints.gridy = 5;                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jComboBoxResetGroup, gridBagConstraints);                jLabel3.setFont(new java.awt.Font("Dialog", 0, 11));                jLabel3.setText("Variable expression");                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 8;                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                getContentPane().add(jLabel3, gridBagConstraints);                jLabel4.setFont(new java.awt.Font("Dialog", 0, 11));                jLabel4.setText("Initial value expression");                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 10;                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                getContentPane().add(jLabel4, gridBagConstraints);                jLabel5.setFont(new java.awt.Font("Dialog", 0, 11));                jLabel5.setText("Variable class type");                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 2;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jLabel5, gridBagConstraints);                jComboBoxResetType.setFont(new java.awt.Font("Dialog", 0, 11));                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 5;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jComboBoxResetType, gridBagConstraints);                jComboBoxCalculationType.setFont(new java.awt.Font("Dialog", 0, 11));                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 1;                gridBagConstraints.gridy = 3;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jComboBoxCalculationType, gridBagConstraints);                jLabel6.setFont(new java.awt.Font("Dialog", 0, 11));                jLabel6.setText("Reset group");                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 1;                gridBagConstraints.gridy = 4;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;                getContentPane().add(jLabel6, gridBagConstraints);                jComboBoxClassType.setEditable(true);                jComboBoxClassType.setFont(new java.awt.Font("Dialog", 0, 11));                gridBagConstraints = new java.awt.GridBagConstraints();                gridBagConstraints.gridx = 0;                gridBagConstraints.gridy = 3;                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);

⌨️ 快捷键说明

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