use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class Outsource method redo.
public void redo() {
super.redo();
MNode subtree = new MVolatile();
subtree.set("$inherit", inherit);
apply(subtree);
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class PanelMRU method saveMRU.
public void saveMRU() {
// roughly twice the length of the visible list, which could be zero
int limit = (list.getLastVisibleIndex() + 1) * 2;
MNode parts = AppData.state.childOrCreate("PanelReference", "MRU");
parts.clear();
for (int i = 0; i < model.size() && i < limit; i++) {
parts.set(i, model.get(i).key());
}
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class PanelSearch method selectCurrent.
public void selectCurrent() {
int index = list.getSelectedIndex();
if (index >= 0) {
MNode doc = model.get(index);
PanelReference.instance.panelMRU.useDoc(doc);
recordSelected(doc);
}
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class ParserBibtex method parseEntry.
public boolean parseEntry(BufferedReader reader, MNode output) throws IOException {
// find next @ that's not inside a comment
boolean inComment = false;
while (true) {
int c = reader.read();
if (c < 0)
return false;
if (inComment) {
if (c == '\r' || c == '\n')
inComment = false;
continue;
}
if (c == '@')
break;
if (c == '%')
inComment = true;
}
// read string until opening brace
String form = "";
while (true) {
int c = reader.read();
if (c < 0)
return false;
if (c == '{')
break;
form += (char) c;
}
form = form.trim().toLowerCase();
if (form.equals("string")) {
parseString(reader);
} else if (form.equals("preamble")) {
// and ignore
parseContent(reader);
} else if (form.equals("comment")) {
// and ignore
parseBracedContent(reader, '}');
} else {
MNode tags = parseTags(reader);
if (!ignore.contains(form)) {
tags.set("form", form);
output.set(tags.get(), tags);
}
}
// Whether it's true or not, we will find out in the next parse cycle.
return true;
}
use of gov.sandia.n2a.db.MNode in project n2a by frothga.
the class AddEntry method create.
public static int create(String id, MNode saved, int index, boolean fromSearchPanel, boolean wasShowing) {
MNode doc = AppData.references.set(id, "");
doc.merge(saved);
PanelReference mep = PanelReference.instance;
mep.panelMRU.insertDoc(doc);
int result = mep.panelSearch.insertDoc(doc, index);
if (wasShowing)
mep.panelEntry.model.setRecord(doc);
mep.panelSearch.lastSelection = index;
if (fromSearchPanel) {
if (wasShowing)
mep.panelEntry.table.clearSelection();
mep.panelSearch.list.setSelectedIndex(result);
mep.panelSearch.list.requestFocusInWindow();
} else {
mep.panelEntry.table.requestFocusInWindow();
}
return result;
}
Aggregations