Ejemplo n.º 1
0
  private static void createAndShowGUI(String firstColumnName, List<String> statNames) {
    try {
      String lookAndFeel = UIManager.getSystemLookAndFeelClassName();
      UIManager.setLookAndFeel(lookAndFeel);
      JFrame.setDefaultLookAndFeelDecorated(true);
    } catch (SOAPFaultException sfe) {
      printSoapFaultException(sfe);
    } catch (Exception e) {
      e.printStackTrace();
    }

    JFrame frame = new JFrame("VITop");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    String[] columnNamesArray = new String[statNames.size() + 1];
    columnNamesArray[0] = firstColumnName;
    for (int i = 0; i < statNames.size(); i++) {
      columnNamesArray[i + 1] = statNames.get(i);
    }
    statsTable = new StatsTable(columnNamesArray);
    statsTable.setOpaque(true);
    frame.setContentPane(statsTable);

    frame.pack();
    frame.setVisible(true);
  }
Ejemplo n.º 2
0
  /**
   * @param midList
   * @param compMetric
   * @return
   * @throws RuntimeException
   * @throws RemoteException
   * @throws InvalidPropertyFaultMsg
   * @throws RuntimeFaultFaultMsg
   */
  private static XMLGregorianCalendar displayStats(
      List<PerfMetricId> midList, PerfCompositeMetric compMetric)
      throws RuntimeException, RemoteException, InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    if (compMetric == null || (compMetric.getEntity() == null)) {
      return null;
    }

    List<Object[]> data = new ArrayList<Object[]>();
    PerfEntityMetric entityMetric = (PerfEntityMetric) compMetric.getEntity();
    PerfMetricIntSeries intSeries = (PerfMetricIntSeries) entityMetric.getValue().get(0);
    int numSamples = entityMetric.getSampleInfo().size();

    XMLGregorianCalendar timeStamp =
        entityMetric.getSampleInfo().get(numSamples - 1).getTimestamp();
    long overallUsage = intSeries.getValue().get(numSamples - 1);
    System.out.println("Info Updated");
    int numColumns = midList.size() + 1;
    List<PerfEntityMetricBase> listpemb = compMetric.getChildEntity();
    List<PerfEntityMetricBase> childEntityMetric = listpemb;
    for (int childNum = 0; childNum < childEntityMetric.size(); childNum++) {
      PerfEntityMetric childStats = (PerfEntityMetric) childEntityMetric.get(childNum);
      String childName = getEntityName(childStats.getEntity());
      int numChildSamples = childStats.getSampleInfo().size();
      Object[] tableData = new Object[numColumns];
      tableData[0] = childName;

      for (int i = 0; i < childStats.getValue().size(); i++) {
        PerfMetricIntSeries childSeries = (PerfMetricIntSeries) childStats.getValue().get(i);
        int col = findStatsIndex(midList, childSeries.getId());
        if (col >= 0) {
          long statsVal = childSeries.getValue().get(numChildSamples - 1);
          tableData[col + 1] = new Long(statsVal);
        }
      }
      data.add(tableData);
    }

    if (statsTable != null) {
      statsTable.setData(timeStamp.toGregorianCalendar(), overallUsage, "Mhz", data);
    }
    return timeStamp;
  }