Search in sources :

Example 41 with MNode

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);
}
Also used : MNode(gov.sandia.n2a.db.MNode) MVolatile(gov.sandia.n2a.db.MVolatile)

Example 42 with MNode

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());
    }
}
Also used : MNode(gov.sandia.n2a.db.MNode)

Example 43 with MNode

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);
    }
}
Also used : MNode(gov.sandia.n2a.db.MNode)

Example 44 with MNode

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;
}
Also used : MNode(gov.sandia.n2a.db.MNode)

Example 45 with MNode

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;
}
Also used : PanelReference(gov.sandia.n2a.ui.ref.PanelReference) MNode(gov.sandia.n2a.db.MNode)

Aggregations

MNode (gov.sandia.n2a.db.MNode)63 Node (org.w3c.dom.Node)11 NameMap (gov.sandia.n2a.backend.neuroml.PartMap.NameMap)9 MVolatile (gov.sandia.n2a.db.MVolatile)5 MPart (gov.sandia.n2a.eqset.MPart)5 ArrayList (java.util.ArrayList)5 PanelModel (gov.sandia.n2a.ui.eq.PanelModel)4 MPersistent (gov.sandia.n2a.db.MPersistent)3 EquationSet (gov.sandia.n2a.eqset.EquationSet)3 Variable (gov.sandia.n2a.eqset.Variable)3 AccessVariable (gov.sandia.n2a.language.AccessVariable)3 PanelReference (gov.sandia.n2a.ui.ref.PanelReference)3 Element (org.w3c.dom.Element)3 NamedNodeMap (org.w3c.dom.NamedNodeMap)3 MDoc (gov.sandia.n2a.db.MDoc)2 ParseException (gov.sandia.n2a.language.ParseException)2 AddDoc (gov.sandia.n2a.ui.eq.undo.AddDoc)2 IOException (java.io.IOException)2 TreeMap (java.util.TreeMap)2 IncommensurableException (javax.measure.IncommensurableException)2