/* 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 taking mev file as input for conversion ***************************************************************************/ package org.tigr.microarray.converter; import java.awt.GridBagLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.util.StringTokenizer; import java.util.Vector; import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.border.BevelBorder; import org.tigr.util.swing.MultiInputOutputs; import org.tigr.util.awt.GBA; import org.tigr.util.LongTextChanger; import org.tigr.util.io.IOUtil; public class MevPanel extends ConvertPanel { private JCheckBox keepAllCB; MultiInputOutputs inOut; private boolean keepAll; public MevPanel() { this(null); } public MevPanel(ExpressConverter ec) { super(ec); wantSort = true; keepAll = false; outputReady = false; selectedFiles = new Vector(10, 3); outputFileNames = new Vector(10, 3); createGUI(); } public void adjustGUI(int index){ int numFiles; String tmpName = new String(""); outputType = index; 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()); } 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("MEV Files:", "TAV 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()); } } } }); keepAllCB = new JCheckBox("Keep Unique ID in the MEV File(s)."); keepAllCB.setToolTipText("Attach the UID to the TAV file(s)."); keepAllCB.setSelected(keepAll); keepAllCB.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ce){ if(keepAllCB.isSelected()){ keepAll = true; } else { keepAll = false; } } }); 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); gba.add(this, keepAllCB, 0, 2, 1, 1, 1, 0, GBA.H, GBA.C, 3, 15, 3, 5); } 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); } } 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 boolean keepAllInformation() { return keepAll; } /*************************************************************************** * 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()); } } public Vector getOutputFileNames() { return outputFileNames; } public Vector getSelectedFiles() { return selectedFiles; } public boolean getOutputReady() { return inOut.isOutputReady(); } /*************************************************************************** * 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); wantSort = true; keepAll = false; outputReady = false; sortCB.setSelected(wantSort); parent.activateButton(outputReady, outputReady); } }