/* Copyright @ 2003, The Institute for Genomic Research (TIGR). All rights reserved. */ /*************************************************************************** * Author: Jerry Li * Name: TavPanel (Version 1.0) * Date: Created: 05/08/2003 and modified: 05/08/2003 * Descp: the interface for GenePix output file as input for the ExpressConveter ***************************************************************************/ package org.tigr.microarray.converter; import java.util.Vector; import java.util.StringTokenizer; import java.awt.GridBagLayout; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import javax.swing.JPanel; import javax.swing.border.BevelBorder; import org.tigr.util.swing.MultiInputOutputs; import org.tigr.util.LongTextChanger; import org.tigr.util.awt.GBA; import org.tigr.util.io.IOUtil; public class TavPanel extends ConvertPanel { MultiInputOutputs inOut; public TavPanel() { this(null); } public TavPanel(ExpressConverter ec) { super(ec); 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; inOut.setOutputLabel("MEV Files:"); 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; inOut.setInputListData(inFiles); inOut.setOutputListData(outFiles); inOut.showNumberOfFiles(selectedFiles.size()); } /**************************************************************************** * Description: * modifies the output file names. *

Parameter: *
path -- the new directory. ***************************************************************************/ public void editDirectory(String path){ int selected = -1; int num; String tempName, tempPath; tempPath = path; selected = inOut.getSelectedOutputIndex(); num = outputFileNames.size(); for(int i=0; i=0){ inOut.setOutputSelectedIndex(selected); } else { inOut.setOutputSelectedIndex(0); } } /**************************************************************************** * Description: * modifies the output file names. ***************************************************************************/ public void editFileName(){ int selected = -1; String tempName; selected = inOut.getSelectedOutputIndex(); if(selected >= 0){ tempName = inOut.getSelectedOutputName(selected); LongTextChanger changer = new LongTextChanger(parent, true, tempName); changer.setTitle(parent.TITLE); changer.show(); if(changer.isTextChanged()){ tempName = changer.getText(); StringTokenizer token = new StringTokenizer(tempName, ":"); if(token.countTokens() <= 1){ tempName = "c:\\" + tempName; } tempName = IOUtil.dropExtension(tempName); if(tempName.lastIndexOf('.') == tempName.length()-1){ tempName += FILE_TYPE[outputType]; } else { tempName += "." + FILE_TYPE[outputType]; } outputFileNames.setElementAt(tempName, selected); inOut.setOutputListData(outputFileNames); inOut.setOutputSelectedIndex(selected); } } } public Vector getOutputFileNames() { return outputFileNames; } public boolean getOutputReady() { return inOut.isOutputReady(); } public Vector getSelectedFiles() { return selectedFiles; } protected void createGUI(){ int sizeX = (int)(parent.scrWidth * 0.83); int sizeY = (int)(parent.scrHeight * 0.70); BevelBorder low = new BevelBorder(1); this.setLayout(new GridBagLayout()); inOut = new MultiInputOutputs(sizeX, sizeY); inOut.setLabelTexts("TAV Files:", "MEV Files:"); inOut.setDividerLocation(0.3); inOut.addPropertyChangeListener(new PropertyChangeListener(){ public void propertyChange(PropertyChangeEvent pce){ if(pce.getPropertyName().equals(inOut.OUT_READY)){ if(pce.getNewValue().toString().equals("true")){ parent.activateButton(inOut.isOutputReady(), inOut.isOutputReady()); } } } }); gba.add(this, inOut, 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); } /*************************************************************************** * Description: * removes a set of files from the selected list. ***************************************************************************/ public void removeFileFromList(){ int addrs[], i, indx; addrs = inOut.getSelectedInputIndices(); if(addrs.length > 0){ for(i=0; i 0){ inOut.setOutputSelectedIndex(0); } inOut.showNumberOfFiles(selectedFiles.size()); } } /*************************************************************************** * Description: * places the selected file names to both input and output file lists. **************************************************************************/ public void setSelectedFiles(String[] newFiles){ int num, i; String temp = new String(""); num = newFiles.length; for(i=0; iDescription: * set the interface to its original status. **************************************************************************/ public void reset(){ selectedFiles.removeAllElements(); outputFileNames.removeAllElements(); inOut.showNumberOfFiles(0); inOut.setInputListData(selectedFiles); inOut.setOutputListData(outputFileNames); sortCB.setSelected(true); wantSort = true; outputReady = false; parent.activateButton(outputReady, outputReady); } }