use of org.ovirt.engine.ui.common.widget.renderer.RxTxRateRenderer in project ovirt-engine by oVirt.
the class VmSnapshotListViewItem method createNicsItemContainerPanel.
private Container createNicsItemContainerPanel(List<VmNetworkInterface> nics) {
RxTxRateRenderer rateRenderer = new RxTxRateRenderer();
Row content = new Row();
Container container = createItemContainerPanel(content);
int i = 0;
for (VmNetworkInterface nic : nics) {
if (i % 4 == 0 && i > 0) {
content = new Row();
container.add(content);
}
Column column = new Column(calculateColSize(i));
content.add(column);
DListElement dl = Document.get().createDLElement();
dl.addClassName(DL_HORIZONTAL);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.nameInterface()), SafeHtmlUtils.fromString(nic.getName()), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.networkNameInterface()), SafeHtmlUtils.fromString(nic.getNetworkName()), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.profileNameInterface()), SafeHtmlUtils.fromString(nic.getVnicProfileName()), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.typeInterface()), SafeHtmlUtils.fromString(VmInterfaceType.forValue(nic.getType()).getDescription()), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macInterface()), SafeHtmlUtils.fromString(nic.getMacAddress()), dl);
addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { nic.getStatistics().getReceiveRate(), nic.hasSpeed() ? nic.getSpeed().doubleValue() : 0 })), dl);
addDetailItem(templates.sub(constants.txRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { nic.getStatistics().getTransmitRate(), nic.hasSpeed() ? nic.getSpeed().doubleValue() : 0 })), dl);
addDetailItem(templates.sub(constants.dropsInterface(), constants.pkts()), SafeHtmlUtils.fromString(String.valueOf(nic.getStatistics().getReceiveDropRate() != null ? nic.getStatistics().getReceiveDropRate() : "" + nic.getStatistics().getTransmitDropRate())), dl);
column.getElement().appendChild(dl);
i++;
}
if (nics.isEmpty()) {
Column column = new Column(ColumnSize.MD_12);
content.add(column);
column.getElement().setInnerHTML(constants.noItemsToDisplay());
}
return container;
}
use of org.ovirt.engine.ui.common.widget.renderer.RxTxRateRenderer in project ovirt-engine by oVirt.
the class VmInterfaceListGroupItem method createStatisticsItemContainerPanel.
private Container createStatisticsItemContainerPanel(VmNetworkInterface networkInterface) {
Row content = new Row();
Column column = new Column(ColumnSize.MD_12);
content.add(column);
RxTxRateRenderer rateRenderer = new RxTxRateRenderer();
RxTxTotalRenderer totalRenderer = new RxTxTotalRenderer();
DListElement dl = Document.get().createDLElement();
dl.addClassName(DL_HORIZONTAL);
addDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { networkInterface.getStatistics().getReceiveRate(), networkInterface.hasSpeed() ? networkInterface.getSpeed().doubleValue() : 0 })), dl);
addDetailItem(templates.sub(constants.txRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { networkInterface.getStatistics().getTransmitRate(), networkInterface.hasSpeed() ? networkInterface.getSpeed().doubleValue() : 0 })), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.rxTotal()), SafeHtmlUtils.fromString(totalRenderer.render(networkInterface.getStatistics().getReceivedBytes())), dl);
addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.txTotal()), SafeHtmlUtils.fromString(totalRenderer.render(networkInterface.getStatistics().getTransmittedBytes())), dl);
addDetailItem(templates.sub(constants.dropsInterface(), constants.pkts()), SafeHtmlUtils.fromString(String.valueOf(networkInterface.getStatistics().getReceiveDropRate() + networkInterface.getStatistics().getTransmitDropRate())), dl);
column.getElement().appendChild(dl);
return createItemContainerPanel(content);
}
Aggregations