Search in sources :

Example 6 with AbstractEnumColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn 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)

Example 7 with AbstractEnumColumn

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

the class ImportVmFromExternalProviderPopupView method initMainTable.

protected void initMainTable() {
    this.table = new ListModelObjectCellTable<>();
    AbstractCheckboxColumn<ImportVmData> cloneVMColumn = new AbstractCheckboxColumn<ImportVmData>((index, model, value) -> {
        model.getClone().setEntity(value);
        table.asEditor().edit(importModel);
    }) {

        @Override
        public Boolean getValue(ImportVmData model) {
            return model.getClone().getEntity();
        }

        @Override
        protected boolean canEdit(ImportVmData model) {
            return model.getClone().getIsChangable();
        }

        @Override
        protected String getDisabledMessage(ImportVmData model) {
            return model.getClone().getChangeProhibitionReason();
        }
    };
    // $NON-NLS-1$
    table.addColumn(cloneVMColumn, constants.cloneVM(), "50px");
    AbstractTextColumn<ImportVmData> nameColumn = new AbstractTextColumn<ImportVmData>() {

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

        @Override
        protected OriginType getRawValue(ImportVmData object) {
            return object.getVm().getOrigin();
        }
    };
    // $NON-NLS-1$
    table.addColumn(originColumn, constants.originVm(), "100px");
    table.addColumn(new AbstractSafeHtmlColumn<ImportVmData>() {

        @Override
        public SafeHtml getValue(ImportVmData object) {
            return VmTypeColumn.getRenderedValue(object.getVm());
        }
    }, constants.empty(), // $NON-NLS-1$
    "30px");
    AbstractTextColumn<ImportVmData> memoryColumn = new AbstractTextColumn<ImportVmData>() {

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

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

        @Override
        public String getValue(ImportVmData object) {
            return String.valueOf(object.getVm().getClusterArch());
        }
    };
    // $NON-NLS-1$
    table.addColumn(archColumn, constants.architectureVm(), "50px");
    AbstractTextColumn<ImportVmData> diskColumn = new AbstractTextColumn<ImportVmData>() {

        @Override
        public String getValue(ImportVmData object) {
            return String.valueOf(object.getVm().getDiskMap().size());
        }
    };
    // $NON-NLS-1$
    table.addColumn(diskColumn, constants.disksVm(), "50px");
    ScrollPanel sp = new ScrollPanel();
    sp.add(table);
    splitLayoutPanel.add(sp);
    table.getElement().getStyle().setPosition(Position.RELATIVE);
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ImportVmData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportVmData) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 8 with AbstractEnumColumn

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

the class SubTabClusterGlusterHookView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    getTable().addColumn(new GlusterHookSyncStatusColumn(), constants.empty(), // $NON-NLS-1$
    "10px");
    AbstractTextColumn<GlusterHookEntity> nameColumn = new AbstractTextColumn<GlusterHookEntity>() {

        @Override
        public String getValue(GlusterHookEntity object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameHook(), "200px");
    AbstractTextColumn<GlusterHookEntity> statusColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookStatus>() {

        @Override
        protected GlusterHookStatus getRawValue(GlusterHookEntity object) {
            return object.getStatus();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusHook(), "150px");
    AbstractTextColumn<GlusterHookEntity> glusterCommandColumn = new AbstractTextColumn<GlusterHookEntity>() {

        @Override
        public String getValue(GlusterHookEntity object) {
            return object.getGlusterCommand();
        }
    };
    getTable().addColumn(glusterCommandColumn, constants.glusterVolumeEventHook(), // $NON-NLS-1$;
    "100px");
    AbstractTextColumn<GlusterHookEntity> stageColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookStage>() {

        @Override
        protected GlusterHookStage getRawValue(GlusterHookEntity object) {
            return object.getStage();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(stageColumn, constants.stageHook(), "100px");
    AbstractTextColumn<GlusterHookEntity> contentTypeColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookContentType>() {

        @Override
        protected GlusterHookContentType getRawValue(GlusterHookEntity object) {
            return object.getContentType();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(contentTypeColumn, constants.contentTypeHook(), "150px");
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterHookSyncStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.GlusterHookSyncStatusColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)

Example 9 with AbstractEnumColumn

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

the class SubTabClusterNetworkView method initTable.

private void initTable() {
    getTable().enableColumnResizing();
    NetworkStatusColumn statusIconColumn = new NetworkStatusColumn();
    statusIconColumn.setContextMenuTitle(constants.statusIconNetwork());
    // $NON-NLS-1$ //$NON-NLS-2$
    getTable().addColumn(statusIconColumn, "", "20px");
    AbstractTextColumn<Network> nameColumn = new AbstractLinkColumn<Network>(new FieldUpdater<Network, String>() {

        @Override
        public void update(int index, Network network, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), network.getName());
            parameters.put(FragmentParams.DATACENTER.getName(), getModelProvider().getMainModel().getSelectedItem().getStoragePoolName());
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.networkGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(Network object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameNetwork(), "400px");
    AbstractTextColumn<Network> statusColumn = new AbstractEnumColumn<Network, NetworkStatus>() {

        @Override
        public NetworkStatus getRawValue(Network object) {
            return object.getCluster().getStatus();
        }
    };
    statusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusNetwork(), "100px");
    // $NON-NLS-1$
    getTable().addColumn(createNetRoleColumn(), constants.roleNetwork(), "90px");
    AbstractTextColumn<Network> descColumn = new AbstractTextColumn<Network>() {

        @Override
        public String getValue(Network object) {
            return object.getDescription();
        }
    };
    descColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(descColumn, constants.descriptionNetwork(), "400px");
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) NetworkStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.NetworkStatusColumn) Network(org.ovirt.engine.core.common.businessentities.network.Network) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 10 with AbstractEnumColumn

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

the class SubTabStorageDataCenterView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    StorageDomainStatusColumn statusColumn = new StorageDomainStatusColumn();
    statusColumn.setContextMenuTitle(constants.statusStorageDc());
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.empty(), "30px");
    AbstractTextColumn<StorageDomain> nameColumn = new AbstractLinkColumn<StorageDomain>(new FieldUpdater<StorageDomain, String>() {

        @Override
        public void update(int index, StorageDomain storageDomain, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), storageDomain.getStoragePoolName());
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.dataCenterStorageSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(StorageDomain object) {
            return object.getStoragePoolName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameDc(), "600px");
    AbstractTextColumn<StorageDomain> domainStatusColumn = new AbstractEnumColumn<StorageDomain, StorageDomainStatus>() {

        @Override
        protected StorageDomainStatus getRawValue(StorageDomain object) {
            return object.getStatus();
        }
    };
    domainStatusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(domainStatusColumn, constants.domainStatusInDcStorageDc(), "300px");
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) StorageDomainStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.StorageDomainStatusColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)26 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)23 HashMap (java.util.HashMap)13 Map (java.util.Map)13 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)13 VM (org.ovirt.engine.core.common.businessentities.VM)6 AbstractUptimeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn)6 VmTypeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn)6 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)4 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)4 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)4 VmStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn)4 HasCell (com.google.gwt.cell.client.HasCell)3 ImageResource (com.google.gwt.resources.client.ImageResource)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3