import java.awt.*; import javax.swing.*; import WebFlow.submitJob2.*; public class crpcSend implements Runnable { private String file_name; private boolean debug; private JTextArea resultText; private JScrollPane sp; private JViewport vp; private Point p; private Dimension d; private int x,y; public crpcSend(String file_name, JTextArea resultText, JScrollPane sp, boolean debug) { this.file_name = file_name; this.resultText = resultText; this.sp = sp; this.debug = debug; vp = sp.getViewport(); p = vp.getViewPosition(); d = vp.getExtentSize(); x=p.x; } public void run(){ System.out.println("crpcSend Started............") ; System.out.println("debug is " + debug) ; /* Connection.submit.submitLocally(file_name); if(debug) System.out.println("run locally completed"); String OLine=""; resultText.setText(OLine); int curLine=0; if(debug) System.out.println("start reading..."); while(!OLine.equals("theEnd")) { OLine=Connection.submit.getOLine(curLine); if(OLine.equals("wait")) { if(debug) System.out.println("waiting..."); waitFor(10); } else { if(debug) System.out.println(curLine+" "+OLine); resultText.append(OLine+"\n"); // make the scrollbar move down automatically y=resultText.getHeight()-d.height; vp.setViewPosition(new Point(x,y)); Connection.submit.setLineRead(curLine); curLine++; if(curLine==20) curLine=0; } } */ if (file_name.equals("ve")) { String vel_file, pres_file ; for (int i = 0; i < 10; i++) { vel_file = "vel" + i + ".plt" ; pres_file = "pres" + i + ".plt" ; while (Connection.remote.exists(vel_file)) Connection.submit.submitLocally("rcp -l pse machine-name" + vel_file) ; while (Connection.remote.exists(pres_file)) Connection.submit.submitLocally("rcp -l pse machine-name" + pres_file) ; } } else { String conc_file ; for (int i = 0; i < 10; i++) { conc_file = "conc" + i + ".plt" ; while (Connection.remote.exists(conc_file)) Connection.submit.submitLocally("rcp -l pse machine-name" + conc_file) ; } } } public synchronized void waitFor(long howLong){ try { wait(howLong); } catch (Exception e) { System.out.println(e);} } }