Search in sources :

Example 1 with ColumnFormatter

use of com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter in project ovirt-engine by oVirt.

the class BondPanel method getContents.

@Override
protected Widget getContents() {
    VerticalPanel vPanel = new VerticalPanel();
    // $NON-NLS-1$
    vPanel.addStyleName("ts5");
    // $NON-NLS-1$
    vPanel.setWidth("100%");
    Grid titleRow = new Grid(1, 3);
    // $NON-NLS-1$
    titleRow.addStyleName("ts3");
    ColumnFormatter columnFormatter = titleRow.getColumnFormatter();
    // $NON-NLS-1$
    columnFormatter.setWidth(0, "30px");
    // $NON-NLS-1$
    columnFormatter.setWidth(1, "100%");
    // $NON-NLS-1$
    titleRow.setWidth("100%");
    // $NON-NLS-1$
    titleRow.setHeight("27px");
    Label titleLabel = new Label(item.getName());
    // $NON-NLS-1$
    titleLabel.setHeight("100%");
    Image bondImage = new Image(resources.bond());
    titleRow.setWidget(0, 0, bondImage);
    titleRow.setWidget(0, 1, titleLabel);
    titleRow.setWidget(0, 2, actionButton);
    // $NON-NLS-1$
    titleRow.addStyleName("ts3");
    titleRow.setCellPadding(3);
    vPanel.add(titleRow);
    getElement().addClassName(style.bondPanel());
    List<NetworkInterfaceModel> bonded = ((BondNetworkInterfaceModel) item).getSlaves();
    Collections.sort(bonded);
    for (NetworkInterfaceModel networkInterfaceModel : bonded) {
        NicPanel nicPanel = new NicPanel(networkInterfaceModel, style);
        nicPanel.parentPanel = this;
        if (!networkInterfaceModel.isSriovEnabled()) {
            nicPanel.actionButton.setVisible(false);
        }
        vPanel.add(nicPanel);
    }
    return vPanel;
}
Also used : BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) Grid(com.google.gwt.user.client.ui.Grid) Label(com.google.gwt.user.client.ui.Label) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)

Example 2 with ColumnFormatter

use of com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter in project ovirt-engine by oVirt.

the class NetworkLabelPanel method getContents.

@Override
protected Widget getContents() {
    VerticalPanel vPanel = new VerticalPanel();
    // $NON-NLS-1$
    vPanel.addStyleName("ts5");
    // $NON-NLS-1$
    vPanel.setWidth("100%");
    Grid titleRow = new Grid(1, 2);
    // $NON-NLS-1$
    titleRow.addStyleName("ts3");
    ColumnFormatter columnFormatter = titleRow.getColumnFormatter();
    // $NON-NLS-1$
    columnFormatter.setWidth(0, "30px");
    // $NON-NLS-1$
    columnFormatter.setWidth(1, "100%");
    // $NON-NLS-1$
    titleRow.setWidth("100%");
    // $NON-NLS-1$
    titleRow.setHeight("27px");
    LabelWithTextTruncation titleLabel = new LabelWithTextTruncation(item.getName());
    // $NON-NLS-1$
    titleLabel.setWidth("185px");
    // $NON-NLS-1$
    titleLabel.setHeight("100%");
    Image labelImage = new Image(resources.tagImage());
    titleRow.setWidget(0, 0, labelImage);
    titleRow.setWidget(0, 1, titleLabel);
    // $NON-NLS-1$
    titleRow.addStyleName("ts3");
    // $NON-NLS-1$
    titleRow.addStyleName("tp3");
    vPanel.add(titleRow);
    addClassName();
    List<LogicalNetworkModel> networks = item.getNetworks();
    Collections.sort(networks);
    for (LogicalNetworkModel network : networks) {
        InternalNetworkPanel networkPanel = new InternalNetworkPanel(network, style, false);
        networkPanel.parentPanel = this;
        vPanel.add(networkPanel);
    }
    return vPanel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Grid(com.google.gwt.user.client.ui.Grid) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter) LabelWithTextTruncation(org.ovirt.engine.ui.common.widget.label.LabelWithTextTruncation)

Example 3 with ColumnFormatter

use of com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter in project ovirt-engine by oVirt.

the class NetworkPanel method getContents.

