Search in sources :

Example 26 with AbstractTextColumn

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

the class SubTabQuotaUserView method initTable.

private void initTable() {
    getTable().enableColumnResizing();
    // $NON-NLS-1$
    getTable().addColumn(new PermissionTypeColumn(), constants.empty(), "30px");
    AbstractTextColumn<Permission> userColumn = new AbstractTextColumn<Permission>() {

        @Override
        public String getValue(Permission object) {
            return object.getOwnerName();
        }
    };
    userColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(userColumn, constants.userUser(), "400px");
    AbstractTextColumn<Permission> permissionColumn = new AbstractObjectNameColumn<Permission>() {

        @Override
        protected Object[] getRawValue(Permission object) {
            return new Object[] { object.getObjectType(), object.getObjectName(), getDetailModel().getEntity(), object.getObjectId() };
        }
    };
    permissionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(permissionColumn, constants.inheritedFromUser(), "400px");
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) PermissionTypeColumn(org.ovirt.engine.ui.common.widget.table.column.PermissionTypeColumn) AbstractObjectNameColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractObjectNameColumn)

Example 27 with AbstractTextColumn

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

the class SubTabStorageDRView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() {

        @Override
        public String getValue(StorageDomainDR storageDomainDR) {
            GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId());
            if (session == null) {
                return storageDomainDR.getGeoRepSessionId().toString();
            } else {
                return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName());
            }
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px");
    AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() {

        @Override
        public String getValue(StorageDomainDR storageDomainDR) {
            StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression());
            return schedule.toString();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px");
}
Also used : StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 28 with AbstractTextColumn

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

the class SubTabHostVmView method initTable.

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

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

        @Override
        public String getValue(VM object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameVm(), "160px");
    VmTypeColumn typeColumn = new VmTypeColumn();
    typeColumn.setContextMenuTitle(constants.typeVm());
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.empty(), "60px");
    AbstractTextColumn<VM> clusterColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getClusterName();
        }
    };
    clusterColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(clusterColumn, constants.clusterVm(), "160px");
    AbstractTextColumn<VM> ipColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getIp();
        }
    };
    ipColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(ipColumn, constants.ipVm(), "200px");
    AbstractTextColumn<VM> fqdnColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getFqdn();
        }
    };
    fqdnColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(fqdnColumn, constants.fqdn(), "200px");
    getTable().addColumn(new ColumnResizeTableLineChartProgressBar<VM>(getTable(), new ResourceConsumptionComparator() {

        @Override
        protected Integer extractValue(VM vm) {
            return vm.getUsageMemPercent();
        }
    }) {

        @Override
        protected List<Integer> getProgressValues(VM object) {
            return object.getMemoryUsageHistory();
        }
    }, constants.memoryVm(), // $NON-NLS-1$
    "120px");
    getTable().addColumn(new ColumnResizeTableLineChartProgressBar<VM>(getTable(), new ResourceConsumptionComparator() {

        @Override
        protected Integer extractValue(VM vm) {
            return vm.getUsageCpuPercent();
        }
    }) {

        @Override
        protected List<Integer> getProgressValues(VM object) {
            return object.getCpuUsageHistory();
        }
    }, constants.cpuVm(), // $NON-NLS-1$
    "120px");
    getTable().addColumn(new ColumnResizeTableLineChartProgressBar<VM>(getTable(), new ResourceConsumptionComparator() {

        @Override
        protected Integer extractValue(VM vm) {
            return vm.getUsageNetworkPercent();
        }
    }) {

        @Override
        protected List<Integer> getProgressValues(VM object) {
            return object.getNetworkUsageHistory();
        }
    }, constants.networkVm(), // $NON-NLS-1$
    "120px");
    AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {

        @Override
        protected VMStatus getRawValue(VM object) {
            // check, if the current host is a target for the migration, then override status
            final VDS vds = getDetailModel().getEntity();
            if (object.getStatus().equals(VMStatus.MigratingFrom) && vds != null && vds.getId().equals(object.getMigratingToVds())) {
                return VMStatus.MigratingTo;
            }
            return object.getStatus();
        }
    };
    statusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusVm(), "130px");
    AbstractTextColumn<VM> uptimeColumn = new AbstractUptimeColumn<VM>() {

        @Override
        protected Double getRawValue(VM object) {
            return object.getElapsedTime();
        }
    };
    uptimeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(uptimeColumn, constants.uptimeVm(), "110px");
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) VmStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn) AbstractUptimeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) VM(org.ovirt.engine.core.common.businessentities.VM) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) List(java.util.List) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Example 29 with AbstractTextColumn

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

