/*************************************************************************** * Author: Jianwei (Jerry) Li * Name: ArrayVersionPanel (Version 1.0) * Date: Created: 06/04/2004 and modified: 06/07/2004 * Descp: A Java panel that is the interface for converting an ArrayVersion 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 ArrayVersionPanel extends ConvertPanel { JPanel gOutputPL; JScrollPane gInputSP; private JList inputFileList; private JScrollPane gFilesSP; // variable declare private String info; public ArrayVersionPanel(ExpressConverter convt) { super(convt); info = new String(""); createGUI(); } /**************************************************************************** * Description: * alters the interface to meet the requirement for output file type. *
Parameter:
* Paramters:
* Parameters:
* 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("ArrayVersion Files:");
inputFileList = new JList();
inputFileList.setBorder(gLow);
actionHandler(inputFileList);
actionHandler(gOutputFileList);
gFilesSP = new JScrollPane(inputFileList);
sortCB.setEnabled(false);
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);
}
}
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; i
inFiles -- the input files.
*
outFiles -- the output files.
***************************************************************************/
public void changeFileList(Vector inFiles, Vector outFiles){
selectedFiles = inFiles;
outputFileNames = outFiles;
inputFileList.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
ext -- file name extension;
*
fileType -- describe the file type;
*
path --- the path selected file is located at.
*