Search in sources :

Example 6 with NoItemsLabel

use of org.ovirt.engine.ui.common.widget.label.NoItemsLabel in project ovirt-engine by oVirt.

the class RegisterEntityInfoPanel method initNicsTable.

protected void initNicsTable() {
    nicsTable = new EntityModelCellTable<>(false, true);
    nicsTable.enableColumnResizing();
    AbstractTextColumn<VmNetworkInterface> nameColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(nameColumn, constants.nameInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> networkNameColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getNetworkName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(networkNameColumn, constants.networkNameInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> profileNameColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getVnicProfileName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(profileNameColumn, constants.profileNameInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> typeColumn = new AbstractEnumColumn<VmNetworkInterface, VmInterfaceType>() {

        @Override
        protected VmInterfaceType getRawValue(VmNetworkInterface object) {
            return VmInterfaceType.forValue(object.getType());
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(typeColumn, constants.typeInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> macColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getMacAddress();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(macColumn, constants.macInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> speedColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            if (object.getSpeed() != null) {
                return object.getSpeed().toString();
            } else {
                return null;
            }
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(speedColumn, templates.sub(constants.speedInterface(), constants.mbps()), "90px");
    AbstractTextColumn<VmNetworkInterface> rxColumn = new AbstractRxTxRateColumn<VmNetworkInterface>() {

        @Override
        protected Double getRate(VmNetworkInterface object) {
            return object.getStatistics().getReceiveRate();
        }

        @Override
        protected Double getSpeed(VmNetworkInterface object) {
            if (object.getSpeed() != null) {
                return object.getSpeed().doubleValue();
            } else {
                return null;
            }
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(rxColumn, templates.sub(constants.rxRate(), constants.mbps()), "90px");
    AbstractTextColumn<VmNetworkInterface> txColumn = new AbstractRxTxRateColumn<VmNetworkInterface>() {

        @Override
        protected Double getRate(VmNetworkInterface object) {
            return object.getStatistics().getTransmitRate();
        }

        @Override
        protected Double getSpeed(VmNetworkInterface object) {
            if (object.getSpeed() != null) {
                return object.getSpeed().doubleValue();
            } else {
                return null;
            }
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(txColumn, templates.sub(constants.txRate(), constants.mbps()), "90px");
    AbstractTextColumn<VmNetworkInterface> dropsColumn = new AbstractSumUpColumn<VmNetworkInterface>() {

        @Override
        protected Double[] getRawValue(VmNetworkInterface object) {
            Double receiveDropRate = object != null ? object.getStatistics().getReceiveDropRate() : null;
            Double transmitDropRate = object != null ? object.getStatistics().getTransmitDropRate() : null;
            return new Double[] { receiveDropRate, transmitDropRate };
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(dropsColumn, templates.sub(constants.dropsInterface(), constants.pkts()), "90px");
    nicsTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    nicsTable.setWidth("100%");
    nicsTable.setSelectionModel(new NoSelectionModel());
    nicsTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RegisterEntityModel(org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel) AbstractSumUpColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSumUpColumn) AbstractRxTxRateColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractRxTxRateColumn)

Example 7 with NoItemsLabel

use of org.ovirt.engine.ui.common.widget.label.NoItemsLabel in project ovirt-engine by oVirt.

the class RegisterEntityInfoPanel method initDisksTable.

protected void initDisksTable() {
    disksTable = new EntityModelCellTable<>(false, true);
    disksTable.enableColumnResizing();
    AbstractTextColumn<Disk> aliasColumn = new AbstractTextColumn<Disk>() {

        @Override
        public String getValue(Disk object) {
            return object.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(aliasColumn, constants.aliasDisk(), "80px");
    AbstractDiskSizeColumn<Disk> sizeColumn = new AbstractDiskSizeColumn<Disk>() {

        @Override
        protected Long getRawValue(Disk object) {
            return object.getSize();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(sizeColumn, constants.provisionedSizeDisk(), "80px");
    AbstractDiskSizeColumn<Disk> actualSizeColumn = new AbstractDiskSizeColumn<Disk>() {

        @Override
        protected Long getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? ((DiskImage) object).getActualSizeInBytes() : 0;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(actualSizeColumn, constants.sizeDisk(), "80px");
    AbstractTextColumn<Disk> allocationColumn = new AbstractEnumColumn<Disk, VolumeType>() {

        @Override
        protected VolumeType getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? VolumeType.forValue(((DiskImage) object).getVolumeType().getValue()) : VolumeType.Unassigned;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(allocationColumn, constants.allocationDisk(), "110px");
    AbstractTextColumn<Disk> statusColumn = new AbstractEnumColumn<Disk, ImageStatus>() {

        @Override
        protected ImageStatus getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? ((DiskImage) object).getImageStatus() : ImageStatus.OK;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(statusColumn, constants.statusDisk(), "65px");
    AbstractTextColumn<Disk> diskStorageTypeColumn = new AbstractTextColumn<Disk>() {

        @Override
        public String getValue(Disk object) {
            return object.getDiskStorageType().toString();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(diskStorageTypeColumn, constants.storageTypeDisk(), "100px");
    AbstractTextColumn<Disk> dateCreatedColumn = new AbstractFullDateTimeColumn<Disk>() {

        @Override
        protected Date getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? ((DiskImage) object).getCreationDate() : null;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(dateCreatedColumn, constants.creationDateDisk(), "100px");
    AbstractTextColumn<Disk> descriptionColumn = new AbstractTextColumn<Disk>() {

        @Override
        public String getValue(Disk object) {
            return object.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(descriptionColumn, constants.descriptionDisk(), "100px");
    if (registerEntityModel.isQuotaEnabled()) {
        // $NON-NLS-1$
        disksTable.addColumn(getDiskQuotaColumn(), constants.quotaVm(), "100px");
    }
    disksTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    disksTable.setWidth("100%");
    disksTable.setSelectionModel(new NoSelectionModel());
    disksTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractFullDateTimeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RegisterEntityModel(org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 8 with NoItemsLabel

use of org.ovirt.engine.ui.common.widget.label.NoItemsLabel in project ovirt-engine by oVirt.

the class RegisterEntityInfoPanel method initContainersTable.

protected void initContainersTable() {
    containersTable = new EntityModelCellTable<>(false, true);
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getId().toString();
        }
    }, constants.idContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            // $NON-NLS-1$
            return String.join(", ", row.getNames());
        }
    }, constants.namesContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getImage();
        }
    }, constants.imageContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getCommand();
        }
    }, constants.commandContainer());
    containersTable.addColumn(new AbstractTextColumn<GuestContainer>() {

        @Override
        public String getValue(GuestContainer row) {
            return row.getStatus();
        }
    }, constants.statusContainer());
    containersTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    containersTable.setWidth("100%");
    containersTable.setSelectionModel(new NoSelectionModel());
    containersTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RegisterEntityModel(org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel) GuestContainer(org.ovirt.engine.core.common.businessentities.GuestContainer)

Aggregations

NoItemsLabel (org.ovirt.engine.ui.common.widget.label.NoItemsLabel)8 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)8 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)6 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)4 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)4 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)4 RegisterEntityModel (org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel)4 ImageResource (com.google.gwt.resources.client.ImageResource)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)3 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)3 ImageResourceHeader (org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)2 GuestContainer (org.ovirt.engine.core.common.businessentities.GuestContainer)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1 RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)1 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)1 AbstractRxTxRateColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractRxTxRateColumn)1 AbstractSumUpColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractSumUpColumn)1