/** @return the control. */
  public Widget asWidget() {
    Column<?> containerTotalCountItem =
        new NumberColumn("ContainerTotalCount", "Total Count").setVisible(false);
    Column<?> totalCountItem = new NumberColumn("TotalCount", "Total Count").setBaseline(true);
    Column<?> successCountItem =
        new NumberColumn("SuccessCount", "Success Count").setComparisonColumn(totalCountItem);
    Column<?> faultCountItem =
        new NumberColumn("FaultCount", "Fault Count").setComparisonColumn(totalCountItem);
    if (_displaysChildMetrics) {
      totalCountItem.setComparisonColumn(containerTotalCountItem);
    }

    // XXX: these should really be "LongColumn"
    Column<?> containerTotalProcessingTime =
        new NumberColumn("ContainerTotalProcessingTime", "Total Processing Time")
            .setVisible(false)
            .setBaseline(true);
    Column<?> totalProcessingTimeItem =
        new NumberColumn("TotalProcessingTime", "Total Processing Time");
    if (_displaysChildMetrics) {
      totalProcessingTimeItem.setComparisonColumn(containerTotalProcessingTime);
    }

    // XXX: using TextColumn for long and double fields
    Column<?> averageProcessingTimeItem =
        new TextColumn("AverageProcessingTime", "Average Processing Time");
    Column<?> minProcessingTimeItem = new TextColumn("MinProcessingTime", "Min. Processing Time");
    Column<?> maxProcessingTimeItem = new TextColumn("MaxProcessingTime", "Max. Processing Time");

    _messageCounts = new PlainColumnView("Message Counts");
    _messageCounts.setColumns(
        containerTotalCountItem, totalCountItem, successCountItem, faultCountItem);

    _processingTimes = new PlainColumnView("Processing Times");
    _processingTimes.setColumns(
        containerTotalProcessingTime,
        totalProcessingTimeItem,
        averageProcessingTimeItem,
        minProcessingTimeItem,
        maxProcessingTimeItem);

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("fill-layout-width");

    panel.add(_messageCounts.asWidget());
    panel.add(_processingTimes.asWidget());
    return panel;
  }
  /** @param metrics the metrics to be displayed. */
  public void setMessageMetrics(MessageMetrics metrics) {
    Metric countMetric =
        new Metric(
            "0",
            "" + metrics.getTotalCount(),
            "" + metrics.getSuccessCount(),
            "" + metrics.getFaultCount());
    _messageCounts.addSample(countMetric);

    Metric timeMetric =
        new Metric(
            "0",
            "" + metrics.getTotalProcessingTime(),
            "" + metrics.getAverageProcessingTime(),
            "" + metrics.getMinProcessingTime(),
            "" + metrics.getMaxProcessingTime());
    _processingTimes.addSample(timeMetric);
  }
 /** Clear the display. */
 public void clear() {
   _messageCounts.clearSamples();
   _processingTimes.clearSamples();
 }