Search in sources :

Example 11 with DListElement

use of com.google.gwt.dom.client.DListElement in project ovirt-engine by oVirt.

the class PatternflyListViewItem method addReverseDetailItem.

protected void addReverseDetailItem(SafeHtml label, SafeHtml value, DListElement parent) {
    // $NON-NLS-1$
    Element dt = Document.get().createElement("dt");
    // $NON-NLS-1$
    dt.setInnerSafeHtml(value);
    parent.appendChild(dt);
    // $NON-NLS-1$
    Element dd = Document.get().createElement("dd");
    dd.setInnerSafeHtml(label);
    parent.appendChild(dd);
}
Also used : DListElement(com.google.gwt.dom.client.DListElement) Element(com.google.gwt.dom.client.Element)

Example 12 with DListElement

use of com.google.gwt.dom.client.DListElement in project ovirt-engine by oVirt.

the class VmInterfaceListGroupItem method createGuestAgentContainerPanel.

private Container createGuestAgentContainerPanel(VmNetworkInterface networkInterface, List<VmGuestAgentInterface> allGuestAgentData) {
    Row content = new Row();
    Column column = new Column(ColumnSize.MD_12);
    content.add(column);
    for (VmGuestAgentInterface guestAgentInterface : allGuestAgentData) {
        if (guestAgentInterface.getMacAddress() != null && guestAgentInterface.getMacAddress().equals(networkInterface.getMacAddress())) {
            DListElement dl = Document.get().createDLElement();
            dl.addClassName(DL_HORIZONTAL);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.nameVmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getInterfaceName()), dl);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv4VmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getIpv4Addresses() != null ? String.join(COMMA_DELIMITER, guestAgentInterface.getIpv4Addresses()) : constants.notAvailableLabel()), dl);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv6VmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getIpv6Addresses() != null ? String.join(COMMA_DELIMITER, guestAgentInterface.getIpv6Addresses()) : constants.notAvailableLabel()), dl);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getMacAddress()), dl);
            column.getElement().appendChild(dl);
        }
    }
    if (allGuestAgentData.isEmpty()) {
        Span noDataSpan = new Span();
        noDataSpan.setText(constants.notAvailableLabel());
        column.add(noDataSpan);
    }
    return createItemContainerPanel(content);
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) Column(org.gwtbootstrap3.client.ui.Column) Row(org.gwtbootstrap3.client.ui.Row) DListElement(com.google.gwt.dom.client.DListElement) Span(org.gwtbootstrap3.client.ui.html.Span)

Example 13 with DListElement

use of com.google.gwt.dom.client.DListElement in project ovirt-engine by oVirt.

the class VmInterfaceListGroupItem method addNetworkMainInfo.

protected void addNetworkMainInfo(VmNetworkInterface networkInterface, HasWidgets targetPanel) {
    DListElement dl = Document.get().createDLElement();
    FlowPanel infoPanel = new FlowPanel();
    StringJoiner ipv4AddressJoiner = new StringJoiner(COMMA_DELIMITER);
    StringJoiner ipv6AddressJoiner = new StringJoiner(COMMA_DELIMITER);
    for (VmGuestAgentInterface guestAgentInterface : allGuestAgentData) {
        if (guestAgentInterface.getMacAddress() != null && networkInterface.getMacAddress().equals(guestAgentInterface.getMacAddress())) {
            if (guestAgentInterface.getIpv4Addresses() != null) {
                ipv4AddressJoiner.add(String.join(COMMA_DELIMITER, guestAgentInterface.getIpv4Addresses()));
            }
            if (guestAgentInterface.getIpv6Addresses() != null) {
                ipv6AddressJoiner.add(String.join(COMMA_DELIMITER, guestAgentInterface.getIpv6Addresses()));
            }
        }
    }
    String ipv4Address = ipv4AddressJoiner.toString();
    if (ipv4Address.isEmpty()) {
        ipv4Address = constants.notAvailableLabel();
    }
    String ipv6Address = ipv6AddressJoiner.toString();
    if (ipv6Address.isEmpty()) {
        ipv6Address = constants.notAvailableLabel();
    }
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.networkNameInterface()), SafeHtmlUtils.fromString(networkInterface.getNetworkName() != null ? networkInterface.getNetworkName() : constants.unAvailablePropertyLabel()), dl);
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv4VmGuestAgent()), SafeHtmlUtils.fromString(ipv4Address), dl);
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv6VmGuestAgent()), SafeHtmlUtils.fromString(ipv6Address), dl);
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), SafeHtmlUtils.fromString(networkInterface.getMacAddress()), dl);
    infoPanel.getElement().appendChild(dl);
    targetPanel.add(infoPanel);
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) DListElement(com.google.gwt.dom.client.DListElement) StringJoiner(java.util.StringJoiner)

Example 14 with DListElement

use of com.google.gwt.dom.client.DListElement 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);
}
Also used : Column(org.gwtbootstrap3.client.ui.Column) RxTxRateRenderer(org.ovirt.engine.ui.common.widget.renderer.RxTxRateRenderer) Row(org.gwtbootstrap3.client.ui.Row) DListElement(com.google.gwt.dom.client.DListElement) RxTxTotalRenderer(org.ovirt.engine.ui.common.widget.renderer.RxTxTotalRenderer)

Aggregations

DListElement (com.google.gwt.dom.client.DListElement)14 Column (org.gwtbootstrap3.client.ui.Column)10 Row (org.gwtbootstrap3.client.ui.Row)7 Element (com.google.gwt.dom.client.Element)3 TextColumn (com.google.gwt.user.cellview.client.TextColumn)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 AbstractIconTypeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn)3 VmGuestAgentInterface (org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface)2 RxTxRateRenderer (org.ovirt.engine.ui.common.widget.renderer.RxTxRateRenderer)2 StringJoiner (java.util.StringJoiner)1 Container (org.gwtbootstrap3.client.ui.Container)1 Span (org.gwtbootstrap3.client.ui.html.Span)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 RxTxTotalRenderer (org.ovirt.engine.ui.common.widget.renderer.RxTxTotalRenderer)1