Exemplo n.º 1
0
  public void updateStatsBuild(boolean isInitial) {
    String archsamp = m_archiveDir + "/" + m_sample;
    String samplename = new File(archsamp).getName();
    List<String> filelist = new ArrayList<String>();
    filelist.add("fidlog");
    filelist.add("ACQlist");
    filelist.add("explist");
    filelist.add("EXPLIST");
    filelist.add("LONGLIST");
    SQBuild builder = new SQBuild(archsamp, samplename, m_autodir, filelist, false);
    String locdir = builder.getActiveLocdir();
    if (locdir != null) {
      locdir += "/current.fid/fid";
      if (!locdir.equals(m_activeLocdir)) {
        Messages.postDebug("SQActive", "New active locdir: " + locdir);
        m_currentFileWatcher.removePath(m_activeLocdir);
        m_activeLocdir = locdir;
        m_currentFileWatcher.addPath(m_activeLocdir);
      }
    }
    final SQNodeList nodeList = builder.getNodeList();
    final boolean initial = isInitial;

    // Run this in the Event Thread because it updates the GUI
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            updateStatsBuildUI(initial, nodeList, m_curSQExp);
          }
        });
  }
Exemplo n.º 2
0
  public void updateStatsBuildUI(boolean isInitial, SQNodeList nodeList, String cursqexp) {
    if (DebugOutput.isSetFor("AllSQUpdater")) {
      Messages.postDebug("--------------------- Calc node list:");
      SQBuild.printNodeList(nodeList);
      Messages.postDebug("--------------------- End calc nodes");
    }
    // TODO: All of updateStatsBuildUI needs cleaning up.
    // Get list of action nodes visible in the SQ
    List<String> visibleIds = getNodeIdsFromSQ(ProtocolBuilder.ACTIONS);
    String sampleInfoId = removeSampleInfoNode(visibleIds);
    if (DebugOutput.isSetFor("AllSQUpdater") && sampleInfoId != null) {
      Messages.postDebug("SampleInfo node ignored");
    }

    if (!isInitial && nodeList.size() != visibleIds.size()) {
      Messages.postDebug(
          "SQUpdater", "calc nodes: " + nodeList.size() + ", vis nodes: " + visibleIds.size());
      Util.sendToVnmr(m_updateCmd);
      if (DebugOutput.isSetFor("AllSQUpdater")) {
        Messages.postDebug(
            visibleIds.size() + " nodes visible in SQ; " + nodeList.size() + " calculated");

        // Print out the visibleNodes
        Messages.postDebug("--------------------- Visible node list:");
        SQNodeList visibleNodes = getNodeInfoFromSQ(visibleIds);
        for (SQNode node : visibleNodes) {
          Messages.postDebug(node.toString());
        }
        Messages.postDebug("--------------------- End visible nodes");
      }

    } else {
      // Get all attributes from the visible SQ nodes
      // Build list of the visible SQ Nodes
      SQNodeList visibleNodes = getNodeInfoFromSQ(visibleIds);

      if (DebugOutput.isSetFor("AllSQUpdater")) {
        Messages.postDebug("--------------------- Visible node attrs:");
        printAllNodeAttributes(visibleIds);
        Messages.postDebug("--------------------- End visible attrs");
      }

      // Find differences between nodeList and SQ
      boolean isDiff = false;
      if (DebugOutput.isSetFor("AllSQUpdater")) {
        Messages.postDebug("--------------------- Node diffs:");
      }
      for (int i = 0; i < nodeList.size(); i++) {
        SQNode node = nodeList.get(i);
        SQNode vnode = visibleNodes.get(i);
        String diffs = vnode.diff(node);
        if (diffs.length() > 0) {
          isDiff = true;
          if (DebugOutput.isSetFor("AllSQUpdater")) {
            Messages.postDebug("Node " + i + " (" + visibleIds.get(i) + ") differs:");
            Messages.postDebug(diffs);
          }

          //                    // TODO: May not need to check this stuff
          //                    String vstat = vnode.getStatus();
          //                    String cstat = node.getStatus();
          //                    Boolean completed = (cstat.equals(COMPLETED)
          //                                         && (vstat.equals(EXECUTING)
          //                                             || vstat.equals(ACTIVE)));
          //                    String vtitle = vnode.getTitle().trim();
          //                    // Displayed title may have other stuff after true title
          //                    String[] titleTokens = vtitle.split(" +", 2);
          //                    if (node.getTitle().contains(titleTokens[0]) || completed) {

          // Set some SQ node attributes to match calculated node
          List<String> changed = vnode.update(node);
          if (changed.size() > 0) {
            String nodeId = visibleIds.get(i);
            updateNodeInSQ(nodeId, vnode, changed);
            writePropFile(cursqexp, nodeId, vnode);
          }
          //                    }
        }
      }
      if (DebugOutput.isSetFor("AllSQUpdater")) {
        Messages.postDebug("--------------------- End node diffs");
      }
      if (!isDiff) {
        if (DebugOutput.isSetFor("SQUpdater")) {
          Messages.postDebug("NO DIFFERENCES");
        }
        //            } else {
        //                m_sqInfoDir = m_curSQExp + "/tmpstudy/info";
      }
    }
  }