@Override
protected Widget getContents() {
    Image mgmtNetworkImage;
    Image defaultRouteImage;
    Image vmImage;
    Image monitorImage;
    Image migrationImage;
    Image notSyncImage;
    Image alertImage;
    Image glusterNwImage;
    if (!item.isManaged()) {
        monitorImage = null;
        mgmtNetworkImage = null;
        defaultRouteImage = null;
        vmImage = null;
        migrationImage = null;
        glusterNwImage = null;
        notSyncImage = null;
        alertImage = null;
    } else {
        NetworkCluster networkCluster = item.getNetwork().getCluster();
        monitorImage = networkCluster.isDisplay() ? new Image(resources.networkMonitor()) : null;
        mgmtNetworkImage = item.isManagement() ? new Image(resources.mgmtNetwork()) : null;
        defaultRouteImage = networkCluster.isDefaultRoute() ? new Image(resources.defaultRouteNetwork()) : null;
        vmImage = item.getNetwork().isVmNetwork() ? new Image(resources.networkVm()) : null;
        migrationImage = networkCluster.isMigration() ? new Image(resources.migrationNetwork()) : null;
        glusterNwImage = networkCluster.isGluster() ? new Image(resources.glusterNetwork()) : null;
        notSyncImage = !item.isInSync() ? new Image(resources.networkNotSyncImage()) : null;
        alertImage = item.getErrorMessage() != null ? new Image(resources.alertImage()) : null;
        if (item.isManagement()) {
            mgmtNetworkImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (item.getNetwork().isVmNetwork()) {
            vmImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isDisplay()) {
            monitorImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isMigration()) {
            migrationImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isDefaultRoute()) {
            defaultRouteImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (networkCluster.isGluster()) {
            glusterNwImage.setStylePrimaryName(style.networkImageBorder());
        }
        if (!item.isInSync()) {
            notSyncImage.setStylePrimaryName(style.syncImageBorder());
        }
    }
    actionButton.setVisible(item.getAttachedToNic() != null && (item.isManaged() || !item.isAttachedViaLabel()));
    Grid rowPanel = new Grid(item.hasVlan() ? 2 : 1, 10);
    rowPanel.setCellSpacing(0);
    // $NON-NLS-1$
    rowPanel.setWidth("100%");
    // $NON-NLS-1$
    rowPanel.setHeight("100%");
    ColumnFormatter columnFormatter = rowPanel.getColumnFormatter();
    // $NON-NLS-1$
    columnFormatter.setWidth(0, "5px");
    // $NON-NLS-1$
    columnFormatter.setWidth(1, "20px");
    // $NON-NLS-1$
    columnFormatter.setWidth(2, "100%");
    rowPanel.setWidget(0, 0, dragImage);
    Panel statusPanel = new HorizontalPanel();
    statusPanel.setStylePrimaryName(style.networkStatusPanel());
    rowPanel.setWidget(0, 1, statusPanel);
    if (alertImage != null) {
        statusPanel.add(alertImage);
    }
    ImageResource statusImage = getStatusImage();
    if (statusImage != null) {
        statusPanel.add(new Image(statusImage));
    }
    if (notSyncImage != null) {
        statusPanel.add(notSyncImage);
    }
    rowPanel.setWidget(0, 2, createTitlePanel());
    rowPanel.setWidget(0, 3, mgmtNetworkImage);
    rowPanel.setWidget(0, 4, monitorImage);
    rowPanel.setWidget(0, 5, vmImage);
    rowPanel.setWidget(0, 6, migrationImage);
    rowPanel.setWidget(0, 7, glusterNwImage);
    rowPanel.setWidget(0, 8, defaultRouteImage);
    rowPanel.setWidget(0, 9, actionButton);
    if (item.hasVlan()) {
        rowPanel.setWidget(1, 2, createVlanPanel());
        for (int i = 3; i < rowPanel.getColumnCount(); i++) {
            // we need to clear the unused widgets, otherwise there will be few pixels wide empty space
            rowPanel.setWidget(1, i, null);
        }
    }
    return rowPanel;
}
Also used : Panel(com.google.gwt.user.client.ui.Panel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ImageResource(com.google.gwt.resources.client.ImageResource) Grid(com.google.gwt.user.client.ui.Grid) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)

Example 4 with ColumnFormatter

use of com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter in project ovirt-engine by oVirt.

the class NicPanel method getContents.

@Override
protected Widget getContents() {
    Grid rowPanel = new Grid(1, 5);
    // $NON-NLS-1$
    rowPanel.addStyleName("ts3");
    // $NON-NLS-1$
    rowPanel.setWidth("100%");
    // $NON-NLS-1$
    rowPanel.setHeight("100%");
    ColumnFormatter columnFormatter = rowPanel.getColumnFormatter();
    // $NON-NLS-1$
    columnFormatter.setWidth(0, "5px");
    // $NON-NLS-1$
    columnFormatter.setWidth(1, "10px");
    // $NON-NLS-1$
    columnFormatter.setWidth(2, "30px");
    // $NON-NLS-1$
    columnFormatter.setWidth(3, "100%");
    // $NON-NLS-1$
    columnFormatter.setWidth(4, "30px");
    Label titleLabel = new Label(item.getName());
    // $NON-NLS-1$
    titleLabel.setHeight("100%");
    Image nicImage = new Image(getNicIcon());
    rowPanel.setWidget(0, 0, dragImage);
    ImageResource statusImage = getStatusImage();
    if (statusImage != null) {
        rowPanel.setWidget(0, 1, new Image(statusImage));
    }
    rowPanel.setWidget(0, 2, nicImage);
    rowPanel.setWidget(0, 3, titleLabel);
    rowPanel.setWidget(0, 4, actionButton);
    actionButton.setVisible(item.isSriovEnabled());
    return rowPanel;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) Grid(com.google.gwt.user.client.ui.Grid) Label(com.google.gwt.user.client.ui.Label) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)

Aggregations

Grid (com.google.gwt.user.client.ui.Grid)4 ColumnFormatter (com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)4 Image (com.google.gwt.user.client.ui.Image)4 ImageResource (com.google.gwt.resources.client.ImageResource)2 Label (com.google.gwt.user.client.ui.Label)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 Panel (com.google.gwt.user.client.ui.Panel)1 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)1 LabelWithTextTruncation (org.ovirt.engine.ui.common.widget.label.LabelWithTextTruncation)1 BondNetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel)1 LogicalNetworkModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel)1 NetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel)1