use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class PanelRun method viewJob.
public void viewJob() {
if (displayThread != null) {
synchronized (displayText) {
displayThread.stop = true;
displayThread = null;
}
}
NodeJob job = (NodeJob) displayNode;
MNode doc = job.source;
StringBuilder contents = new StringBuilder();
contents.append("Status:");
if (job.complete < 0)
contents.append(" Waiting");
else if (job.complete == 0)
contents.append(" Started");
else if (job.complete > 0 && job.complete < 1)
contents.append(" " + Math.round(job.complete * 100) + "%");
else if (job.complete == 1)
contents.append(" Success");
else if (job.complete == 3)
contents.append(" Killed");
else
// complete==2, or any value not specified above
contents.append(" Failed");
contents.append("\n");
if (job.dateStarted != null)
contents.append(" started: " + job.dateStarted + "\n");
if (job.dateFinished != null)
contents.append(" finished: " + job.dateFinished + "\n");
MNode metadata = doc.child("$metadata");
// TODO: filter out irrelevant items, like "gui.order"
if (metadata != null)
contents.append("\n" + metadata);
synchronized (displayText) {
displayText.setText(contents.toString());
displayText.setCaretPosition(0);
}
if (displayPane.getViewport().getView() != displayText)
displayPane.setViewportView(displayText);
displayPane.paintImmediately(displayPane.getBounds());
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class ParserBibtex method parseTags.
public MNode parseTags(BufferedReader reader) throws IOException {
MNode result = new MVolatile();
// read to first ,
String id = "";
while (true) {
int c = reader.read();
if (c < 0 || c == '}') {
result.set(id.trim());
return result;
}
if (c == ',')
break;
id += (char) c;
}
// TODO: should this be lower-case as well?
result.set(id.trim());
while (parseTag(reader, result)) ;
return result;
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class AddEntry method destroy.
public static int destroy(String id, boolean fromSearchPanel) {
MNode doc = AppData.references.child(id);
PanelReference mep = PanelReference.instance;
mep.panelEntry.recordDeleted(doc);
mep.panelMRU.removeDoc(doc);
int result = mep.panelSearch.removeDoc(doc);
((MDoc) doc).delete();
mep.panelSearch.lastSelection = Math.min(mep.panelSearch.model.size() - 1, result);
if (fromSearchPanel) {
mep.panelSearch.list.setSelectedIndex(mep.panelSearch.lastSelection);
mep.panelSearch.list.requestFocusInWindow();
} else {
mep.panelEntry.table.requestFocusInWindow();
}
return result;
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class ExportJob method standalone.
/**
* Process child elements common to all Standalone elements.
*/
public void standalone(MPart source, Element node, List<Element> elements) {
MNode metadata = source.child("$metadata");
if (metadata != null) {
for (MNode m : metadata) {
if (!((MPart) m).isFromTopDocument())
continue;
String key = m.key();
if (key.startsWith("backend"))
continue;
if (key.startsWith("gui"))
continue;
// our internal id, not NeuroML id
if (key.equals("id"))
continue;
switch(key) {
case "description":
node.setAttribute("description", m.get());
break;
case "note":
case "notes":
Element notes = addElement("notes", elements);
notes.setTextContent(m.get());
break;
default:
Element property = addElement("property", elements);
property.setAttribute("tag", key);
property.setAttribute("value", m.get());
}
}
}
MNode reference = source.child("$reference");
if (reference != null) {
// TODO: emit annotation elements
}
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class ImportJob method concentrationModel.
public void concentrationModel(Node node) {
MNode part = genericPart(node, models.child(modelName));
// According to comment in NeuroML.xsd, this field should be the same as id.
part.clear("ion");
String inherit = node.getNodeName();
if (// Gets mapped into base concentration model. Here, we fix up the parameters so it will work.
inherit.endsWith("Traub")) {
String beta = part.get("beta");
String phi = part.get("phi");
part.clear("beta");
part.clear("phi");
part.set("tau", "1/" + beta);
part.set("rho", phi + "*1e-9");
}
}
Aggregations