/*************************************************************************** * Author: Jianwei (Jerry) Li * Name: AgilentPanel (Version 1.0) * Date: Created: 06/30/2004 and modified: 08/12/2004 * Descp: A Java panel that is the interface for converting an Agilent file * format to Mev format. ***************************************************************************/ package org.tigr.microarray.converter; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; import javax.swing.Timer; import org.tigr.util.awt.GBA; import org.tigr.util.*; import org.tigr.util.io.IOUtil; public class AgilentPanel extends ConvertPanel { private JList gInputFileList; // variable declare private String info; public AgilentPanel(ExpressConverter convt) { super(convt); info = new String(""); createGUI(); } /**************************************************************************** * Description: * alters the interface to meet the requirement for output file type. *

Parameter: *
index -- the selected index of the combobox. ***************************************************************************/ public void adjustGUI(int index){ int numFiles; String tmpName = new String(""); outputType = index; if(outputType == TAV_OUT){ gOutputFileLB.setText(TAV_FILE); } else { gOutputFileLB.setText(MEV_FILE); } numFiles = outputFileNames.size(); for(int i=0; iDescription: * changes the number of input and output files based on testing on the * system to see if an exsiting file is to be overwritten. *

Paramters: *
inFiles -- the input files. *
outFiles -- the output files. ***************************************************************************/ public void changeFileList(Vector inFiles, Vector outFiles){ selectedFiles = inFiles; outputFileNames = outFiles; gInputFileList.setListData(inFiles); gOutputFileList.setListData(outFiles); gFileNumLB.setText(NUM_FILE + selectedFiles.size()); } public Vector getOutputFileNames() { return outputFileNames; } public Vector getSelectedFiles() { return selectedFiles; } public boolean isOutputReady() { return outputReady; } /*************************************************************************** * Description: * removes a set of files from the selected list. ***************************************************************************/ public void removeFileFromList(){ int addrs[], i, indx; addrs = gOutputFileList.getSelectedIndices(); if(addrs.length > 0){ for(i=0; i 0){ gOutputFileList.setSelectedIndex(0); } gFileNumLB.setText(NUM_FILE + selectedFiles.size()); } } /**************************************************************************** * Description: * set the interface to its original status. **************************************************************************/ public void reset(){ selectedFiles.removeAllElements(); outputFileNames.removeAllElements(); gFileNumLB.setText(NUM_FILE); gInputFileList.setListData(selectedFiles); gOutputFileList.setListData(outputFileNames); wantSort = true; outputReady = false; sortCB.setSelected(wantSort); parent.activateButton(outputReady, outputReady); } /*************************************************************************** * Description: * places the selected file names to both Agilent and output file lists. **************************************************************************/ public void setSelectedFiles(String[] newFiles){ int num, i; String temp = new String(""); num = newFiles.length; for(i=0; iDescription: * finds a selected file as a File object *

Parameters: *
ext -- file name extension; *
fileType -- describe the file type; *
path --- the path selected file is located at. *

Return: the selected file. ***************************************************************************/ private File getFile(String ext, String fileType, String path) { int result; File temp; JFileChooser fileChooser; fileChooser = new JFileChooser(path); MadamFileFilter wanted = new MadamFileFilter(ext, fileType); fileChooser.setFileFilter(wanted); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setDialogTitle("Save Output As"); fileChooser.setMultiSelectionEnabled(false); result = fileChooser.showSaveDialog(this); if(result == JFileChooser.CANCEL_OPTION) { return null; } temp = fileChooser.getSelectedFile(); return temp; } /***************************************************************************** * Description: * create a GUI for program ****************************************************************************/ protected void createGUI(){ this.setLayout(new GridBagLayout()); gInputFileLB = new JLabel("Agilent Files:"); gInputFileList = new JList(); gInputFileList.setBorder(gLow); actionHandler(gInputFileList); actionHandler(gOutputFileList); gFilesSP = new JScrollPane(gInputFileList); gba.add(this, gFileSplitPane, 0, 0, 2, 1, 1, 1, GBA.B, GBA.C, 5, 5, 10, 5); gba.add(this, sortCB, 0, 1, 1, 1, 1, 0, GBA.H, GBA.C, 10, 15, 3, 5); gba.add(this, gIntenPanel, 1, 1, 1, 2, 1, 0, GBA.H, GBA.W, 10, 0, 3, 5); gba.add(gInputPL, gInputFileLB, 0, 0, 1, 1, 1, 0, GBA.H, GBA.C, 5, 10, 5, 2); gba.add(gInputPL, gFilesSP, 0, 1, 1, 1, 1, 1, GBA.B, GBA.C, 1, 2, 5, 2); } }