Search in sources :

Example 11 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.

the class RegisterEntityInfoPanel method initAppsTable.

protected void initAppsTable() {
    appsTable = new EntityModelCellTable<>(false, true);
    AbstractTextColumn<String> appNameColumn = new AbstractTextColumn<String>() {

        @Override
        public String getValue(String appName) {
            return appName;
        }
    };
    appsTable.addColumn(appNameColumn, constants.nameSnapshot());
    appsTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    appsTable.setWidth("100%");
    appsTable.setSelectionModel(new NoSelectionModel());
    appsTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) 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)

Example 12 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.

the class RegisterVmPopupView method createEntityTable.

@Override
protected void createEntityTable(RegisterVmModel model) {
    entityTable.addColumn(new AbstractImageResourceColumn<RegisterVmData>() {

        @Override
        public ImageResource getValue(RegisterVmData registerVmData) {
            if (registerVmData.getError() != null) {
                return resources.errorImage();
            }
            if (registerVmData.getWarning() != null) {
                return resources.alertImage();
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(RegisterVmData registerVmData) {
            String problem;
            if (registerVmData.getError() != null) {
                problem = registerVmData.getError();
            } else {
                problem = registerVmData.getWarning();
            }
            return problem == null ? null : new SafeHtmlBuilder().appendEscapedLines(problem).toSafeHtml();
        }
    }, constants.empty(), // $NON-NLS-1$
    "20px");
    AbstractTextColumn<RegisterVmData> nameColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            return registerVmData.getVm().getName();
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(nameColumn, constants.nameVm(), "150px");
    AbstractTextColumn<RegisterVmData> originColumn = new AbstractEnumColumn<RegisterVmData, OriginType>() {

        @Override
        protected OriginType getRawValue(RegisterVmData registerVmData) {
            return registerVmData.getVm().getOrigin();
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(originColumn, constants.originVm(), "100px");
    AbstractTextColumn<RegisterVmData> memoryColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            int size = registerVmData.getVm().getVmMemSizeMb();
            return messages.megabytes(String.valueOf(size));
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(memoryColumn, constants.memoryVm(), "100px");
    AbstractTextColumn<RegisterVmData> cpuColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            int numOfCpus = registerVmData.getVm().getNumOfCpus();
            return String.valueOf(numOfCpus);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(cpuColumn, constants.cpusVm(), "50px");
    AbstractTextColumn<RegisterVmData> archColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            ArchitectureType clusterArch = registerVmData.getVm().getClusterArch();
            return String.valueOf(clusterArch);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(archColumn, constants.architectureVm(), "100px");
    AbstractTextColumn<RegisterVmData> diskColumn = new AbstractTextColumn<RegisterVmData>() {

        @Override
        public String getValue(RegisterVmData registerVmData) {
            int numOfDisks = registerVmData.getVm().getDiskMap().size();
            return String.valueOf(numOfDisks);
        }
    };
    // $NON-NLS-1$
    entityTable.addColumn(diskColumn, constants.disksVm(), "50px");
    // $NON-NLS-1$
    entityTable.addColumn(creatReassignMacsColumn(), new ReassignBadMacsHeader(), "150px");
    // $NON-NLS-1$
    entityTable.addColumn(createAllowPartialColumn(), constants.allowPartial(), "95px");
    // $NON-NLS-1$
    entityTable.addColumn(getClusterColumn(), constants.clusterVm(), "150px");
    if (model.isQuotaEnabled()) {
        // $NON-NLS-1$
        entityTable.addColumn(getClusterQuotaColumn(), constants.quotaVm(), "150px");
    }
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) RegisterVmData(org.ovirt.engine.ui.uicommonweb.models.vms.register.RegisterVmData) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)

Example 13 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.

the class VmDiskAttachPopupWidget method initLunDisksTable.

private void initLunDisksTable() {
    lunDiskTable.enableColumnResizing();
    AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "60px");
    AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "85px");
    AbstractTextColumn<EntityModel> lunIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getLUNId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(lunIdColumn, constants.lunIdSanStorage(), "60px");
    AbstractTextColumn<EntityModel> idColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getId().toString();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(idColumn, constants.idVmDiskTable(), "60px");
    AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>(SizeConverter.SizeUnit.GiB) {

        @Override
        protected Long getRawValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return (long) disk.getLun().getDeviceSize();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(sizeColumn, constants.devSizeSanStorage(), "70px");
    AbstractTextColumn<EntityModel> pathColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return String.valueOf(disk.getLun().getPathCount());
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(pathColumn, constants.pathSanStorage(), "40px");
    AbstractTextColumn<EntityModel> vendorIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getVendorId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(vendorIdColumn, constants.vendorIdSanStorage(), "70px");
    AbstractTextColumn<EntityModel> productIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getProductId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(productIdColumn, constants.productIdSanStorage(), "70px");
    AbstractTextColumn<EntityModel> serialColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getSerial();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(serialColumn, constants.serialSanStorage(), "70px");
    // $NON-NLS-1$
    lunDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
    lunDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
    "30px");
    lunDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    lunDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {

        @Override
        public ImageResource getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.isShareable() ? resources.shareableDiskIcon() : null;
        }

        @Override
        public SafeHtml getTooltip(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            if (disk.isShareable()) {
                return SafeHtmlUtils.fromSafeConstant(constants.shareable());
            }
            return null;
        }
    }, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
    "30px");
    // $NON-NLS-1$
    lunDiskTable.setWidth("100%");
    lunDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 14 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.

