Search in sources :

Example 86 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class GlusterVolumeGeoReplicationSessionConfigPopupView method initConfigTable.

private void initConfigTable() {
    geoReplicationConfigTable = new EntityModelCellTable<>(false, true);
    geoReplicationConfigTable.setSelectionModel(new NoSelectionModel());
    geoReplicationConfigTable.addColumn(new AbstractEntityModelTextColumn<Pair<Boolean, GlusterGeoRepSessionConfiguration>>() {

        @Override
        protected String getText(Pair<Boolean, GlusterGeoRepSessionConfiguration> entity) {
            return entity.getSecond().getKey();
        }
    }, constants.optionKeyVolumeParameter(), // $NON-NLS-1$
    "150px");
    geoReplicationConfigTable.addColumn(new AbstractScrollableTextColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>() {

        @Override
        public String getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
            return object.getEntity().getSecond().getDescription() == null ? constants.notAvailableLabel() : object.getEntity().getSecond().getDescription();
        }
    }, constants.descriptionVolumeParameter(), // $NON-NLS-1$
    "300px");
    geoReplicationConfigTable.addColumn(new GlusterConfigAwareColumn(), constants.optionValueVolumeParameter(), // $NON-NLS-1$
    "200px");
    geoReplicationConfigTable.addColumn(new AbstractCheckboxColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>(true, (index, object, value) -> object.getEntity().setFirst(value)) {

        @Override
        protected boolean canEdit(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
            return true;
        }

        @Override
        public Boolean getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
            return object.getEntity().getFirst();
        }
    }, constants.resetGeoRepSessionConfig());
}
Also used : AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) EventBus(com.google.gwt.event.shared.EventBus) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) ElementIdHandler(org.ovirt.engine.ui.common.idhandler.ElementIdHandler) Inject(com.google.inject.Inject) UiCommonEditorDriver(org.ovirt.engine.ui.common.editor.UiCommonEditorDriver) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) AbstractModelBoundPopupView(org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView) GWT(com.google.gwt.core.client.GWT) GlusterConfigAwareColumn(org.ovirt.engine.ui.common.widget.table.column.GlusterConfigAwareColumn) GlusterVolumeGeoReplicationSessionConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeGeoReplicationSessionConfigModel) WithElementId(org.ovirt.engine.ui.common.idhandler.WithElementId) GlusterGeoRepSessionConfiguration(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) UiBinder(com.google.gwt.uibinder.client.UiBinder) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) SimpleDialogPanel(org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel) GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget) UiField(com.google.gwt.uibinder.client.UiField) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) AbstractScrollableTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractScrollableTextColumn) Pair(org.ovirt.engine.core.common.utils.Pair) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterGeoRepSessionConfiguration(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration) GlusterConfigAwareColumn(org.ovirt.engine.ui.common.widget.table.column.GlusterConfigAwareColumn) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 87 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class GlusterVolumeSnapshotConfigureOptionsPopupView method initEditors.

private void initEditors() {
    configsTable = new EntityModelCellTable<>(false, true);
    configsTable.setSelectionModel(new NoSelectionModel());
    configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {

        @Override
        public String getText(VolumeSnapshotOptionModel object) {
            return object.getOptionName();
        }
    }, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
    "150px");
    configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {

        @Override
        public String getText(VolumeSnapshotOptionModel object) {
            return object.getCorrespodingClusterValue();
        }
    }, constants.clusterSnapshotConfigValue(), // $NON-NLS-1$
    "200px");
    Column<EntityModel<VolumeSnapshotOptionModel>, String> valueColumn = new Column<EntityModel<VolumeSnapshotOptionModel>, String>(new TextInputCell()) {

        @Override
        public String getValue(EntityModel<VolumeSnapshotOptionModel> object) {
            return ((VolumeSnapshotOptionModel) object.getEntity()).getOptionValue();
        }
    };
    // $NON-NLS-1$
    configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
    valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setOptionValue(value));
}
Also used : AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel)

Example 88 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class ErrataListWithDetailsPopupView method updateErrataDetailFormPanel.

