Search in sources :

Example 11 with Container

use of org.gwtbootstrap3.client.ui.Container 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;
}
Also used : Container(org.gwtbootstrap3.client.ui.Container) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) 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)

Example 12 with Container

use of org.gwtbootstrap3.client.ui.Container in project ovirt-engine by oVirt.

the class HostNetworkInterfaceListViewItem method createAdditionalInfoPanel.

protected void createAdditionalInfoPanel() {
    detailedInfoContainer = new Container();
    detailedInfoContainer.add(createLogicalNetworkInfo(getEntity().getInterfaces().get(0)));
    additionalInfoPanel.add(this.detailedInfoContainer);
}
Also used : Container(org.gwtbootstrap3.client.ui.Container)

Example 13 with Container

use of org.gwtbootstrap3.client.ui.Container in project kie-wb-common by kiegroup.

the class ActivityDataIOEditorViewImpl method init.

public void init(final Presenter presenter) {
    this.presenter = presenter;
    container.setFluid(true);
    container.add(row);
    row.add(column);
    setTitle(StunnerFormsClientFieldsConstants.INSTANCE.Data_IO());
    inputAssignmentsWidget.setVariableType(Variable.VariableType.INPUT);
    inputAssignmentsWidget.setAllowDuplicateNames(false, StunnerFormsClientFieldsConstants.INSTANCE.A_Data_Input_with_this_name_already_exists());
    column.add(inputAssignmentsWidget.getWidget());
    outputAssignmentsWidget.setVariableType(Variable.VariableType.OUTPUT);
    outputAssignmentsWidget.setAllowDuplicateNames(true, "");
    column.add(outputAssignmentsWidget.getWidget());
    final Row btnRow = new Row();
    btnRow.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    final Column btnColumn = new Column(ColumnSize.MD_12);
    btnRow.add(btnColumn);
    btnSave = new Button(StunnerFormsClientFieldsConstants.INSTANCE.Save());
    btnSave.setType(ButtonType.PRIMARY);
    btnSave.setIcon(IconType.SAVE);
    btnSave.setPull(Pull.RIGHT);
    btnSave.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            presenter.handleSaveClick();
        }
    });
    btnColumn.add(btnSave);
    btnCancel = new Button(StunnerFormsClientFieldsConstants.INSTANCE.Cancel());
    btnCancel.setPull(Pull.RIGHT);
    btnCancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            presenter.handleCancelClick();
        }
    });
    btnColumn.add(btnCancel);
    container.add(btnRow);
    setBody(container);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Column(org.gwtbootstrap3.client.ui.Column) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Row(org.gwtbootstrap3.client.ui.Row)

Example 14 with Container

use of org.gwtbootstrap3.client.ui.Container in project ovirt-engine by oVirt.

the class HostNetworkInterfaceBondedListViewItem method createSlavesContainer.

private Container createSlavesContainer() {
    Row content = new Row();
    Column gridColumn = new Column(ColumnSize.SM_12);
    content.add(gridColumn);
    Container container = createItemContainerPanel(content);
    CellTable<HostInterface> slavesTable = new CellTable<>(MAX_SLAVES, (Resources) GWT.create(CellTablePopupTableResources.class));
    slavesTable.getElement().addClassName(Styles.TABLE);
    slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
    slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
    ListDataProvider<HostInterface> logicalNetworkDataProvider = new ListDataProvider<>();
    logicalNetworkDataProvider.addDataDisplay(slavesTable);
    logicalNetworkDataProvider.setList(getEntity().getInterfaces());
    // Setup columns
    TextColumn<HostInterface> name = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getName();
        }
    };
    slavesTable.addColumn(name, constants.macInterface());
    TextColumn<HostInterface> macAddress = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getInterface().getMacAddress() != null ? hostInterface.getInterface().getMacAddress() : constants.unAvailablePropertyLabel();
        }
    };
    slavesTable.addColumn(macAddress, constants.macInterface());
    TextColumn<HostInterface> speed = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getInterface().hasSpeed() ? String.valueOf(hostInterface.getInterface().getSpeed()) : constants.unAvailablePropertyLabel();
        }
    };
    slavesTable.addColumn(speed, constants.speedInterface());
    TextColumn<HostInterface> rxRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return rateRenderer.render(new Double[] { hostInterface.getRxRate(), hostInterface.getSpeed().doubleValue() });
        }
    };
    slavesTable.addColumn(rxRate, templates.sub(constants.rxRate(), constants.mbps()));
    TextColumn<HostInterface> txRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return rateRenderer.render(new Double[] { hostInterface.getTxRate(), hostInterface.getSpeed().doubleValue() });
        }
    };
    slavesTable.addColumn(txRate, templates.sub(constants.txRate(), constants.mbps()));
    TextColumn<HostInterface> rxTotal = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return totalRenderer.render(hostInterface.getRxTotal());
        }
    };
    slavesTable.addColumn(rxTotal, templates.sub(constants.rxTotal(), constants.mbps()));
    TextColumn<HostInterface> txTotal = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return totalRenderer.render(hostInterface.getTxTotal());
        }
    };
    slavesTable.addColumn(txTotal, templates.sub(constants.txTotal(), constants.mbps()));
    TextColumn<HostInterface> dropRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return String.valueOf(hostInterface.getRxDrop() + hostInterface.getTxDrop());
        }
    };
    slavesTable.addColumn(dropRate, templates.sub(constants.dropsInterface(), constants.pkts()));
    gridColumn.add(slavesTable);
    return container;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) Container(org.gwtbootstrap3.client.ui.Container) Column(org.gwtbootstrap3.client.ui.Column) TextColumn(com.google.gwt.user.cellview.client.TextColumn) CellTable(com.google.gwt.user.cellview.client.CellTable) HostInterface(org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterface) Row(org.gwtbootstrap3.client.ui.Row) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 15 with Container

