public void updateStatsSubmitUI() { File explist = new File(m_curSQExp + "/EXPLIST"); File enterSQ = new File(m_curSQExp + "/tmpstudy/enterSQ"); Map<String, String> titleToIdMap = getTitleToIdMap(explist, enterSQ); String curSampleDir = getDataDir(m_autodir); File acqlist = new File(m_archiveDir + "/" + curSampleDir + "/dirinfo/macdir/ACQlist"); Map<String, String> expStats = getExpStats(acqlist); Set<String> titles = titleToIdMap.keySet(); for (String title : titles) { String node = titleToIdMap.get(title); String status = expStats.get(title); if (status == null) { status = SQ_READY; } else if (status.equals(SQ_ACTIVE)) { status = SQ_EXECUTING; } m_studyQueue.processCommand(SET + " " + node + " " + ATTR_STATUS + " " + status); } // Set the parent title to show the current sample number // m_studyQueue.processCommand(SET + " tmpstudy " + ATTR_TITLE // + " \"Sample " + m_sampleNumber + "\""); // m_studyQueue.processCommand(SET + " tmpstudy " + ATTR_TOOLTEXT // + " \"\""); }
private SQNode getNodeInfoFromSQ(String nodeId) { SQNode nodeInfo = null; ProtocolBuilder mgr = m_studyQueue.getMgr(); VElement velem = mgr.getElement(nodeId); if (velem != null) { nodeInfo = new SQNode(); for (String attr : SQNode.getStandardAttributes()) { String value = mgr.getAttribute(velem, attr); nodeInfo.setAttr(attr, value); } } // String when = ""; // String[] whenEnums = {"_day", "_night"}; // for (String w : whenEnums) { // if (psLabel.contains(w)) { // when = w; // psLabel = psLabel.replace(w, ""); // } // if (title.contains(w)) { // when = w; // title = title.replace(w, ""); // } // } return nodeInfo; }
private List<String> getNodeIdsFromSQ(int nodeType) { ProtocolBuilder mgr = m_studyQueue.getMgr(); ArrayList<VElement> elementList; elementList = mgr.getElements(null, nodeType); ArrayList<String> ids = new ArrayList<String>(); for (VElement elem : elementList) { ids.add(elem.getAttribute(ProtocolBuilder.ATTR_ID)); } return ids; }
private String removeSampleInfoNode(List<String> ids) { String id = null; if (ids.size() > 0) { ProtocolBuilder mgr = m_studyQueue.getMgr(); VElement vnode = mgr.getElement(ids.get(0)); String title = mgr.getAttribute(vnode, ATTR_TITLE); if (title.contains("SampleInfo")) { id = ids.remove(0); } } return id; }
private boolean updateNodeInSQ(String id, SQNode srcNode, List<String> changed) { boolean ok = false; ProtocolBuilder mgr = m_studyQueue.getMgr(); VElement elem = mgr.getElement(id); if (elem != null) { for (String attr : changed) { String value = srcNode.getAttr(attr); mgr.setAttribute(elem, attr, value); } ok = true; } return ok; }
public void updateStatsBgstudyUI() { Messages.postDebug("SQUpdater", "updateStatsBgstudyUI"); List<String> nodes = getNodeIdsFromSQ(ProtocolBuilder.ACTIONS); Map<String, String> expStats = getExpStats(new File(m_dataWatchPath)); File f = new File(m_dataDir + "/dirinfo/parlib/parliblist"); Map<String, String> fidNames = getFidNames(f); // boolean done = nodes.size() > 0; ProtocolBuilder mgr = m_studyQueue.getMgr(); for (String node : nodes) { VElement vnode = mgr.getElement(node); String title = mgr.getAttribute(vnode, ATTR_TITLE); String stat = getValueFromTitle(title, expStats); if (stat != null) { mgr.setAttribute(vnode, ATTR_STATUS, stat); if (stat.equals(SQ_COMPLETED)) { String fidname = getValueFromTitle(title, fidNames); if (fidname != null) { mgr.setAttribute(vnode, ATTR_TITLE, fidname); } } } // // See if this node still may change // stat = m_studyQueue.getAttribute(node, ATTR_STATUS); // if (stat != null) { // if (stat.equalsIgnoreCase(READY) // || stat.equalsIgnoreCase(QUEUED) // || stat.equalsIgnoreCase(EXECUTING) // ) // { // done = false; // } // } } // // Clean up if we're done // // Keep getting false positives on this // // ... check how many updates we've done? // if (done) { // Util.sendToVnmr("SQWatch('off')"); // Util.sendToVnmr("xmhaha('refreshSQ')"); // } }
public void updateStatsMoreUI() { List<String> stats = null; String curSampleDir = getDataDir(m_autodir); File acqlist = new File(m_archiveDir + "/" + curSampleDir + "/dirinfo/macdir/ACQlist"); stats = getStatList(acqlist); File enterSQ = new File(m_curSQExp + "/tmpstudy/enterSQ"); List<String> nodes = getNodeList(enterSQ); int len = nodes.size(); int statsLen = stats.size(); for (int i = 0; i < len; i++) { String node = nodes.get(i); String status = i < statsLen ? stats.get(i) : SQ_READY; if (status.equals(SQ_ACTIVE)) { status = SQ_EXECUTING; } m_studyQueue.processCommand(SET + " " + node + " " + ATTR_STATUS + " " + status); } }
private NamedNodeMap getNodeAttributesFromSQ(String nodeId) { ProtocolBuilder mgr = m_studyQueue.getMgr(); VElement velem = mgr.getElement(nodeId); NamedNodeMap attrs = velem.getAttributes(); return attrs; }