/*
*
Copyright (c) 2010 The Regents of the University of California.
All rights reserved.
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
software and its documentation for any purpose, provided that the above
copyright notice and the following two paragraphs appear in all copies
of this software.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS..
*/
/*
* Tester.java
*
* Created on Mar 18, 2011, 9:50:45 AM
*/
package gui;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
//import net.iharder.dnd.FileDrop;
import sequencing.ABITrace;
import sequencing.Analyzer;
import sequencing.TraceExtract.ResultType;
/**
*
* @author jcanderson_Home
*/
public class Tester extends javax.swing.JFrame {
/** Creates new form Tester */
public Tester() {
initComponents();
// new FileDrop( getContentPane(), new FileDrop.Listener() {
// public void filesDropped( java.io.File[] files ) {
// for(File afile : files) {
// _abiFiles.add(afile);
// }
// }
// });
}
/** 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() {
jScrollPane1 = new javax.swing.JScrollPane();
seqArea = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
abiBtn = new javax.swing.JButton();
seqBtn = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
seqArea.setColumns(20);
seqArea.setLineWrap(true);
seqArea.setRows(5);
jScrollPane1.setViewportView(seqArea);
jButton1.setText("Run");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel1.setText("Enter sequence below, drop abi files, then click run");
abiBtn.setText("Clear ABIs");
abiBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
abiBtnActionPerformed(evt);
}
});
seqBtn.setText("Clear Seq");
seqBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
seqBtnActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(abiBtn)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(seqBtn)
.addGap(187, 187, 187)
.addComponent(jButton1))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addContainerGap(162, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(13, 13, 13)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(abiBtn)
.addComponent(seqBtn))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String target = seqArea.getText();
ArrayList<ABITrace> listy = new ArrayList<ABITrace>();
for(File afile : _abiFiles) {
try {
ABITrace atrace = new ABITrace(afile);
listy.add(atrace);
} catch (IOException ex) {
}
}
//Create the analyzer
Analyzer analysis=new Analyzer(listy, target);
//Run the analysis
ResultType rep = analysis.go();
//Instantiate the GUI (or redirect it to an image)
analysis.launchReport();
}//GEN-LAST:event_jButton1ActionPerformed
private void abiBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abiBtnActionPerformed
_abiFiles.clear();
}//GEN-LAST:event_abiBtnActionPerformed
private void seqBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seqBtnActionPerformed
seqArea.setText("");
}//GEN-LAST:event_seqBtnActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Tester().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton abiBtn;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea seqArea;
private javax.swing.JButton seqBtn;
// End of variables declaration//GEN-END:variables
ArrayList<File> _abiFiles= new ArrayList<File>();
}