Search in sources :

Example 1 with PanelReference

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

Example 2 with PanelReference

use of gov.sandia.n2a.ui.ref.PanelReference 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)

Example 3 with PanelReference

use of gov.sandia.n2a.ui.ref.PanelReference in project n2a by frothga.

the class ChangeEntry method rename.

public static void rename(String A, String B) {
    AppData.references.move(A, B);
    PanelReference pr = PanelReference.instance;
    MNode doc = AppData.references.child(B);
    // lazy; only loads if not already loaded
    pr.panelEntry.model.setRecord(doc);
    // If we didn't rebuild in previous line, then we need to update display with changed data.
    pr.panelEntry.model.fireTableRowsUpdated(0, 0);
    // likewise, focus only moves if it is not already on equation tree
    pr.panelEntry.table.requestFocusInWindow();
    pr.panelEntry.table.changeSelection(0, 1, false, false);
}
Also used : PanelReference(gov.sandia.n2a.ui.ref.PanelReference) MNode(gov.sandia.n2a.db.MNode)

Aggregations

MNode (gov.sandia.n2a.db.MNode)3 PanelReference (gov.sandia.n2a.ui.ref.PanelReference)3 MDoc (gov.sandia.n2a.db.MDoc)1