public void updateErrataDetailFormPanel(Erratum erratum) {
    errataTitle.clear();
    errataTitle.add(new HTML(erratum.getTitle()));
    EntityModel<Erratum> entityModel = new EntityModel<>();
    entityModel.setEntity(erratum);
    errataDetailModelForm.setModel(entityModel);
    errataDetailModelForm.update();
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HTML(com.google.gwt.user.client.ui.HTML) Erratum(org.ovirt.engine.core.common.businessentities.Erratum)

Example 89 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class ManualFenceConfirmationPopupView method edit.

@Override
public void edit(final ConfirmationModel object) {
    driver.edit(object);
    // Bind "Latch.IsAvailable"
    object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("IsAvailable".equals(args.propertyName)) {
            // $NON-NLS-1$
            EntityModel entity = (EntityModel) sender;
            if (entity.getIsAvailable()) {
                latch.setVisible(true);
            }
        }
    });
    object.getItemsChangedEvent().addListener((ev, sender, args) -> {
        VDS vds = (VDS) object.getItems().iterator().next();
        // Message
        messageLabel.setText(messages.manaulFencePopupMessageLabel(vds.getName()));
        // Spm warning
        VdsSpmStatus spmStatus = vds.getSpmStatus();
        if (spmStatus == VdsSpmStatus.None) {
            spmWarningLabel.setText(constants.manaulFencePopupNoneSpmWarningLabel());
        } else if (spmStatus == VdsSpmStatus.SPM) {
            spmWarningLabel.setText(constants.manaulFencePopupSpmWarningLabel());
        } else if (spmStatus == VdsSpmStatus.Contending) {
            spmWarningLabel.setText(constants.manaulFencePopupContendingSpmWarningLabel());
        }
        // Warning
        warningLabel.setText(constants.manaulFencePopupWarningLabel());
    });
}
Also used : VdsSpmStatus(org.ovirt.engine.core.common.businessentities.VdsSpmStatus) VDS(org.ovirt.engine.core.common.businessentities.VDS) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 90 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class VmDiskAttachPopupWidget method initDiskImagesTable.

private void initDiskImagesTable() {
    imageDiskTable.enableColumnResizing();
    AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {

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

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

        @Override
        public String getValue(EntityModel object) {
            DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
            return diskImage.getId().toString();
        }
    };
    // $NON-NLS-1$
    imageDiskTable.addColumn(idColumn, constants.idVmDiskTable(), "85px");
    AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>() {

        @Override
        protected Long getRawValue(EntityModel object) {
            DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
            return diskImage.getSize();
        }
    };
    // $NON-NLS-1$
    imageDiskTable.addColumn(sizeColumn, constants.provisionedSizeVmDiskTable(), "100px");
    AbstractDiskSizeColumn<EntityModel> actualSizeColumn = new AbstractDiskSizeColumn<EntityModel>() {

        @Override
        protected Long getRawValue(EntityModel object) {
            DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
            return diskImage.getActualSizeInBytes();
        }
    };
    // $NON-NLS-1$
    imageDiskTable.addColumn(actualSizeColumn, constants.sizeVmDiskTable(), "100px");
    AbstractTextColumn<EntityModel> storageDomainColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
            return diskImage.getStoragesNames().get(0);
        }
    };
    // $NON-NLS-1$
    imageDiskTable.addColumn(storageDomainColumn, constants.storageDomainVmDiskTable(), "100px");
    // $NON-NLS-1$
    imageDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
    imageDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
    "30px");
    imageDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    imageDiskTable.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$
    imageDiskTable.setWidth("100%");
    imageDiskTable.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) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) 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)

Aggregations

EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)105 ArrayList (java.util.ArrayList)56 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)27 List (java.util.List)26 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)23 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)22 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)22 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)22 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)19 ActionType (org.ovirt.engine.core.common.action.ActionType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)17 Guid (org.ovirt.engine.core.compat.Guid)17 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 QueryType (org.ovirt.engine.core.common.queries.QueryType)16 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)13