Skip to content
Snippets Groups Projects
Commit 4cce70d3 authored by tjc's avatar tjc
Browse files

make a separate class for the progress bar

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@10795 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 3d545ada
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/ExternalProgram.java,v 1.19 2008-07-24 13:50:51 tjc Exp $ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/ExternalProgram.java,v 1.20 2009-05-13 15:47:52 tjc Exp $
**/ **/
package uk.ac.sanger.artemis; package uk.ac.sanger.artemis;
...@@ -29,27 +29,22 @@ import uk.ac.sanger.artemis.util.*; ...@@ -29,27 +29,22 @@ import uk.ac.sanger.artemis.util.*;
import uk.ac.sanger.artemis.io.EntryInformation; import uk.ac.sanger.artemis.io.EntryInformation;
import uk.ac.sanger.artemis.io.EntryInformationException; import uk.ac.sanger.artemis.io.EntryInformationException;
import uk.ac.sanger.artemis.io.DocumentEntry; import uk.ac.sanger.artemis.io.DocumentEntry;
import uk.ac.sanger.artemis.components.SwingWorker; import uk.ac.sanger.artemis.components.ProgressBarFrame;
import uk.ac.sanger.artemis.components.Utilities;
import uk.ac.sanger.artemis.components.filetree.RemoteFileNode; import uk.ac.sanger.artemis.components.filetree.RemoteFileNode;
import uk.ac.sanger.artemis.j2ssh.FileTransferProgressMonitor; import uk.ac.sanger.artemis.j2ssh.FileTransferProgressMonitor;
import uk.ac.sanger.artemis.j2ssh.FTProgress; import uk.ac.sanger.artemis.j2ssh.FTProgress;
import java.awt.Color;
import java.io.*; import java.io.*;
import java.text.*; import java.text.*;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Enumeration; import java.util.Enumeration;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
/** /**
* Each object of this class represents one external executable or script, * Each object of this class represents one external executable or script,
* and contains methods for invoking it. * and contains methods for invoking it.
* *
* @author Kim Rutherford * @author Kim Rutherford
* @version $Id: ExternalProgram.java,v 1.19 2008-07-24 13:50:51 tjc Exp $ * @version $Id: ExternalProgram.java,v 1.20 2009-05-13 15:47:52 tjc Exp $
**/ **/
public class ExternalProgram public class ExternalProgram
...@@ -200,7 +195,7 @@ public class ExternalProgram ...@@ -200,7 +195,7 @@ public class ExternalProgram
uk.ac.sanger.artemis.j2ssh.SshPSUClient ssh = uk.ac.sanger.artemis.j2ssh.SshPSUClient ssh =
new uk.ac.sanger.artemis.j2ssh.SshPSUClient(args); new uk.ac.sanger.artemis.j2ssh.SshPSUClient(args);
ssh.start(); ssh.start();
nowSendingProgressBar(); new ProgressBarFrame(1, getName());
return null; return null;
} }
...@@ -232,7 +227,7 @@ public class ExternalProgram ...@@ -232,7 +227,7 @@ public class ExternalProgram
// //
// //
nowSendingProgressBar(); new ProgressBarFrame(1, getName());
return new ProcessMonitor(process, getName(), logger); return new ProcessMonitor(process, getName(), logger);
} }
catch(SecurityException e) catch(SecurityException e)
...@@ -245,43 +240,6 @@ public class ExternalProgram ...@@ -245,43 +240,6 @@ public class ExternalProgram
// } // }
} }
/**
* Let the user know the process is being run with a progress bar
*/
private void nowSendingProgressBar()
{
final JFrame fsend = new JFrame();
fsend.setUndecorated(true);
final int max = 25;
final JProgressBar progressBar = new JProgressBar(0,max);
progressBar.setStringPainted(true);
progressBar.setString("Sending "+getName()+" process now!");
progressBar.setBackground(Color.white);
SwingWorker batchWorker = new SwingWorker()
{
public Object construct()
{
try
{
for(int i=0; i<max; i++)
{
Thread.sleep(40);
progressBar.setValue(i);
}
fsend.dispose();
}
catch(InterruptedException intr){}
return null;
}
};
fsend.getContentPane().add(progressBar);
fsend.pack();
Utilities.centreFrame(fsend);
fsend.setVisible(true);
batchWorker.start();
}
/** /**
* Write sequence files for each of the given features and add a * Write sequence files for each of the given features and add a
......
/* ExternalProgram.java
*
* created: 2009
*
* This file is part of Artemis
*
* Copyright(C) 2009 Genome Research Limited
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or(at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
**/
package uk.ac.sanger.artemis.components;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
public class ProgressBarFrame extends JFrame
{
private static final long serialVersionUID = 1L;
public ProgressBarFrame(int seconds, String name)
{
super();
setUndecorated(true);
final int max = (seconds*1000)/40;
final JProgressBar progressBar = new JProgressBar(0,max);
progressBar.setStringPainted(true);
progressBar.setString("Sending "+name+" process now!");
progressBar.setBackground(Color.white);
SwingWorker batchWorker = new SwingWorker()
{
public Object construct()
{
try
{
for(int i=0; i<max; i++)
{
Thread.sleep(40);
progressBar.setValue(i);
}
dispose();
}
catch(InterruptedException intr){}
return null;
}
};
getContentPane().add(progressBar);
pack();
Utilities.centreFrame(this);
setVisible(true);
batchWorker.start();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment