📄 wizarddialog.java
字号:
/*
* WizardDialog.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
*
*
* How this window work.
* This form has an attribute that rappresents the JReportForm active.
* If the jrf is null, this frame hides.
* When something changes, the program can call "updateSelection". This
* class retrive from jrf the selected elements and update all
* interface.
*
* Created on 30 giugno 2003, 18.26
*/
package it.businesslogic.ireport.gui;
import it.businesslogic.ireport.util.*;
import it.businesslogic.ireport.*;
import it.businesslogic.ireport.connection.*;
import java.sql.*;
import java.util.*;
import java.io.*;
/**
*
* @author Administrator
*/
public class WizardDialog extends javax.swing.JDialog implements Runnable {
Thread t = null;
File[] templates = null;
org.syntax.jedit.JEditTextArea jRSQLExpressionArea1 = null;
/** Creates new form WizardDialog */
public WizardDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
jRSQLExpressionArea1 = new org.syntax.jedit.JEditTextArea();
jRSQLExpressionArea1.getPainter().setLineHighlightColor(java.awt.Color.WHITE);
jRSQLExpressionArea1.setDocument(new org.syntax.jedit.SyntaxDocument());
jRSQLExpressionArea1.setTokenMarker(new org.syntax.jedit.tokenmarker.TSQLTokenMarker());
jRSQLExpressionArea1.setAutoscrolls(true);
java.awt.GridBagConstraints gridBagConstraints= null;
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
//gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
jPanel1.add(jRSQLExpressionArea1, gridBagConstraints);
wzStep = 1;
this.setStep(wzStep,wzStep);
this.setSize(470, 340);
Misc.centerFrame(this);
this.jRSQLExpressionArea1.getDocument().addDocumentListener( new javax.swing.event.DocumentListener() {
public void changedUpdate(javax.swing.event.DocumentEvent evt)
{
jRSQLExpressionArea1TextConnectionExpressionTextChanged();
}
public void insertUpdate(javax.swing.event.DocumentEvent evt) {
jRSQLExpressionArea1TextConnectionExpressionTextChanged();
}
public void removeUpdate(javax.swing.event.DocumentEvent evt) {
jRSQLExpressionArea1TextConnectionExpressionTextChanged();
}
});
this.jRSQLExpressionArea1.requestFocusInWindow();
jList1.setModel(new javax.swing.DefaultListModel());
jList2.setModel(new javax.swing.DefaultListModel());
jList3.setModel(new javax.swing.DefaultListModel());
jComboBoxTemplates.addItem("Columnar");
jComboBoxTemplates.addItem("Tabular");
String templates_dir = MainFrame.IREPORT_HOME_DIR; //System.getProperty("ireport.home",".");
templates_dir += File.separator + "templates";
//System.out.println("Templates: " + templates_dir);
//C:\\documenti\\progetti\\ireport\\iReport2\\templates
File f = new File(templates_dir);
if (f.exists() && f.isDirectory())
{
templates = f.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name)
{
if (name.endsWith("T.xml") || name.endsWith("C.xml"))
{
return true;
}
return false;
}
});
}
else
{
templates_dir = MainFrame.IREPORT_HOME_DIR; //System.getProperty("ireport.home",".");
templates_dir += File.separator + "etc" + File.separator + "templates";
f = new File(templates_dir);
if (f.exists() && f.isDirectory())
{
templates = f.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name)
{
if (name.endsWith("T.xml") || name.endsWith("C.xml"))
{
return true;
}
return false;
}
});
}
}
if (templates == null)
{
templates = new File[0];
}
jComboBoxTemplates.setSelectedIndex(0);
//jRSQLExpressionArea1.setText("00000000000000000000000000000000000000000000000000000\n\r");
//this.pack();
}
private int wzStep=0;
public void updateTemplatesList()
{
if (templates == null) return;
((javax.swing.DefaultListModel)jList3.getModel()).removeAllElements();
for (int i=0; i<templates.length; ++i)
{
if (jComboBoxTemplates.getItemCount()<2 || (jComboBoxTemplates.getSelectedIndex() == 0 && !templates[i].getName().endsWith("C.xml")) ) continue;
if (jComboBoxTemplates.getSelectedIndex() == 1 && !templates[i].getName().endsWith("T.xml") ) continue;
TemplateFile tf = new TemplateFile();
tf.file = templates[i];
tf.name = templates[i].getName().substring(0, templates[i].getName().length()-4);
((javax.swing.DefaultListModel)jList3.getModel()).addElement(tf);
}
if ( ((javax.swing.DefaultListModel)jList3.getModel()).getSize()>0)
jList3.setSelectedIndex(0);
jList3.updateUI();
}
public void jRSQLExpressionArea1TextConnectionExpressionTextChanged()
{
if (this.jRSQLExpressionArea1.getText().trim().length() == 0)
{
jButtonNext.setEnabled(false);
}
else
jButtonNext.setEnabled( true );
}
/** 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
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
jLabel1 = new javax.swing.JLabel();
jLabelStep1 = new javax.swing.JLabel();
jLabelStep2 = new javax.swing.JLabel();
jLabelStep3 = new javax.swing.JLabel();
jLabelStep4 = new javax.swing.JLabel();
jLabelStep5 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jButtonCancel = new javax.swing.JButton();
jButtonNext = new javax.swing.JButton();
jButtonPrev = new javax.swing.JButton();
jPanelRoot = new javax.swing.JPanel();
jPanelStep1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jSeparator3 = new javax.swing.JSeparator();
jPanel1 = new javax.swing.JPanel();
jPanelStep3 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
jSeparator5 = new javax.swing.JSeparator();
jComboBox1 = new javax.swing.JComboBox();
jLabelG1 = new javax.swing.JLabel();
jLabelG2 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox();
jLabelG3 = new javax.swing.JLabel();
jComboBox3 = new javax.swing.JComboBox();
jLabelG4 = new javax.swing.JLabel();
jComboBox4 = new javax.swing.JComboBox();
jPanelStep5 = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jSeparator7 = new javax.swing.JSeparator();
jLabel4 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jPanelStep2 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jSeparator4 = new javax.swing.JSeparator();
jScrollPane1 = new javax.swing.JScrollPane();
jList2 = new javax.swing.JList();
jScrollPane2 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jPanelStep4 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
jSeparator6 = new javax.swing.JSeparator();
jComboBoxTemplates = new javax.swing.JComboBox();
jScrollPane3 = new javax.swing.JScrollPane();
jList3 = new javax.swing.JList();
jLabelImage = new javax.swing.JLabel();
getContentPane().setLayout(null);
setTitle("iReport Wizard");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
closeDialog(evt);
}
});
getContentPane().add(jSeparator1);
jSeparator1.setBounds(2, 280, 460, 4);
jSeparator2.setBackground(new java.awt.Color(204, 204, 255));
jSeparator2.setForeground(new java.awt.Color(0, 0, 0));
jSeparator2.setMaximumSize(new java.awt.Dimension(32767, 1));
jSeparator2.setMinimumSize(new java.awt.Dimension(98, 1));
jSeparator2.setPreferredSize(new java.awt.Dimension(1, 1));
getContentPane().add(jSeparator2);
jSeparator2.setBounds(8, 28, 98, 2);
jLabel1.setFont(new java.awt.Font("Dialog", 1, 11));
jLabel1.setText("Steps");
getContentPane().add(jLabel1);
jLabel1.setBounds(8, 10, 84, 16);
jLabelStep1.setFont(new java.awt.Font("Dialog", 1, 11));
jLabelStep1.setText("1. Query");
getContentPane().add(jLabelStep1);
jLabelStep1.setBounds(8, 34, 110, 16);
jLabelStep2.setFont(new java.awt.Font("Dialog", 0, 11));
jLabelStep2.setText("2. Fields selection");
getContentPane().add(jLabelStep2);
jLabelStep2.setBounds(8, 52, 110, 16);
jLabelStep3.setFont(new java.awt.Font("Dialog", 0, 11));
jLabelStep3.setText("3. Group by ...");
getContentPane().add(jLabelStep3);
jLabelStep3.setBounds(8, 70, 110, 16);
jLabelStep4.setFont(new java.awt.Font("Dialog", 0, 11));
jLabelStep4.setText("4. Layout");
getContentPane().add(jLabelStep4);
jLabelStep4.setBounds(8, 88, 110, 16);
jLabelStep5.setFont(new java.awt.Font("Dialog", 0, 11));
jLabelStep5.setText("5. Finish");
getContentPane().add(jLabelStep5);
jLabelStep5.setBounds(8, 106, 110, 16);
jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/it/businesslogic/ireport/icons/wizard.jpg")));
getContentPane().add(jLabel7);
jLabel7.setBounds(0, 0, 132, 284);
jButtonCancel.setFont(new java.awt.Font("Dialog", 0, 11));
jButtonCancel.setMnemonic('f');
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(384, 286, 76, 24);
jButtonNext.setFont(new java.awt.Font("Dialog", 0, 11));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -