/*
 * 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
 */

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 reportName;
    
    /** Creates new form ReportPropertiesFrame */
    public ReportPropertiesFrame() {
        initComponents();
        this.setSize(435,385);
        java.awt.Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Point p = new java.awt.Point();
        p.x = Math.max( 0, (dim.width -this.getWidth())/2 );
        p.y = Math.max( 0, (dim.height -this.getHeight())/2 );
        this.setLocation(p);
        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]);
        }
        
        // 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);
        
    }
    
    /** 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
        jLabel1 = new javax.swing.JLabel();
        jTextFieldName = new javax.swing.JTextField();
        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();
        jButtonOK = new javax.swing.JButton();
        jButtonCANCEL = new javax.swing.JButton();
        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();
        jPanel5 = new javax.swing.JPanel();
        jCheckBoxTitleOnNewPage = new javax.swing.JCheckBox();
        jCheckBoxSummaryOnNewPage = new javax.swing.JCheckBox();
        jComboBoxPrintOrder = new javax.swing.JComboBox();
        jComboBoxXMLEncoding = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jComboBoxWhenNoData = new javax.swing.JComboBox();

        getContentPane().setLayout(null);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Report properties");
        setName("Report properties");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText("Report name:");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(4, 12, 80, 16);

        jTextFieldName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldNameActionPerformed(evt);
            }
        });

        getContentPane().add(jTextFieldName);
        jTextFieldName.setBounds(88, 9, 222, 22);

        jPanel1.setLayout(null);

        jPanel1.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), "Page size", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 12)));
        jLabel2.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Preset sizes:");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(8, 24, 78, 16);

        jComboBoxSize.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxSize.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxSizeActionPerformed(evt);
            }
        });

        jPanel1.add(jComboBoxSize);
        jComboBoxSize.setBounds(90, 20, 200, 22);

        jComboBoxWUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxWUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxWUnitActionPerformed(evt);
            }
        });

        jPanel1.add(jComboBoxWUnit);
        jComboBoxWUnit.setBounds(214, 50, 76, 22);

        jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText("Width:");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(70, 54, 75, 16);

        jComboBoxHUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxHUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxHUnitActionPerformed(evt);
            }
        });

        jPanel1.add(jComboBoxHUnit);
        jComboBoxHUnit.setBounds(214, 80, 76, 22);

        jLabel4.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel4.setText("Height:");
        jPanel1.add(jLabel4);
        jLabel4.setBounds(70, 80, 75, 16);

        jComboBoxOrientation.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxOrientation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxOrientationActionPerformed(evt);
            }
        });

        jPanel1.add(jComboBoxOrientation);
        jComboBoxOrientation.setBounds(150, 110, 140, 22);

        jLabel5.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel5.setText("Orientation:");
        jPanel1.add(jLabel5);
        jLabel5.setBounds(70, 110, 75, 16);

        jNumberFieldWidth.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldWidth.setText("0");
        jNumberFieldWidth.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldWidthActionPerformed(evt);
            }
        });

        jPanel1.add(jNumberFieldWidth);
        jNumberFieldWidth.setBounds(154, 50, 58, 22);

        jNumberFieldHeight.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldHeight.setText("0");
        jNumberFieldHeight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldHeightActionPerformed(evt);
            }
        });

        jPanel1.add(jNumberFieldHeight);
        jNumberFieldHeight.setBounds(154, 80, 58, 22);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(8, 35, 304, 140);

        jButtonOK.setText("OK");
        jButtonOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonOKActionPerformed(evt);
            }
        });

        getContentPane().add(jButtonOK);
        jButtonOK.setBounds(340, 10, 80, 26);

        jButtonCANCEL.setText("Cancel");
        jButtonCANCEL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCANCELActionPerformed(evt);
            }
        });

        getContentPane().add(jButtonCANCEL);
        jButtonCANCEL.setBounds(340, 40, 80, 26);

        jTabbedPane1.setFont(new java.awt.Font("Dialog", 0, 12));
        jTabbedPane1.setName("");
        jPanel2.setLayout(null);

        jPanel2.setName("");
        jPanel6.setLayout(null);

        jPanel6.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), "Page margin", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 12)));
        jComboBoxTopMarginUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxTopMarginUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTopMarginUnitActionPerformed(evt);
            }
        });

        jPanel6.add(jComboBoxTopMarginUnit);
        jComboBoxTopMarginUnit.setBounds(170, 30, 75, 22);

        jLabel7.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel7.setText("Top:");
        jPanel6.add(jLabel7);
        jLabel7.setBounds(36, 30, 75, 16);

        jComboBoxBottomMarginUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxBottomMarginUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxBottomMarginUnitActionPerformed(evt);
            }
        });

        jPanel6.add(jComboBoxBottomMarginUnit);
        jComboBoxBottomMarginUnit.setBounds(170, 54, 75, 22);

        jLabel8.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText("Bottom:");
        jPanel6.add(jLabel8);
        jLabel8.setBounds(36, 54, 75, 16);

        jComboBoxLeftMarginUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxLeftMarginUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxLeftMarginUnitActionPerformed(evt);
            }
        });

        jPanel6.add(jComboBoxLeftMarginUnit);
        jComboBoxLeftMarginUnit.setBounds(170, 78, 75, 22);

        jLabel9.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Left:");
        jPanel6.add(jLabel9);
        jLabel9.setBounds(36, 78, 75, 16);

        jComboBoxRightMarginUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxRightMarginUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxRightMarginUnitActionPerformed(evt);
            }
        });

        jPanel6.add(jComboBoxRightMarginUnit);
        jComboBoxRightMarginUnit.setBounds(170, 102, 75, 22);

        jLabel10.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel10.setText("Right:");
        jPanel6.add(jLabel10);
        jLabel10.setBounds(36, 102, 75, 16);

        jNumberFieldTopMargin.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldTopMargin.setText("0");
        jNumberFieldTopMargin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldTopMarginActionPerformed(evt);
            }
        });

        jPanel6.add(jNumberFieldTopMargin);
        jNumberFieldTopMargin.setBounds(114, 30, 54, 22);

        jNumberFieldBottomMargin.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldBottomMargin.setText("0");
        jNumberFieldBottomMargin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldBottomMarginActionPerformed(evt);
            }
        });

        jPanel6.add(jNumberFieldBottomMargin);
        jNumberFieldBottomMargin.setBounds(114, 54, 54, 22);

        jNumberFieldLeftMargin.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldLeftMargin.setText("0");
        jNumberFieldLeftMargin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldLeftMarginActionPerformed(evt);
            }
        });

        jPanel6.add(jNumberFieldLeftMargin);
        jNumberFieldLeftMargin.setBounds(114, 78, 54, 22);

        jNumberFieldRightMargin.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldRightMargin.setText("0");
        jNumberFieldRightMargin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldRightMarginActionPerformed(evt);
            }
        });

        jPanel6.add(jNumberFieldRightMargin);
        jNumberFieldRightMargin.setBounds(114, 102, 54, 22);

        jPanel2.add(jPanel6);
        jPanel6.setBounds(2, 0, 292, 140);

        jTabbedPane1.addTab("tab1", jPanel2);

        jPanel3.setLayout(null);

        jPanel7.setLayout(null);

        jPanel7.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), "Report columns", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 12)));
        jLabel11.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel11.setText("Columns:");
        jPanel7.add(jLabel11);
        jLabel11.setBounds(36, 30, 75, 16);

        jComboBoxColumnsWidthUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxColumnsWidthUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxColumnsWidthUnitActionPerformed(evt);
            }
        });

        jPanel7.add(jComboBoxColumnsWidthUnit);
        jComboBoxColumnsWidthUnit.setBounds(170, 54, 75, 22);

        jLabel12.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("Width:");
        jPanel7.add(jLabel12);
        jLabel12.setBounds(36, 54, 75, 16);

        jComboBoxColumnsSpacingUnit.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxColumnsSpacingUnit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxColumnsSpacingUnitActionPerformed(evt);
            }
        });

        jPanel7.add(jComboBoxColumnsSpacingUnit);
        jComboBoxColumnsSpacingUnit.setBounds(170, 78, 75, 22);

        jLabel13.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("Spacing:");
        jPanel7.add(jLabel13);
        jLabel13.setBounds(36, 78, 75, 16);

        jNumberFieldColumnsWidth.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldColumnsWidth.setText("0");
        jNumberFieldColumnsWidth.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldColumnsWidthActionPerformed(evt);
            }
        });

        jPanel7.add(jNumberFieldColumnsWidth);
        jNumberFieldColumnsWidth.setBounds(114, 54, 54, 22);

        jNumberFieldColumnsSpacing.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldColumnsSpacing.setText("0");
        jNumberFieldColumnsSpacing.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldColumnsSpacingActionPerformed(evt);
            }
        });

        jPanel7.add(jNumberFieldColumnsSpacing);
        jNumberFieldColumnsSpacing.setBounds(114, 78, 54, 22);

        jNumberFieldColumns.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jNumberFieldColumns.setText("0");
        jNumberFieldColumns.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumberFieldColumnsActionPerformed(evt);
            }
        });

        jPanel7.add(jNumberFieldColumns);
        jNumberFieldColumns.setBounds(114, 30, 54, 22);

        jPanel3.add(jPanel7);
        jPanel7.setBounds(2, 0, 292, 140);

        jTabbedPane1.addTab("tab2", jPanel3);

        jPanel4.setLayout(null);

        jLabel6.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel6.setText("Scriptlet class");
        jPanel4.add(jLabel6);
        jLabel6.setBounds(10, 10, 110, 16);

        jTextFieldScriptletClass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldScriptletClassActionPerformed(evt);
            }
        });

        jPanel4.add(jTextFieldScriptletClass);
        jTextFieldScriptletClass.setBounds(10, 30, 278, 22);

        jTabbedPane1.addTab("tab3", jPanel4);

        jPanel5.setLayout(null);

        jCheckBoxTitleOnNewPage.setFont(new java.awt.Font("Dialog", 0, 12));
        jCheckBoxTitleOnNewPage.setText("Title on a new page");
        jCheckBoxTitleOnNewPage.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jCheckBoxTitleOnNewPage.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
        jCheckBoxTitleOnNewPage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxTitleOnNewPageActionPerformed(evt);
            }
        });

        jPanel5.add(jCheckBoxTitleOnNewPage);
        jCheckBoxTitleOnNewPage.setBounds(80, 10, 185, 24);

        jCheckBoxSummaryOnNewPage.setFont(new java.awt.Font("Dialog", 0, 12));
        jCheckBoxSummaryOnNewPage.setText("Summary on a new page");
        jCheckBoxSummaryOnNewPage.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jCheckBoxSummaryOnNewPage.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
        jCheckBoxSummaryOnNewPage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxSummaryOnNewPageActionPerformed(evt);
            }
        });

        jPanel5.add(jCheckBoxSummaryOnNewPage);
        jCheckBoxSummaryOnNewPage.setBounds(80, 30, 185, 24);

        jComboBoxPrintOrder.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxPrintOrder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxPrintOrderActionPerformed(evt);
            }
        });

        jPanel5.add(jComboBoxPrintOrder);
        jComboBoxPrintOrder.setBounds(115, 60, 150, 22);

        jComboBoxXMLEncoding.setEditable(true);
        jComboBoxXMLEncoding.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxXMLEncoding.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxXMLEncodingActionPerformed(evt);
            }
        });

        jPanel5.add(jComboBoxXMLEncoding);
        jComboBoxXMLEncoding.setBounds(115, 108, 150, 22);

        jLabel14.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel14.setText("Print order:");
        jPanel5.add(jLabel14);
        jLabel14.setBounds(10, 60, 100, 16);

        jLabel15.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel15.setText("When no data:");
        jPanel5.add(jLabel15);
        jLabel15.setBounds(10, 84, 100, 16);

        jLabel16.setFont(new java.awt.Font("Dialog", 0, 12));
        jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel16.setText("XML encoding:");
        jPanel5.add(jLabel16);
        jLabel16.setBounds(10, 108, 100, 16);

        jComboBoxWhenNoData.setFont(new java.awt.Font("Dialog", 0, 12));
        jComboBoxWhenNoData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxWhenNoDataActionPerformed(evt);
            }
        });

        jPanel5.add(jComboBoxWhenNoData);
        jComboBoxWhenNoData.setBounds(115, 84, 150, 22);

        jTabbedPane1.addTab("tab4", jPanel5);

        getContentPane().add(jTabbedPane1);
        jTabbedPane1.setBounds(10, 180, 300, 170);

        pack();
    }//GEN-END:initComponents

    private void jCheckBoxSummaryOnNewPageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxSummaryOnNewPageActionPerformed
         this.summaryOnNewPage = jCheckBoxSummaryOnNewPage.isSelected();
    }//GEN-LAST:event_jCheckBoxSummaryOnNewPageActionPerformed

    private void jComboBoxOrientationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxOrientationActionPerformed
        orientation = (String)this.jComboBoxOrientation.getSelectedItem();
    }//GEN-LAST:event_jComboBoxOrientationActionPerformed

    private void jComboBoxSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxSizeActionPerformed
        reportFormat = (String)this.jComboBoxSize.getSelectedItem();
        if( reportFormat!=null && !reportFormat.equals( "CUSTOM") ) {
            // set the Size fields.
            Point p = PageSize.getFormatSize(reportFormat);
            setReportWidth(p.x);
            setReportHeight(p.y);
        }
    }//GEN-LAST:event_jComboBoxSizeActionPerformed

    private void jComboBoxXMLEncodingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxXMLEncodingActionPerformed
        this.xmlEncoding = jComboBoxXMLEncoding.getSelectedItem()+"";
    }//GEN-LAST:event_jComboBoxXMLEncodingActionPerformed

    private void jComboBoxWhenNoDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxWhenNoDataActionPerformed
       this.whenNoDataType = jComboBoxWhenNoData.getSelectedItem()+"";
    }//GEN-LAST:event_jComboBoxWhenNoDataActionPerformed

    private void jComboBoxPrintOrderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxPrintOrderActionPerformed
        this.printOrder = jComboBoxPrintOrder.getSelectedItem()+"";
    }//GEN-LAST:event_jComboBoxPrintOrderActionPerformed

    private void jNumberFieldColumnsSpacingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldColumnsSpacingActionPerformed

                double convert = 1.0;
		convert = this.getConversionUnit(this.jComboBoxColumnsSpacingUnit);
		//int old_spacing = getColumnsSpacing();
		this.columnsSpacing  = (int)Unit.convertToPixels(jNumberFieldColumnsSpacing.getValue(),convert);
		
		int avail = getReportWidth() - getLeftMargin() - getRightMargin();
		int dim = avail;
		
		// calculate space...
		if ((this.columnsSpacing*(getColumns()-1)) > avail)
		{
                    MessageBox.show("WARNING: Column spacing too big!", "Error", MessageBox.OK | MessageBox.ICONWARNING );  
        	}
		while (dim>0 && (dim*getColumns())+(getColumnsSpacing()*(getColumns()-1)) > avail)
		{
			dim--;
		}
		
		this.setColumnsWidth(dim);
    }//GEN-LAST:event_jNumberFieldColumnsSpacingActionPerformed

    private void jNumberFieldColumnsWidthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldColumnsWidthActionPerformed
        this.columnsWidth = (int)Unit.convertToPixels(this.jNumberFieldColumnsWidth.getValue(),this.getConversionUnit(jComboBoxColumnsWidthUnit));
    }//GEN-LAST:event_jNumberFieldColumnsWidthActionPerformed

    private void jComboBoxColumnsWidthUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxColumnsWidthUnitActionPerformed
        this.adjustValue(jComboBoxColumnsWidthUnit,jNumberFieldColumnsWidth, this.getColumnsWidth() ); 
    }//GEN-LAST:event_jComboBoxColumnsWidthUnitActionPerformed

    private void jNumberFieldColumnsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldColumnsActionPerformed
        
           this.columns = (int)jNumberFieldColumns.getValue();
           // calculate space...
	   int avail = getReportWidth() - getLeftMargin() - getRightMargin() - (this.getColumns()-1)*getColumnsSpacing();
	   int dim = avail;
	   dim = (int)( (double)dim/(double)this.getColumns());
           
	   while ( (dim*this.getColumns()) > avail)
	   {
		dim--;
	   }
	   this.setColumnsWidth(dim);		
    }//GEN-LAST:event_jNumberFieldColumnsActionPerformed

    private void jComboBoxColumnsSpacingUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxColumnsSpacingUnitActionPerformed
        this.adjustValue(jComboBoxColumnsSpacingUnit,jNumberFieldColumnsSpacing, this.getColumnsSpacing() ); 
    }//GEN-LAST:event_jComboBoxColumnsSpacingUnitActionPerformed

    private void jTextFieldNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldNameActionPerformed
        this.reportName = jTextFieldName.getText().trim();
        
    }//GEN-LAST:event_jTextFieldNameActionPerformed

    private void jTextFieldScriptletClassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldScriptletClassActionPerformed
        this.scriptletClass = jTextFieldScriptletClass.getText().trim();
    }//GEN-LAST:event_jTextFieldScriptletClassActionPerformed

    private void jComboBoxTopMarginUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTopMarginUnitActionPerformed
         this.adjustValue(jComboBoxTopMarginUnit,jNumberFieldTopMargin, this.getTopMargin()); 
    }//GEN-LAST:event_jComboBoxTopMarginUnitActionPerformed

    private void jComboBoxBottomMarginUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxBottomMarginUnitActionPerformed
        this.adjustValue(jComboBoxBottomMarginUnit,jNumberFieldBottomMargin, this.getBottomMargin()); 
    }//GEN-LAST:event_jComboBoxBottomMarginUnitActionPerformed

    private void jComboBoxLeftMarginUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLeftMarginUnitActionPerformed
        this.adjustValue(jComboBoxLeftMarginUnit,jNumberFieldLeftMargin, this.getLeftMargin()); 
    }//GEN-LAST:event_jComboBoxLeftMarginUnitActionPerformed

    private void jComboBoxRightMarginUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxRightMarginUnitActionPerformed
        this.adjustValue(jComboBoxRightMarginUnit,jNumberFieldRightMargin, this.getRightMargin()); 
    }//GEN-LAST:event_jComboBoxRightMarginUnitActionPerformed

    private void jNumberFieldRightMarginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldRightMarginActionPerformed
        rightMargin = (int)Unit.convertToPixels(this.jNumberFieldRightMargin.getValue(),this.getConversionUnit(jComboBoxRightMarginUnit));
    }//GEN-LAST:event_jNumberFieldRightMarginActionPerformed

    private void jNumberFieldLeftMarginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldLeftMarginActionPerformed
        leftMargin = (int)Unit.convertToPixels(this.jNumberFieldLeftMargin.getValue(),this.getConversionUnit(jComboBoxLeftMarginUnit));
        
    }//GEN-LAST:event_jNumberFieldLeftMarginActionPerformed

    private void jNumberFieldBottomMarginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldBottomMarginActionPerformed
        bottomMargin = (int)Unit.convertToPixels(this.jNumberFieldBottomMargin.getValue(),this.getConversionUnit(jComboBoxBottomMarginUnit));
    }//GEN-LAST:event_jNumberFieldBottomMarginActionPerformed

    private void jNumberFieldTopMarginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldTopMarginActionPerformed
        topMargin = (int)Unit.convertToPixels(this.jNumberFieldTopMargin.getValue(),this.getConversionUnit(jComboBoxTopMarginUnit));
    }//GEN-LAST:event_jNumberFieldTopMarginActionPerformed

    private void jComboBoxHUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxHUnitActionPerformed
        this.adjustValue(jComboBoxHUnit,jNumberFieldHeight, this.getReportHeight()); 
    }//GEN-LAST:event_jComboBoxHUnitActionPerformed

    private void jNumberFieldHeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldHeightActionPerformed
                this.jComboBoxSize.setSelectedItem("Custom");
		reportHeight = (int)Unit.convertToPixels(this.jNumberFieldHeight.getValue(),this.getConversionUnit(jComboBoxHUnit));
    }//GEN-LAST:event_jNumberFieldHeightActionPerformed

    private void jNumberFieldWidthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldWidthActionPerformed
                this.jComboBoxSize.setSelectedItem("Custom");
		reportWidth = (int)Unit.convertToPixels(this.jNumberFieldWidth.getValue(),this.getConversionUnit(jComboBoxWUnit));
    }//GEN-LAST:event_jNumberFieldWidthActionPerformed

    private void jComboBoxWUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxWUnitActionPerformed
        this.adjustValue(jComboBoxWUnit,jNumberFieldWidth, this.getReportWidth()); 
    }//GEN-LAST:event_jComboBoxWUnitActionPerformed

    private void jCheckBoxTitleOnNewPageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxTitleOnNewPageActionPerformed
        this.titleOnNewPage = jCheckBoxTitleOnNewPage.isSelected();
    }//GEN-LAST:event_jCheckBoxTitleOnNewPageActionPerformed

    private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
        this.reportName = jTextFieldName.getText();
        this.scriptletClass = jTextFieldScriptletClass.getText();
        System.out.println("Il nome è:"+this.getReportName());
        this.setDialogResult( JOptionPane.OK_OPTION );
        this.setVisible(false);
        //this.dispose();
    }//GEN-LAST:event_jButtonOKActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
       
    }//GEN-LAST:event_formWindowOpened

    private void jButtonCANCELActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCANCELActionPerformed
         this.setDialogResult( JOptionPane.CANCEL_OPTION );
         this.dispose();
    }//GEN-LAST:event_jButtonCANCELActionPerformed
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        this.setDialogResult(  JOptionPane.CLOSED_OPTION );
        this.dispose();
    }//GEN-LAST:event_exitForm
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        new ReportPropertiesFrame().show();
    }
    
    /** Getter for property dialogResult.
     * @return Value of property dialogResult.
     *
     */
    public int getDialogResult() {
        return this.dialogResult;
    }    
 
    /** Setter for property dialogResult.
     * @param dialogResult New value of property dialogResult.
     *
     */
    public void setDialogResult(int dialogResult) {
        this.dialogResult = dialogResult;
    }    
    
    
    /**
     *  This method convert the old value in new value according with the Unit selected
     */
    public void adjustValue(javax.swing.JComboBox unitCombo, JNumberField numberField, int store_value)
    {
        try {
		if (unitCombo.getSelectedIndex() == 0)
		{
			numberField.setDecimals(0);
			numberField.setInteger(true);
			numberField.setValue(store_value);
		}
		else if (unitCombo.getSelectedIndex() == 1)
		{
			numberField.setDecimals(3);
			numberField.setInteger(false);
			numberField.setValue( Unit.convertPixelsToInches(store_value) );
		}
		else if (unitCombo.getSelectedIndex() == 2)
		{
			numberField.setDecimals(3);
			numberField.setInteger(false);
			numberField.setValue( Unit.convertPixelsToCentimeters( store_value) );
		}
		else if (unitCombo.getSelectedIndex() == 3)
		{
			numberField.setDecimals(3);
			numberField.setInteger(false);
			numberField.setValue( Unit.convertPixelsToMillimeters( store_value) );
		}
            } catch (Exception ex) {}
	}
    
    
    private double getConversionUnit(javax.swing.JComboBox comboBox)
    {
        double convert = 1.0;
	if (comboBox.getSelectedIndex() == 1) convert = Unit.INCHES;
	else if (comboBox.getSelectedIndex() == 2) convert = Unit.CENTIMETERS;
	else if (comboBox.getSelectedIndex() == 3) convert = Unit.MILLIMETERS;
        return convert;
    }
    
    /** Getter for property reportHeight.
     * @return Value of property reportHeight.
     *
     */
    public int getReportHeight() {
        return reportHeight;
    }
    
    /** Setter for property reportHeight.
     * @param reportHeight New value of property reportHeight.
     *
     */
    public void setReportHeight(int reportHeight) {
        this.reportHeight = reportHeight;
        jComboBoxHUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxHUnit,0,""));
    }
    
    /** Getter for property reportWidth.
     * @return Value of property reportWidth.
     *
     */
    public int getReportWidth() {
        return reportWidth;
    }
    
    /** Setter for property reportWidth.
     * @param reportWidth New value of property reportWidth.
     *
     */
    public void setReportWidth(int reportWidth) {
        this.reportWidth = reportWidth;
        jComboBoxWUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxWUnit,0,""));
    }
    
    /** Getter for property rightMargin.
     * @return Value of property rightMargin.
     *
     */
    public int getRightMargin() {
        return rightMargin;
    }
    
    /** Setter for property rightMargin.
     * @param rightMargin New value of property rightMargin.
     *
     */
    public void setRightMargin(int rightMargin) {
        this.rightMargin = rightMargin;
        jComboBoxRightMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxRightMarginUnit,0,""));
    }
    
    /** Getter for property topMargin.
     * @return Value of property topMargin.
     *
     */
    public int getTopMargin() {
        return topMargin;
    }
    
    /** Setter for property topMargin.
     * @param topMargin New value of property topMargin.
     *
     */
    public void setTopMargin(int topMargin) {
        this.topMargin = topMargin;
        jComboBoxTopMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxTopMarginUnit,0,""));
    }
    
    /** Getter for property leftMargin.
     * @return Value of property leftMargin.
     *
     */
    public int getLeftMargin() {
        return leftMargin;
    }
    
    /** Setter for property leftMargin.
     * @param leftMargin New value of property leftMargin.
     *
     */
    public void setLeftMargin(int leftMargin) {
        this.leftMargin = leftMargin;
        jComboBoxLeftMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxLeftMarginUnit,0,""));
    }
    
    /** Getter for property bottomMargin.
     * @return Value of property bottomMargin.
     *
     */
    public int getBottomMargin() {
        return bottomMargin;
    }
    
    /** Setter for property bottomMargin.
     * @param bottomMargin New value of property bottomMargin.
     *
     */
    public void setBottomMargin(int bottomMargin) {
        this.bottomMargin = bottomMargin;
        jComboBoxBottomMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxBottomMarginUnit,0,""));
    }
    
    /** Getter for property orientation.
     * @return Value of property orientation.
     *
     */
    public java.lang.String getOrientation() {
        return orientation;
    }
    
    /** Setter for property orientation.
     * @param orientation New value of property orientation.
     *
     */
    public void setOrientation(java.lang.String orientation) {
        jComboBoxOrientation.setSelectedItem(orientation);
        this.orientation = orientation;
    }
    
    /** Getter for property scriptletClass.
     * @return Value of property scriptletClass.
     *
     */
    public java.lang.String getScriptletClass() {
        return scriptletClass;
    }
    
    /** Setter for property scriptletClass.
     * @param scriptletClass New value of property scriptletClass.
     *
     */
    public void setScriptletClass(java.lang.String scriptletClass) {
        jTextFieldScriptletClass.setText(Misc.nvl(scriptletClass,""));
        this.scriptletClass = scriptletClass;
        
    }
    
    /** Getter for property reportName.
     * @return Value of property reportName.
     *
     */
    public java.lang.String getReportName() {
        return reportName;
    }
    
    /** Setter for property reportName.
     * @param reportName New value of property reportName.
     *
     */
    public void setReportName(java.lang.String reportName) {
        this.reportName = reportName;
        this.jTextFieldName.setText(reportName);
    }
    
    /** Getter for property columns.
     * @return Value of property columns.
     *
     */
    public int getColumns() {
        return columns;
    }
    
    /** Setter for property columns.
     * @param columns New value of property columns.
     *
     */
    public void setColumns(int columns) {
        this.columns = columns;
        try {
            jNumberFieldColumns.setValue(columns);
        } catch (Exception ex) {}
    }
    
    /** Getter for property columnsSpacing.
     * @return Value of property columnsSpacing.
     *
     */
    public int getColumnsSpacing() {
        
        return columnsSpacing;
    }
    
    /** Setter for property columnsSpacing.
     * @param columnsSpacing New value of property columnsSpacing.
     *
     */
    public void setColumnsSpacing(int columnsSpacing) {
        this.columnsSpacing = columnsSpacing;
        jComboBoxColumnsSpacingUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxColumnsSpacingUnit,0,""));
    }
    
    /** Getter for property columnsWidth.
     * @return Value of property columnsWidth.
     *
     */
    public int getColumnsWidth() {
        return columnsWidth;
    }
    
    /** Setter for property columnsWidth.
     * @param columnsWidth New value of property columnsWidth.
     *
     */
    public void setColumnsWidth(int columnsWidth) {
        this.columnsWidth = columnsWidth;
         jComboBoxColumnsWidthUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxColumnsWidthUnit,0,""));
    }
    
    /** Getter for property summaryOnNewPage.
     * @return Value of property summaryOnNewPage.
     *
     */
    public boolean isSummaryOnNewPage() {
        return summaryOnNewPage;
    }
    
    /** Setter for property summaryOnNewPage.
     * @param summaryOnNewPage New value of property summaryOnNewPage.
     *
     */
    public void setSummaryOnNewPage(boolean summaryOnNewPage) {
        jCheckBoxSummaryOnNewPage.setSelected(summaryOnNewPage);
        this.summaryOnNewPage = summaryOnNewPage;
    }
    
    /** Getter for property titleOnNewPage.
     * @return Value of property titleOnNewPage.
     *
     */
    public boolean isTitleOnNewPage() {
        return titleOnNewPage;
    }
    
    /** Setter for property titleOnNewPage.
     * @param titleOnNewPage New value of property titleOnNewPage.
     *
     */
    public void setTitleOnNewPage(boolean titleOnNewPage) {
        jCheckBoxTitleOnNewPage.setSelected(titleOnNewPage);
        this.titleOnNewPage = titleOnNewPage;
    }
    
    /** Getter for property whenNoDataType.
     * @return Value of property whenNoDataType.
     *
     */
    public java.lang.String getWhenNoDataType() {
        return whenNoDataType;
    }
    
    /** Setter for property whenNoDataType.
     * @param whenNoDataType New value of property whenNoDataType.
     *
     */
    public void setWhenNoDataType(java.lang.String whenNoDataType) {
        jComboBoxWhenNoData.setSelectedItem(whenNoDataType);
        this.whenNoDataType = whenNoDataType;
    }
    
    /** Getter for property xmlEncoding.
     * @return Value of property xmlEncoding.
     *
     */
    public java.lang.String getXmlEncoding() {
        return xmlEncoding;
    }
    
    /** Setter for property xmlEncoding.
     * @param xmlEncoding New value of property xmlEncoding.
     *
     */
    public void setXmlEncoding(java.lang.String xmlEncoding) {
        this.jComboBoxXMLEncoding.setSelectedItem(xmlEncoding);
        this.xmlEncoding = xmlEncoding;
    }
    
    /** Getter for property globalUnit.
     * @return Value of property globalUnit.
     *
     */
    public int getGlobalUnit() {
        return globalUnit;
    }
    
    /** Setter for property globalUnit.
     * @param globalUnit New value of property globalUnit.
     *
     */
    public void setGlobalUnit(int globalUnit) {
        if ( this.globalUnit != globalUnit)
        {
            this.globalUnit = globalUnit;
            jComboBoxWUnit.setSelectedIndex(globalUnit);
            jComboBoxHUnit.setSelectedIndex(globalUnit);
            jComboBoxTopMarginUnit.setSelectedIndex(globalUnit);
            jComboBoxBottomMarginUnit.setSelectedIndex(globalUnit);
            jComboBoxLeftMarginUnit.setSelectedIndex(globalUnit);
            jComboBoxRightMarginUnit.setSelectedIndex(globalUnit);
            jComboBoxColumnsSpacingUnit.setSelectedIndex(globalUnit);
            jComboBoxColumnsWidthUnit.setSelectedIndex(globalUnit);
            
        }
    }
    
    /** Getter for property printOrder.
     * @return Value of property printOrder.
     *
     */
    public java.lang.String getPrintOrder() {
        return printOrder;
    }
    
    /** Setter for property printOrder.
     * @param printOrder New value of property printOrder.
     *
     */
    public void setPrintOrder(java.lang.String printOrder) {
        jComboBoxPrintOrder.setSelectedItem(printOrder);
        this.printOrder = printOrder;
    }
    
    /** Getter for property reportFormat.
     * @return Value of property reportFormat.
     *
     */
    public java.lang.String getReportFormat() {
        return reportFormat;
    }
    
    /** Setter for property reportFormat.
     * @param reportFormat New value of property reportFormat.
     *
     */
    public void setReportFormat(java.lang.String reportFormat) {
        this.reportFormat = reportFormat;
        this.jComboBoxSize.setSelectedItem(reportFormat);
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jTextFieldName;
    private javax.swing.JComboBox jComboBoxLeftMarginUnit;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldWidth;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldTopMargin;
    private javax.swing.JComboBox jComboBoxColumnsSpacingUnit;
    private javax.swing.JComboBox jComboBoxOrientation;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldRightMargin;
    private javax.swing.JLabel jLabel14;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldColumns;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldLeftMargin;
    private javax.swing.JLabel jLabel9;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldBottomMargin;
    private javax.swing.JComboBox jComboBoxHUnit;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JComboBox jComboBoxTopMarginUnit;
    private javax.swing.JComboBox jComboBoxPrintOrder;
    private javax.swing.JButton jButtonCANCEL;
    private javax.swing.JComboBox jComboBoxXMLEncoding;
    private javax.swing.JTextField jTextFieldScriptletClass;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JComboBox jComboBoxWUnit;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JComboBox jComboBoxColumnsWidthUnit;
    private javax.swing.JCheckBox jCheckBoxTitleOnNewPage;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JComboBox jComboBoxRightMarginUnit;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JComboBox jComboBoxWhenNoData;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JCheckBox jCheckBoxSummaryOnNewPage;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JLabel jLabel2;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldHeight;
    private javax.swing.JPanel jPanel2;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldColumnsSpacing;
    private javax.swing.JPanel jPanel5;
    private it.businesslogic.ireport.gui.JNumberField jNumberFieldColumnsWidth;
    private javax.swing.JComboBox jComboBoxSize;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JButton jButtonOK;
    private javax.swing.JComboBox jComboBoxBottomMarginUnit;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel10;
    // End of variables declaration//GEN-END:variables

    private int columns;    

    private int columnsWidth;    

    private int columnsSpacing;    
    
    private boolean titleOnNewPage;
    
    private boolean summaryOnNewPage;
    
    private String printOrder;
    
    private String whenNoDataType;
    
    private String xmlEncoding;
    
    private int globalUnit = 0;
    
    private String reportFormat;
    
}
