📄 reportpropertiesframe.java
字号:
/*
* ReportPropertiesFrame.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 8 febbraio 2003, 16.25
*
* - Orientation influences width and height
* - Select of preset size respects orientation
* - Changing width or height influences Orientation
*/
package it.businesslogic.ireport.gui;
import it.businesslogic.ireport.util.*;
import javax.swing.*;
import java.awt.Point;
/**
*
* @author Administrator
*/
public class ReportPropertiesFrame extends javax.swing.JDialog {
private it.businesslogic.ireport.util.Unit[] units;
/** Holds value of property dialogResult. */
private int dialogResult;
private int reportWidth;
private int reportHeight;
private int topMargin;
private int leftMargin;
private int bottomMargin;
private int rightMargin;
private String orientation;
private String scriptletClass;
private String resourceBundleBaseName;
private String reportName;
private int reportHandling = 0;
private boolean floatColumnFooter = false;
/** Creates new form ReportPropertiesFrame */
public ReportPropertiesFrame(java.awt.Frame parent, boolean modal) {
super(parent,modal);
initComponents();
units = it.businesslogic.ireport.util.Unit.getStandardUnits();
// Setting compobox contents...
for (int i=0; i< units.length; ++i) {
jComboBoxWUnit.addItem(units[i]);
jComboBoxHUnit.addItem(units[i]);
jComboBoxTopMarginUnit.addItem(units[i]);
jComboBoxBottomMarginUnit.addItem(units[i]);
jComboBoxLeftMarginUnit.addItem(units[i]);
jComboBoxRightMarginUnit.addItem(units[i]);
jComboBoxColumnsWidthUnit.addItem(units[i]);
jComboBoxColumnsSpacingUnit.addItem(units[i]);
}
jComboBoxScriptletHandling.addItem("Don't use scriptlet");
jComboBoxScriptletHandling.addItem("Use iReport internal scriptlet support");
jComboBoxScriptletHandling.addItem("Use this scriptlet class...");
// Set right names to tabs...
this.jTabbedPane1.setTitleAt(0, "Page Margin");
this.jTabbedPane1.setTitleAt(1, "Columns");
this.jTabbedPane1.setTitleAt(2, "Scriptlet");
this.jTabbedPane1.setTitleAt(3, "More...");
this.jComboBoxSize.addItem("Custom");
this.jComboBoxSize.addItem("LETTER");
this.jComboBoxSize.addItem("NOTE");
this.jComboBoxSize.addItem("LEGAL");
this.jComboBoxSize.addItem("A0");
this.jComboBoxSize.addItem("A1");
this.jComboBoxSize.addItem("A2");
this.jComboBoxSize.addItem("A3");
this.jComboBoxSize.addItem("A4");
this.jComboBoxSize.addItem("A5");
this.jComboBoxSize.addItem("A6");
this.jComboBoxSize.addItem("A7");
this.jComboBoxSize.addItem("A8");
this.jComboBoxSize.addItem("A9");
this.jComboBoxSize.addItem("A10");
this.jComboBoxSize.addItem("B0");
this.jComboBoxSize.addItem("B1");
this.jComboBoxSize.addItem("B2");
this.jComboBoxSize.addItem("B3");
this.jComboBoxSize.addItem("B4");
this.jComboBoxSize.addItem("B5");
this.jComboBoxSize.addItem("ARCH_E");
this.jComboBoxSize.addItem("ARCH_D");
this.jComboBoxSize.addItem("ARCH_C");
this.jComboBoxSize.addItem("ARCH_B");
this.jComboBoxSize.addItem("ARCH_A");
this.jComboBoxSize.addItem("FLSA");
this.jComboBoxSize.addItem("FLSE");
this.jComboBoxSize.addItem("HALFLETTER");
this.jComboBoxSize.addItem("11x17");
this.jComboBoxSize.addItem("LEDGER");
this.jComboBoxOrientation.addItem("Portrait");
this.jComboBoxOrientation.addItem("Landscape");
this.jComboBoxPrintOrder.addItem("Vertical");
this.jComboBoxPrintOrder.addItem("Horizontal");
this.jComboBoxWhenNoData.addItem("NoPages");
this.jComboBoxWhenNoData.addItem("BlankPage");
this.jComboBoxWhenNoData.addItem("AllSectionsNoDetail");
this.jComboBoxXMLEncoding.addItem("UTF-8");
this.jComboBoxXMLEncoding.addItem("ISO-8859-1");
// ********** Setting defaults ***************
this.jComboBoxPrintOrder.setSelectedItem("Vertical");
this.jComboBoxWhenNoData.setSelectedItem("NoPages");
this.jComboBoxXMLEncoding.setSelectedItem("UTF-8");
this.setReportFormat("A4");
this.setReportName("Untitled_report_1");
this.setReportWidth( PageSize.A4.x);
this.setReportHeight( PageSize.A4.y);
this.setTopMargin(20);
this.setBottomMargin(20);
this.setLeftMargin(30);
this.setRightMargin(30);
this.setColumns(1);
this.setColumnsSpacing(0);
this.setColumnsWidth(getReportWidth() - getLeftMargin() - getRightMargin());
jComboBoxWUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxWUnit,0,""));
jComboBoxHUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxHUnit,0,""));
setGlobalUnit(2);
applyI18n();
pack();
}
/** 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;
jPanel8 = new javax.swing.JPanel();
jButtonOK = new javax.swing.JButton();
jButtonCANCEL = new javax.swing.JButton();
jPanel10 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jComboBoxSize = new javax.swing.JComboBox();
jComboBoxWUnit = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
jComboBoxHUnit = new javax.swing.JComboBox();
jLabel4 = new javax.swing.JLabel();
jComboBoxOrientation = new javax.swing.JComboBox();
jLabel5 = new javax.swing.JLabel();
jNumberFieldWidth = new it.businesslogic.ireport.gui.JNumberField();
jNumberFieldHeight = new it.businesslogic.ireport.gui.JNumberField();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jPanel6 = new javax.swing.JPanel();
jComboBoxTopMarginUnit = new javax.swing.JComboBox();
jLabel7 = new javax.swing.JLabel();
jComboBoxBottomMarginUnit = new javax.swing.JComboBox();
jLabel8 = new javax.swing.JLabel();
jComboBoxLeftMarginUnit = new javax.swing.JComboBox();
jLabel9 = new javax.swing.JLabel();
jComboBoxRightMarginUnit = new javax.swing.JComboBox();
jLabel10 = new javax.swing.JLabel();
jNumberFieldTopMargin = new it.businesslogic.ireport.gui.JNumberField();
jNumberFieldBottomMargin = new it.businesslogic.ireport.gui.JNumberField();
jNumberFieldLeftMargin = new it.businesslogic.ireport.gui.JNumberField();
jNumberFieldRightMargin = new it.businesslogic.ireport.gui.JNumberField();
jPanel3 = new javax.swing.JPanel();
jPanel7 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jComboBoxColumnsWidthUnit = new javax.swing.JComboBox();
jLabel12 = new javax.swing.JLabel();
jComboBoxColumnsSpacingUnit = new javax.swing.JComboBox();
jLabel13 = new javax.swing.JLabel();
jNumberFieldColumnsWidth = new it.businesslogic.ireport.gui.JNumberField();
jNumberFieldColumnsSpacing = new it.businesslogic.ireport.gui.JNumberField();
jNumberFieldColumns = new it.businesslogic.ireport.gui.JNumberField();
jPanel4 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
jTextFieldScriptletClass = new javax.swing.JTextField();
jComboBoxScriptletHandling = new javax.swing.JComboBox();
jPanel5 = new javax.swing.JPanel();
jCheckBoxTitleOnNewPage = new javax.swing.JCheckBox();
jCheckBoxSummaryOnNewPage = new javax.swing.JCheckBox();
jComboBoxPrintOrder = new javax.swing.JComboBox();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jComboBoxWhenNoData = new javax.swing.JComboBox();
jCheckBoxFloatColumnFooter = new javax.swing.JCheckBox();
jPanel11 = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
jTextFieldResourceBundleBaseName = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
jComboBoxXMLEncoding = new javax.swing.JComboBox();
jPanel12 = new javax.swing.JPanel();
jPanel9 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTextFieldName = new javax.swing.JTextField();
getContentPane().setLayout(new java.awt.GridBagLayout());
setTitle("Report properties");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setName("Report properties");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel8.setLayout(new java.awt.GridBagLayout());
jButtonOK.setText("OK");
jButtonOK.setMaximumSize(new java.awt.Dimension(200, 26));
jButtonOK.setMinimumSize(new java.awt.Dimension(150, 26));
jButtonOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonOKActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 5, 3);
jPanel8.add(jButtonOK, gridBagConstraints);
jButtonCANCEL.setText("Cancel");
jButtonCANCEL.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonCANCELActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -