Search in sources :

Example 16 with AbstractTextColumn

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

the class ImportVmFromExternalProviderPopupView method initDiskTable.

private void initDiskTable() {
    diskTable = new ListModelObjectCellTable<>();
    diskTable.enableColumnResizing();
    AbstractTextColumn<DiskImage> aliasColumn = new AbstractTextColumn<DiskImage>() {

        @Override
        public String getValue(DiskImage object) {
            return object.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(aliasColumn, constants.aliasDisk(), "300px");
    AbstractImageResourceColumn<DiskImage> bootableDiskColumn = new AbstractImageResourceColumn<DiskImage>() {

        @Override
        public ImageResource getValue(DiskImage object) {
            boolean isBoot = !object.getDiskVmElements().isEmpty() && object.getDiskVmElements().iterator().next().isBoot();
            return isBoot ? getDefaultImage() : null;
        }

        @Override
        public ImageResource getDefaultImage() {
            return resources.bootableDiskIcon();
        }

        @Override
        public SafeHtml getTooltip(DiskImage object) {
            if (!object.getDiskVmElements().isEmpty() && object.getDiskVmElements().iterator().next().isBoot()) {
                return SafeHtmlUtils.fromSafeConstant(constants.bootableDisk());
            }
            return null;
        }
    };
    diskTable.addColumn(bootableDiskColumn, new ImageResourceHeader(DisksViewColumns.bootableDiskColumn.getDefaultImage(), SafeHtmlUtils.fromSafeConstant(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    AbstractDiskSizeColumn<DiskImage> sizeColumn = new AbstractDiskSizeColumn<DiskImage>() {

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

        @Override
        protected Long getRawValue(DiskImage object) {
            return object.getActualSizeInBytes();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(actualSizeColumn, constants.sizeDisk(), "130px");
    diskTable.setSelectionModel(new NoSelectionModel<DiskImage>());
    diskTable.getElement().getStyle().setPosition(Position.RELATIVE);
}
Also used : AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 17 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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 18 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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 19 with AbstractTextColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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 20 with AbstractTextColumn

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

the class SubTabGlusterVolumeSnapshotView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    GlusterVolumeSnapshotStatusColumn snapshotStatusColumn = new GlusterVolumeSnapshotStatusColumn();
    snapshotStatusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(snapshotStatusColumn, constants.empty(), "30px");
    AbstractTextColumn<GlusterVolumeSnapshotEntity> snapshotNameColumn = new AbstractTextColumn<GlusterVolumeSnapshotEntity>() {

        @Override
        public String getValue(GlusterVolumeSnapshotEntity snapshot) {
            return snapshot.getSnapshotName();
        }
    };
    snapshotNameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(snapshotNameColumn, constants.volumeSnapshotName(), "300px");
    AbstractTextColumn<GlusterVolumeSnapshotEntity> descriptionColumn = new AbstractTextColumn<GlusterVolumeSnapshotEntity>() {

        @Override
        public String getValue(GlusterVolumeSnapshotEntity snapshot) {
            return snapshot.getDescription();
        }
    };
    descriptionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.volumeSnapshotDescription(), "400px");
    AbstractTextColumn<GlusterVolumeSnapshotEntity> creationTimeColumn = new AbstractTextColumn<GlusterVolumeSnapshotEntity>() {

        @Override
        public String getValue(GlusterVolumeSnapshotEntity snapshot) {
            // $NON-NLS-1$
            DateTimeFormat df = DateTimeFormat.getFormat("yyyy-MM-dd, HH:mm:ss");
            return df.format(snapshot.getCreatedAt());
        }
    };
    creationTimeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(creationTimeColumn, constants.volumeSnapshotCreationTime(), "400px");
}
Also used : GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) GlusterVolumeSnapshotStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.GlusterVolumeSnapshotStatusColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat)

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