/*
*Copyright 2007, 2011 CCLS Columbia University (USA), LIFO University of Orl��ans (France), BRGM (France)
*
*Authors: Cyril Nortet, Xiangrong Kong, Ansaf Salleb-Aouissi, Christel Vrain, Daniel Cassard
*
*This file is part of QuantMiner.
*
*QuantMiner 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 3 of the License, or any later version.
*
*QuantMiner 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 QuantMiner. If not, see <http://www.gnu.org/licenses/>.
*/
package src.graphicalInterface;
import javax.swing.filechooser.*;
import javax.swing.*;
import src.solver.*;
import src.tools.*;
import java.io.*;
import java.util.ArrayList;
public class PanelParamLoading extends PanelBaseParam {//step 3 rule parameters-load precomputed rules
/** Creates new form PanneauParamGenetique */
public PanelParamLoading(ResolutionContext contexteResolution) {
super(contexteResolution);
initComponents();
if (m_contexteResolution == null)
return;
LoadingParameters parametresChargement = m_contexteResolution.m_parametresTechChargement;
// Initialisation du contenu des champs :
if (parametresChargement.m_sNomFichier == null) {
jTextFieldNomFichier.setText("No file loaded");
jEditorPaneDescription.setText("");
}
else {
jTextFieldNomFichier.setText(parametresChargement.m_sNomFichier);
jEditorPaneDescription.setText(ResolutionContext.EcrireDescriptionFichierReglesBinairesHTML(parametresChargement.m_sNomFichier));
jEditorPaneDescription.setCaretPosition(0);
}
}
/** 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() {
jButtonChargerFichier = new javax.swing.JButton();
jTextFieldNomFichier = new javax.swing.JTextField();
jScrollPaneDescription = new javax.swing.JScrollPane();
jEditorPaneDescription = new javax.swing.JEditorPane();
jTextAreaNote = new javax.swing.JTextArea();
setLayout(null);
setPreferredSize(new java.awt.Dimension(600, 450));
jButtonChargerFichier.setText("Load a QuantMiner file...");
jButtonChargerFichier.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonChargerFichierActionPerformed(evt);
}
});
add(jButtonChargerFichier);
jButtonChargerFichier.setBounds(10, 60, 220, 23);
jTextFieldNomFichier.setEditable(false);
add(jTextFieldNomFichier);
jTextFieldNomFichier.setBounds(240, 60, 400, 19);
jScrollPaneDescription.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Information of the rule file:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 3, 12)));
jEditorPaneDescription.setEditable(false);
jEditorPaneDescription.setContentType("text/html");
jScrollPaneDescription.setViewportView(jEditorPaneDescription);
add(jScrollPaneDescription);
jScrollPaneDescription.setBounds(10, 100, 630, 340);
jTextAreaNote.setBackground(new java.awt.Color(85, 204, 204));
jTextAreaNote.setEditable(false);
jTextAreaNote.setFont(new java.awt.Font("Dialog", 3, 10));
jTextAreaNote.setForeground(new java.awt.Color(255, 0, 0));
jTextAreaNote.setLineWrap(true);
jTextAreaNote.setText("Note: The rules loaded from a QuantMiner File are filtered according to selectio done in previous steps. To see all of them, please select the whole set o attributes by putting them in both sides in the filtering table.");
add(jTextAreaNote);
jTextAreaNote.setBounds(10, 10, 630, 30);
}// </editor-fold>//GEN-END:initComponents
private void jButtonChargerFichierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonChargerFichierActionPerformed
String sFichierChoisi = null;
ArrayList<String> description = new ArrayList<String>();
description.add("QuantMiner File");
ArrayList<String> extention = new ArrayList<String>();
extention.add("qmr");
sFichierChoisi = ToolsInterface.DialogOuvertureFichier(this, ENV.REPERTOIRE_REGLES_QMR, description, extention);
if ( (sFichierChoisi != null) && (m_contexteResolution != null) ) {
m_contexteResolution.PreChargerFichierReglesBinaires(sFichierChoisi);
jTextFieldNomFichier.setText(sFichierChoisi);
jEditorPaneDescription.setText(ResolutionContext.EcrireDescriptionFichierReglesBinairesHTML(sFichierChoisi));
jEditorPaneDescription.setCaretPosition(0);
}
}//GEN-LAST:event_jButtonChargerFichierActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonChargerFichier;
private javax.swing.JEditorPane jEditorPaneDescription;
private javax.swing.JScrollPane jScrollPaneDescription;
private javax.swing.JTextArea jTextAreaNote;
private javax.swing.JTextField jTextFieldNomFichier;
// End of variables declaration//GEN-END:variables
public boolean EnregistrerParametres() {
return true;
}
}