/** @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; }
public void getMetricDescriptions( AddressCallback address, Column[] columns, final AsyncCallback<HTML> callback) { final List<String> attributeNames = new LinkedList<String>(); for (Column c : columns) attributeNames.add(c.getDeytpedName()); final ModelNode operation = address.getAddress(); operation.get(OP).set(READ_RESOURCE_DESCRIPTION_OPERATION); operation.get(LOCALE).set(getLocale()); dispatcher.execute( new DMRAction(operation), new AsyncCallback<DMRResponse>() { @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { Log.debug(response.toString()); onFailure(new Exception(response.getFailureDescription())); } else { final SafeHtmlBuilder html = new SafeHtmlBuilder(); html.appendHtmlConstant("<table class='help-attribute-descriptions'>"); ModelNode payload = response.get(RESULT); ModelNode descriptionModel = null; if (ModelType.LIST.equals(payload.getType())) descriptionModel = payload.asList().get(0); else descriptionModel = payload; matchSubElements(descriptionModel, attributeNames, html); html.appendHtmlConstant("</table>"); callback.onSuccess(new HTML(html.toSafeHtml())); } } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); }