/***********************************************************************
This file is part of KEEL-software, the Data Mining tool for regression,
classification, clustering, pattern mining and so on.
Copyright (C) 2004-2010
F. Herrera (herrera@decsai.ugr.es)
L. S�nchez (luciano@uniovi.es)
J. Alcal�-Fdez (jalcala@decsai.ugr.es)
S. Garc�a (sglopez@ujaen.es)
A. Fern�ndez (alberto.fernandez@ujaen.es)
J. Luengo (julianlm@decsai.ugr.es)
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 3 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, see http://www.gnu.org/licenses/
**********************************************************************/
/**
*
* File: ExecutionOptions.java
*
* A class for managing execution options
*
* @author Written by Ignacio Robles 25-3-2009
* @version 1.0
* @since JDK1.5
*/
package keel.GraphInterKeel.experiments;
import java.awt.*;
import javax.swing.*;
public class ExecutionOptions extends javax.swing.JDialog {
Experiments parentExec;
/**
* Builder
* @param parent Parent frame
* @param modal Modal status
*/
public ExecutionOptions(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
*
* @param owner Parent frame
* @param title Title of the frame
* @param modal Modal status
*/
public ExecutionOptions(Frame owner, String title, boolean modal) {
super(owner, title, modal);
parentExec = (Experiments) owner;
this.setLocation(parentExec.getX() + 100, parentExec.getY() + 100);
initComponents();
}
/** 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
acceptButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
memoryLabel = new javax.swing.JLabel();
memoryField = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Execution Options");
setName("Form"); // NOI18N
setResizable(false);
acceptButton.setText("Accept");
acceptButton.setName("acceptButton"); // NOI18N
acceptButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
acceptButtonActionPerformed(evt);
}
});
cancelButton.setText("Cancel");
cancelButton.setName("cancelButton"); // NOI18N
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
memoryLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
memoryLabel.setText("Maximum memory available for the algorithm execution (MB)");
memoryLabel.setName("memoryLabel"); // NOI18N
memoryField.setText("512");
memoryField.setName("memoryField"); // NOI18N
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.add(memoryLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE))
.add(layout.createSequentialGroup()
.add(124, 124, 124)
.add(acceptButton)
.add(41, 41, 41)
.add(cancelButton)))
.addContainerGap())
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(190, Short.MAX_VALUE)
.add(memoryField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 82, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(179, 179, 179))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(memoryLabel)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(memoryField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(12, 12, 12)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(cancelButton)
.add(acceptButton))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* Changing heap size
* @param evt Event
*/
private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonActionPerformed
if (Integer.parseInt(memoryField.getText()) < 32) {
JOptionPane.showMessageDialog(null, "The Heap Size value must be 32 MB at least", "Parameter Error", JOptionPane.ERROR_MESSAGE);
parentExec.heapSize = 32;
} else {
parentExec.heapSize = Integer.valueOf(memoryField.getText());
this.dispose(); //close dialog
}
}//GEN-LAST:event_acceptButtonActionPerformed
/**
* Closing frame
* @param evt Event
*/
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
this.dispose();
}//GEN-LAST:event_cancelButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton acceptButton;
private javax.swing.JButton cancelButton;
private javax.swing.JTextField memoryField;
private javax.swing.JLabel memoryLabel;
// End of variables declaration//GEN-END:variables
}