the class VmDiskAttachPopupWidget method initCinderDisksTable.

private void initCinderDisksTable() {
    cinderDiskTable.enableColumnResizing();
    AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            CinderDisk disk = (CinderDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "100px");
    AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            CinderDisk disk = (CinderDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "100px");
    AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>(SizeConverter.SizeUnit.GiB) {

        @Override
        protected Long getRawValue(EntityModel object) {
            CinderDisk disk = (CinderDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getSizeInGigabytes();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(sizeColumn, constants.provisionedSizeVmDiskTable(), "100px");
    // $NON-NLS-1$
    cinderDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
    AbstractTextColumn<EntityModel> cinderVolumeTypeColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.getCinderVolumeType();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(cinderVolumeTypeColumn, constants.cinderVolumeTypeDisk(), "90px");
    cinderDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
    "30px");
    cinderDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    cinderDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {

        @Override
        public ImageResource getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.isShareable() ? resources.shareableDiskIcon() : null;
        }

        @Override
        public SafeHtml getTooltip(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            if (disk.isShareable()) {
                return SafeHtmlUtils.fromSafeConstant(constants.shareable());
            }
            return null;
        }
    }, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
    "30px");
    // $NON-NLS-1$
    cinderDiskTable.setWidth("100%");
    cinderDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 15 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.

the class VmSnapshotInfoPanel method initNicsTable.

private 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(), "80px");
    AbstractTextColumn<VmNetworkInterface> networkNameColumn = new AbstractTextColumn<VmNetworkInterface>() {

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

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getVnicProfileName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(profileNameColumn, constants.profileNameInterface(), "80px");
    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(), "80px");
    AbstractTextColumn<VmNetworkInterface> macColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getMacAddress();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(macColumn, constants.macInterface(), "80px");
    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()), "80px");
    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()), "80px");
    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()), "80px");
    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()), "80px");
    nicsTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    nicsTable.setWidth("100%");
    nicsTable.setSelectionModel(new NoSelectionModel());
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) 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) AbstractSumUpColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSumUpColumn) AbstractRxTxRateColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractRxTxRateColumn)

Aggregations

AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)57 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)23 HashMap (java.util.HashMap)15 Map (java.util.Map)14 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)14 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)10 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)9 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)9 ImageResource (com.google.gwt.resources.client.ImageResource)8 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)7 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)7 Column (com.google.gwt.user.cellview.client.Column)6 ArrayList (java.util.ArrayList)6 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)6 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 NoItemsLabel (org.ovirt.engine.ui.common.widget.label.NoItemsLabel)6 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)6 List (java.util.List)5 GWT (com.google.gwt.core.client.GWT)4 VM (org.ovirt.engine.core.common.businessentities.VM)4