use of org.gwtbootstrap3.client.ui.Container in project ovirt-engine by oVirt.

the class HostNetworkInterfaceListViewItem method createLogicalNetworkContainer.

private Container createLogicalNetworkContainer() {
    List<HostVLan> logicalNetworks = calculateLogicalNetworks(getEntity());
    Row content = new Row();
    Column gridColumn = new Column(ColumnSize.SM_12);
    content.add(gridColumn);
    Container container = createItemContainerPanel(content);
    CellTable<HostVLan> logicalNetworkTable = new CellTable<>(MAX_LOGICAL_NETWORKS, (Resources) GWT.create(CellTablePopupTableResources.class));
    logicalNetworkTable.getElement().addClassName(Styles.TABLE);
    logicalNetworkTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
    logicalNetworkTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
    ListDataProvider<HostVLan> logicalNetworkDataProvider = new ListDataProvider<>();
    logicalNetworkDataProvider.addDataDisplay(logicalNetworkTable);
    logicalNetworkDataProvider.setList(logicalNetworks);
    final HostVLanNameRenderer renderer = new HostVLanNameRenderer();
    // Setup columns
    AbstractIconTypeColumn<HostVLan> management = new AbstractIconTypeColumn<HostVLan>() {

        @Override
        public IconType getValue(HostVLan logicalNetwork) {
            if (logicalNetwork.getInterface() != null && logicalNetwork.getInterface().getIsManagement()) {
                return IconType.INSTITUTION;
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(HostVLan logicalNetwork) {
            return SafeHtmlUtils.fromSafeConstant(constants.managementNetworkLabel());
        }
    };
    IconTypeHeader managementHeader = new IconTypeHeader(IconType.INSTITUTION, ICON_COLOR, SafeHtmlUtils.fromSafeConstant(constants.managementNetworkLabel()));
    management.getCell().setColor(SafeHtmlUtils.fromSafeConstant(ICON_COLOR));
    logicalNetworkTable.addColumn(management, managementHeader);
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(management, "40px");
    AbstractIconTypeColumn<HostVLan> sync = new AbstractIconTypeColumn<HostVLan>() {

        @Override
        public IconType getValue(HostVLan logicalNetwork) {
            if (logicalNetwork != null && logicalNetwork.getInterface() != null && isOutOfSync(logicalNetwork.getInterface().getNetworkImplementationDetails())) {
                return IconType.CHAIN_BROKEN;
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(HostVLan logicalNetwork) {
            return SafeHtmlUtils.fromSafeConstant(constants.hostOutOfSync());
        }
    };
    IconTypeHeader syncHeader = new IconTypeHeader(IconType.CHAIN_BROKEN, ICON_COLOR, SafeHtmlUtils.fromSafeConstant(constants.hostOutOfSync()));
    sync.getCell().setColor(SafeHtmlUtils.fromSafeConstant(RED));
    logicalNetworkTable.addColumn(sync, syncHeader);
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(sync, "40px");
    TextColumn<HostVLan> vlan = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            if (logicalNetwork == null || logicalNetwork.getName() == null || logicalNetwork.getName().isEmpty()) {
                return "";
            }
            return renderer.render(logicalNetwork);
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(vlan, "175px");
    logicalNetworkTable.addColumn(vlan, constants.vlanInterface());
    TextColumn<HostVLan> networkName = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getNetworkName();
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(networkName, "175px");
    logicalNetworkTable.addColumn(networkName, constants.networkNameInterface());
    TextColumn<HostVLan> ipv4 = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getIpv4Address() != null ? logicalNetwork.getIpv4Address() : "";
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(ipv4, "175px");
    logicalNetworkTable.addColumn(ipv4, constants.ipv4AddressInterface());
    TextColumn<HostVLan> ipv6 = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getIpv6Address() != null ? logicalNetwork.getIpv6Address() : "";
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(ipv6, "175px");
    logicalNetworkTable.addColumn(ipv6, constants.ipv6AddressInterface());
    TextColumn<HostVLan> emptyTail = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return "";
        }
    };
    logicalNetworkTable.addColumn(emptyTail, "");
    gridColumn.add(logicalNetworkTable);
    return container;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) HostVLanNameRenderer(org.ovirt.engine.ui.webadmin.widget.renderer.HostVLanNameRenderer) Container(org.gwtbootstrap3.client.ui.Container) Column(org.gwtbootstrap3.client.ui.Column) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) CellTable(com.google.gwt.user.cellview.client.CellTable) IconTypeHeader(org.ovirt.engine.ui.common.widget.table.header.IconTypeHeader) HostVLan(org.ovirt.engine.ui.uicommonweb.models.hosts.HostVLan) Row(org.gwtbootstrap3.client.ui.Row) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Aggregations

Column (org.gwtbootstrap3.client.ui.Column)13 Row (org.gwtbootstrap3.client.ui.Row)13 DListElement (com.google.gwt.dom.client.DListElement)7 Container (org.gwtbootstrap3.client.ui.Container)7 CellTable (com.google.gwt.user.cellview.client.CellTable)2 TextColumn (com.google.gwt.user.cellview.client.TextColumn)2 ListDataProvider (com.google.gwt.view.client.ListDataProvider)2 Button (org.gwtbootstrap3.client.ui.Button)2 Label (org.gwtbootstrap3.client.ui.Label)2 Span (org.gwtbootstrap3.client.ui.html.Span)2 RxTxRateRenderer (org.ovirt.engine.ui.common.widget.renderer.RxTxRateRenderer)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1