the class SubTabNetworkClusterView method initTable.

private void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> nameColumn = new AbstractLinkColumn<PairQueryable<Cluster, NetworkCluster>>(new FieldUpdater<PairQueryable<Cluster, NetworkCluster>, String>() {

        @Override
        public void update(int index, PairQueryable<Cluster, NetworkCluster> cluster, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), cluster.getFirst().getName());
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.clusterGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameCluster(), "400px");
    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> versionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {

        @Override
        public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getCompatibilityVersion().getValue();
        }
    };
    versionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(versionColumn, constants.comptVersCluster(), "130px");
    AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> attachedColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {

        @Override
        public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getSecond() != null;
        }

        @Override
        protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
            return false;
        }
    };
    attachedColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(attachedColumn, constants.attachedNetworkCluster(), "120px");
    NetworkClusterStatusColumn statusColumn = new NetworkClusterStatusColumn();
    statusColumn.makeSortable(new SimpleStatusColumnComparator<>(statusColumn));
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.networkStatus(), "120px");
    AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> netRequiredColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {

        @Override
        public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
            if (object.getSecond() != null) {
                return object.getSecond().isRequired();
            }
            return false;
        }

        @Override
        protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
            return false;
        }
    };
    netRequiredColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(netRequiredColumn, constants.requiredNetCluster(), "120px");
    AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> netRoleColumn = createNetRoleColumn();
    netRoleColumn.makeSortable(new NetRoleColumnComparator());
    // $NON-NLS-1$
    getTable().addColumn(netRoleColumn, constants.roleNetCluster(), "120px");
    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> descriptionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {

        @Override
        public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getDescription();
        }
    };
    descriptionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.descriptionCluster(), "400px");
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) NetworkClusterStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.NetworkClusterStatusColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 30 with AbstractTextColumn

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

the class SubTabTemplateVmView method initTable.

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

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

        @Override
        public String getValue(VM object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameVm(), "200px");
    VmTypeColumn typeColumn = new VmTypeColumn();
    typeColumn.setContextMenuTitle(constants.typeVm());
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.empty(), "60px");
    AbstractTextColumn<VM> hostColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getRunOnVdsName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(hostColumn, constants.hostVm(), "200px");
    AbstractTextColumn<VM> ipColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getIp();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(ipColumn, constants.ipVm(), "200px");
    AbstractTextColumn<VM> fqdnColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getFqdn();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(fqdnColumn, constants.fqdn(), "200px");
    AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {

        @Override
        protected VMStatus getRawValue(VM object) {
            return object.getStatus();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusVm(), "200px");
    AbstractTextColumn<VM> uptimeColumn = new AbstractUptimeColumn<VM>() {

        @Override
        protected Double getRawValue(VM object) {
            return object.getElapsedTime();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(uptimeColumn, constants.uptimeVm(), "200px");
    AbstractTextColumn<VM> consoleConnectedUserColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM vm) {
            return StringHelper.isNotNullOrEmpty(vm.getClientIp()) ? vm.getConsoleCurentUserName() : null;
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(consoleConnectedUserColumn, constants.consoleConnectedUserVm(), "200px");
    AbstractTextColumn<VM> loggedInUserColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getGuestCurentUserName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(loggedInUserColumn, constants.loggedInUserVm(), "200px");
}
Also used : VmStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn) AbstractUptimeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) VM(org.ovirt.engine.core.common.businessentities.VM) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) HashMap(java.util.HashMap) Map(java.util.Map)

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