use of gov.sandia.n2a.ui.MainTabbedPane in project n2a by frothga.
the class PanelEquations method launchJob.
public void launchJob() {
if (record == null)
return;
prepareForTabChange();
String jobKey = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.ROOT).format(new Date());
MDoc job = (MDoc) AppData.runs.childOrCreate(jobKey);
NodeJob.collectJobParameters(root.source, record.key(), job);
// Force directory (and job file) to exist, so Backends can work with the dir.
job.save();
NodeJob.saveSnapshot(record, job);
MainTabbedPane mtp = (MainTabbedPane) MainFrame.instance.tabs;
mtp.setPreferredFocus(PanelRun.instance, PanelRun.instance.tree);
mtp.selectTab("Runs");
NodeJob node = PanelRun.instance.addNewRun(job, true);
// Hack to allow local jobs to bypass the wait-for-host queue.
// It would be better for all jobs to check for resources before starting.
// However, the time cost for the local check could be as long as the job itself
// (for very simple models). There is some expectation that the user knows
// the state of their own system when they choose to hit the play button.
Backend backend = Backend.getBackend(job.get("backend"));
String backendName = backend.getName().toLowerCase();
Host h = Host.get(job);
boolean internal = backend instanceof InternalBackend;
boolean localhost = !(h instanceof Remote);
boolean forbidden = h.config.get("backend", backendName).equals("0");
if (// use of Internal overrides host selection
internal || (localhost && !forbidden)) {
// In case it was "internal" but not "localhost", set host to correct value.
job.set("localhost", "host");
backend.start(job);
h.monitor(node);
return;
}
Host.waitForHost(node);
}
use of gov.sandia.n2a.ui.MainTabbedPane in project n2a by frothga.
the class PanelEquations method prepareForTabChange.
public void prepareForTabChange() {
if (!isEditing())
return;
stopEditing();
// The following is needed because graph node components (title or tree) do not reclaim the focus before it shifts to the run tab.
GraphNode gn = active.root.graph;
MainTabbedPane mtp = (MainTabbedPane) MainFrame.instance.tabs;
if (gn != null && gn.titleFocused)
mtp.setPreferredFocus(PanelModel.instance, gn.title);
else
mtp.setPreferredFocus(PanelModel.instance, active.tree);
}
Aggregations