Exemplo n.º 1
0
  /*
   * (non-Javadoc)
   * @see org.ow2.proactive_grid_cloud_portal.rm.client.Listeners.NodeSelectedListener#hostSelected(org.ow2.proactive_grid_cloud_portal.rm.client.NodeSource.Host)
   */
  public void hostSelected(Host h) {
    this.label.hide();
    this.nodeCanvas.hide();

    this.hostLabel.setContents("<h3>" + h.getHostName() + "</h3>");
    this.nodeMonitoring.close();
    this.hostMonitoring.close();
    this.hostMonitoring.init(h);
    this.hostCanvas.show();
  }
  /*
   * (non-Javadoc)
   * @see org.ow2.proactive_grid_cloud_portal.rm.client.Listeners.NodeSelectedListener#hostSelected(org.ow2.proactive_grid_cloud_portal.rm.client.NodeSource.Host)
   */
  public void hostSelected(Host h) {
    DetailViewerRecord dv = new DetailViewerRecord();

    dv.setAttribute("hostName", h.getHostName());
    dv.setAttribute("nodes", h.getNodes().size());

    this.hostDetails.setData(new DetailViewerRecord[] {dv});
    if (h.isVirtual()) {
      this.hostLabel.setIcon(RMImages.instance.host_virtual_16().getSafeUri().asString());
    } else {
      this.hostLabel.setIcon(RMImages.instance.host_16().getSafeUri().asString());
    }

    this.label.hide();
    this.nodeCanvas.hide();
    this.hostCanvas.show();
    this.nsCanvas.hide();

    this.selHost = h;
    this.selNS = null;
    this.selNode = null;
  }
  /*
   * (non-Javadoc)
   * @see org.ow2.proactive_grid_cloud_portal.rm.client.Listeners.NodeSelectedListener#nodeSourceSelected(org.ow2.proactive_grid_cloud_portal.rm.client.NodeSource)
   */
  public void nodeSourceSelected(NodeSource ns) {
    DetailViewerRecord dv = new DetailViewerRecord();

    int numNodes = 0;
    for (Host h : ns.getHosts().values()) numNodes += h.getNodes().size();

    dv.setAttribute("sourceName", ns.getSourceName());
    dv.setAttribute("description", ns.getSourceDescription());
    dv.setAttribute("nodeProvider", ns.getNodeSourceAdmin());
    dv.setAttribute("nodes", numNodes);
    dv.setAttribute("hosts", ns.getHosts().size());

    this.nsDetails.setData(new DetailViewerRecord[] {dv});

    this.label.hide();
    this.nodeCanvas.hide();
    this.hostCanvas.hide();
    this.nsCanvas.show();

    this.selHost = null;
    this.selNS = ns;
    this.selNode = null;
  }
  public void nodesUpdated(Map<String, NodeSource> nodes) {
    if (selNode != null) {
      for (NodeSource ns : nodes.values()) {
        if (selNode.getSourceName().equals(ns.getSourceName())) {

          Node depl = ns.getDeploying().get(selNode.getNodeUrl());
          if (depl != null) {
            nodeSelected(depl);
            return;
          }

          for (Host h : ns.getHosts().values()) {
            if (selNode.getHostName().equals(h.getHostName())) {

              for (Node n : h.getNodes().values()) {
                if (n.getNodeUrl().equals(selNode.getNodeUrl())) {
                  nodeSelected(n);
                  return;
                }
              }
            }
          }
        }
      }
    } else if (selHost != null) {
      for (NodeSource ns : nodes.values()) {
        if (ns.getSourceName().equals(selHost.getSourceName())) {

          for (Host h : ns.getHosts().values()) {
            if (selHost.getHostName().equals(h.getHostName())) {
              hostSelected(h);
              return;
            }
          }
        }
      }
    } else if (selNS != null) {
      for (NodeSource ns : nodes.values()) {
        if (ns.getSourceName().equals(selNS.getSourceName())) {
          nodeSourceSelected(ns);
          return;
        }
      }
    }

    nodeUnselected();
  }