if (arb != null && arb.length() != 0)
s = "<html>" + arb + "<br>" + s;
progmon.setNote(s);
- }}.exec();
+ }}.exec("progressNote");
}
/*
progmon = null;
}
findMarket.setEnabled(true);
- }}.exec();
+ }}.exec("tidying");
} catch (Exception e) {
System.err.println("exception tidying on UI thread:");
e.printStackTrace();
private abstract class UIXR<ReturnType> implements Runnable {
public abstract ReturnType bodyr();
public ReturnType return_value;
- public void run() { return_value = bodyr(); };
- public ReturnType exec() throws Exception {
+ private String what;
+ public void run() {
+ debuglog("UIX 2 "+what+" begin");
+ return_value = bodyr();
+ debuglog("UIX 3 "+what+" done");
+ };
+ public ReturnType exec(String what_in) throws Exception {
+ what = what_in;
if (EventQueue.isDispatchThread()) {
+ debuglog("UIX 1 "+what+" (event thread) entry");
this.run();
+ debuglog("UIX 4 "+what+" (event thread) exit");
} else {
+ debuglog("UIX 1 "+what+" (other thread) entry");
EventQueue.invokeAndWait(this);
+ debuglog("UIX 4 "+what+" (other thread) exit");
}
return return_value;
};
resultSummary.setText("failed");
JOptionPane.showMessageDialog(frame,msg,"Error",
JOptionPane.ERROR_MESSAGE);
- }}.exec();
+ }}.exec("error()");
} catch (Exception e) {
System.err.println("exception reporting to UI thread:");
e.printStackTrace();
private void setProgress(final int nv) throws Exception {
new UIX() { public void body() {
progmon.setProgress(nv);
- }}.exec();
+ }}.exec("setProgress");
}
private boolean isCanceled() throws Exception {
return new UIXR<Boolean>() { public Boolean bodyr() {
return new Boolean(progmon.isCanceled());
- }}.exec().booleanValue();
+ }}.exec("isCanceled").booleanValue();
}
/*
debuglog("getocean done");
return at;
- }}.exec();
+ }}.exec("accesstable");
if (accesstable == null) return;
if (latch != null) {
debuglog("table read...");
return getData(accesstable);
- }}.exec();
+ }}.exec("data");
if (data == null) return;
if (showArbitrage) {
final String summary_final = summary;
new UIX() { public void body() {
resultSummary.setText(summary_final);
- }}.exec();
+ }}.exec("resultSummary.setText");
debuglog("done.");
}