ImportDialog.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
it.businesslogic.ireport.gui |
![]() |
![]() |
iReport |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
/*
* Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
* http://www.jaspersoft.com.
*
* Unless you have purchased a commercial license agreement from JasperSoft,
* the following license terms apply:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* This program is distributed WITHOUT ANY WARRANTY; and without 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, see http://www.gnu.org/licenses/gpl.txt
* or write to:
*
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA USA 02111-1307
*
*
*
*
* ImportDialog.java
*
* Created on 12 novembre 2004, 0.06
*
*/
package it.businesslogic.ireport.gui;
import it.businesslogic.ireport.util.I18n;
/**
*
* @author Administrator
*/
public class ImportDialog extends javax.swing.JDialog {
private String Import;
private int dialogResult = javax.swing.JOptionPane.CANCEL_OPTION;
/** Creates new form ImportDialog */
public ImportDialog(java.awt.Dialog parent, boolean modal) {
super(parent, modal);
initComponents();
initFrame();
}
public void initFrame()
{
this.setSize(400,100);
applyI18n();
it.businesslogic.ireport.util.Misc.centerFrame(this);
javax.swing.KeyStroke escape = javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false);
javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
public void actionPerformed(java.awt.event.ActionEvent e) {
jButtonCancelActionPerformed(e);
}
};
getRootPane().getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE");
getRootPane().getActionMap().put("ESCAPE", escapeAction);
//to make the default button ...
this.getRootPane().setDefaultButton(this.jButtonOK);
}
/** 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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jButtonOK = new javax.swing.JButton();
jButtonCancel = new javax.swing.JButton();
getContentPane().setLayout(new java.awt.GridBagLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Import");
setModal(true);
setResizable(false);
jLabel1.setText("Class or package name");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
getContentPane().add(jLabel1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
getContentPane().add(jTextField1, gridBagConstraints);
jPanel1.setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
jPanel1.add(jPanel2, gridBagConstraints);
jButtonOK.setText("Ok");
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.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
jPanel1.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();
gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
jPanel1.add(jButtonCancel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jPanel1, gridBagConstraints);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
if (jTextField1.getText().trim().length() == 0)
{
javax.swing.JOptionPane.showMessageDialog(null,I18n.getString( "messages.importDialog.notValidClass","Please insert a valid class or package name"));
return;
}
this.setImport( jTextField1.getText().trim());
this.setDialogResult( javax.swing.JOptionPane.OK_OPTION);
this.setVisible(false);
}//GEN-LAST:event_jButtonOKActionPerformed
private void jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
this.setDialogResult( javax.swing.JOptionPane.CANCEL_OPTION);
this.setVisible(false);
}//GEN-LAST:event_jButtonCancelActionPerformed
public String getImport() {
return Import;
}
public void setImport(String Import) {
this.Import = Import;
jTextField1.setText( Import );
}
public int getDialogResult() {
return dialogResult;
}
public void setDialogResult(int dialogResult) {
this.dialogResult = dialogResult;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonCancel;
private javax.swing.JButton jButtonOK;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
public void applyI18n(){
// Start autogenerated code ----------------------
jButtonCancel.setText(I18n.getString("importDialog.buttonCancel","Cancel"));
jButtonOK.setText(I18n.getString("importDialog.buttonOK","Ok"));
jLabel1.setText(I18n.getString("importDialog.label1","Class or package name"));
// End autogenerated code ----------------------
this.setTitle(I18n.getString("importDialog.title","Import"));
jButtonCancel.setMnemonic(I18n.getString("importDialog.buttonCancelMnemonic","c").charAt(0));
jButtonOK.setMnemonic(I18n.getString("importDialog.buttonOKMnemonic","o").charAt(0));
}
}
The table below shows all metrics for ImportDialog.java.




