Search in sources :

Example 1 with LunModel

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

the class SanStorageLunToTargetList method initRootNodeTable.

private void initRootNodeTable(EntityModelCellTable<ListModel<LunModel>> table) {
    table.addColumn(new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getLunId();
        }
    }, templates.textWithToolTip(constants.lunIdSanStorage()), // $NON-NLS-1$
    "250px");
    table.addColumn(new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return messages.gibibytes(String.valueOf(model.getSize()));
        }
    }, templates.textWithToolTip(constants.devSizeSanStorage()), // $NON-NLS-1$
    "60px");
    table.addColumn(new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return String.valueOf(model.getMultipathing());
        }
    }, templates.textWithToolTip(constants.pathSanStorage()), // $NON-NLS-1$
    "45px");
    table.addColumn(new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getVendorId();
        }
    }, templates.textWithToolTip(constants.vendorIdSanStorage()), // $NON-NLS-1$
    "70px");
    table.addColumn(new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getProductId();
        }
    }, templates.textWithToolTip(constants.productIdSanStorage()), // $NON-NLS-1$
    "70px");
    table.addColumn(new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getSerial();
        }
    }, constants.serialSanStorage(), // $NON-NLS-1$
    "210px");
    if (model.getContainer().isNewStorage() || model.getContainer().getStorage().getStatus() != StorageDomainStatus.Maintenance) {
        if (multiSelection) {
            addAbstractLunActionsColumn(table, model.getContainer().isNewStorage() ? constants.addSanStorage() : constants.actionsSanStorage());
        }
    } else if (model.isReduceDeviceSupported()) {
        AbstractLunRemoveColumn removeColumn = new AbstractLunRemoveColumn(model) {

            @Override
            public LunModel getValue(LunModel object) {
                return object;
            }
        };
        // $NON-NLS-1$
        table.addColumn(removeColumn, templates.textWithToolTip(constants.removeSanStorage()), "95px");
        model.getRequireTableRefresh().getEntityChangedEvent().addListener((ev, sender, args) -> {
            table.redraw();
        });
    }
}
Also used : CommonApplicationConstants(org.ovirt.engine.ui.common.CommonApplicationConstants) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) CommonApplicationMessages(org.ovirt.engine.ui.common.CommonApplicationMessages) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) SingleSelectionModel(com.google.gwt.view.client.SingleSelectionModel) GWT(com.google.gwt.core.client.GWT) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) AssetProvider(org.ovirt.engine.ui.common.gin.AssetProvider) AbstractLunActionsColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunActionsColumn) AbstractLunRemoveColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunRemoveColumn) CommonApplicationTemplates(org.ovirt.engine.ui.common.CommonApplicationTemplates) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) AbstractLunTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunTextColumn) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) AbstractLunSelectionColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunSelectionColumn) Resources(com.google.gwt.user.cellview.client.DataGrid.Resources) TreeItem(com.google.gwt.user.client.ui.TreeItem) SanTargetModel(org.ovirt.engine.ui.uicommonweb.models.storage.SanTargetModel) Scheduler(com.google.gwt.core.client.Scheduler) TableLayout(com.google.gwt.dom.client.Style.TableLayout) List(java.util.List) TextColumn(com.google.gwt.user.cellview.client.TextColumn) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) AbstractLunRemoveColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunRemoveColumn) AbstractLunTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunTextColumn) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel)

Example 2 with LunModel

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

the class SanStorageTargetToLunList method createLeafNode.

@SuppressWarnings("unchecked")
@Override
protected TreeItem createLeafNode(ListModel leafModel) {
    final TreeItem item = new TreeItem();
    List<LunModel> items = (List<LunModel>) leafModel.getItems();
    if (hideLeaf || items.isEmpty()) {
        item.setUserObject(Boolean.TRUE);
        return item;
    }
    final SortedListModel sortedLeafModel = new SortedListModel();
    sortedLeafModel.setItems(items);
    final EntityModelCellTable<ListModel<LunModel>> table = new EntityModelCellTable<>(multiSelection, (Resources) GWT.create(SanStorageListLunTableResources.class));
    table.enableColumnResizing();
    table.initModelSortHandler(sortedLeafModel);
    AbstractLunSelectionColumn lunSelectionColumn = new AbstractLunSelectionColumn(multiSelection) {

        @Override
        public LunModel getValue(LunModel object) {
            return object;
        }
    };
    // $NON-NLS-1$
    table.setCustomSelectionColumn(lunSelectionColumn, "25px");
    AbstractLunTextColumn lunIdColumn = new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getLunId();
        }
    };
    lunIdColumn.makeSortable();
    // $NON-NLS-1$
    table.addColumn(lunIdColumn, constants.lunIdSanStorage(), "250px");
    AbstractLunTextColumn devSizeColumn = new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return messages.gibibytes(String.valueOf(model.getSize()));
        }
    };
    devSizeColumn.makeSortable();
    // $NON-NLS-1$
    table.addColumn(devSizeColumn, constants.devSizeSanStorage(), "60px");
    AbstractLunTextColumn path = new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return String.valueOf(model.getMultipathing());
        }
    };
    path.makeSortable();
    // $NON-NLS-1$
    table.addColumn(path, constants.pathSanStorage(), "45px");
    AbstractLunTextColumn vendorIdColumn = new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getVendorId();
        }
    };
    vendorIdColumn.makeSortable();
    // $NON-NLS-1$
    table.addColumn(vendorIdColumn, constants.vendorIdSanStorage(), "70px");
    AbstractLunTextColumn productIdColumn = new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getProductId();
        }
    };
    productIdColumn.makeSortable();
    // $NON-NLS-1$
    table.addColumn(productIdColumn, constants.productIdSanStorage(), "70px");
    AbstractLunTextColumn serialNumColumn = new AbstractLunTextColumn() {

        @Override
        public String getRawValue(LunModel model) {
            return model.getSerial();
        }
    };
    serialNumColumn.makeSortable();
    // $NON-NLS-1$
    table.addColumn(serialNumColumn, constants.serialSanStorage(), "210px");
    if (model.getContainer().isNewStorage() || model.getContainer().getStorage().getStatus() != StorageDomainStatus.Maintenance) {
        if (multiSelection) {
            addAbstractLunActionsColumn(table, model.getContainer().isNewStorage() ? constants.addSanStorage() : constants.actionsSanStorage());
        }
    } else if (model.isReduceDeviceSupported()) {
        AbstractLunRemoveColumn removeColumn = new AbstractLunRemoveColumn(model) {

            @Override
            public LunModel getValue(LunModel object) {
                return object;
            }
        };
        // $NON-NLS-1$
        table.addColumn(removeColumn, constants.removeSanStorage(), "95px");
    }
    model.getRequireTableRefresh().getEntityChangedEvent().addListener((ev, sender, args) -> {
        if (Boolean.TRUE.equals(model.getRequireTableRefresh().getEntity())) {
            if (!multiSelection) {
                updateLunSelectionModel(table, items);
            }
        }
        table.redraw();
    });
    table.setRowData(items);
    final Object selectedItem = sortedLeafModel.getSelectedItem();
    sortedLeafModel.setSelectedItem(null);
    table.asEditor().edit(sortedLeafModel);
    sortedLeafModel.setSelectedItem(selectedItem);
    // $NON-NLS-1$
    table.setWidth("100%");
    if (!multiSelection) {
        table.getSelectionModel().addSelectionChangeHandler(event -> {
            SingleSelectionModel SingleSelectionModel = (SingleSelectionModel) event.getSource();
            selectedLunModel = SingleSelectionModel.getSelectedObject() == null ? selectedLunModel : (LunModel) SingleSelectionModel.getSelectedObject();
            if (selectedLunModel != null && !selectedLunModel.getIsGrayedOut()) {
                updateSelectedLunWarning(selectedLunModel);
                sortedLeafModel.setSelectedItem(selectedLunModel);
            }
        });
    } else {
        for (LunModel lunModel : items) {
            table.getSelectionModel().setSelected(lunModel, lunModel.getIsSelected());
        }
        table.getSelectionModel().addSelectionChangeHandler(event -> model.updateLunWarningForDiscardAfterDelete());
    }
    item.setWidget(table);
    // Display LUNs as grayed-out if needed
    for (LunModel lunModel : items) {
        if (lunModel.getIsGrayedOut()) {
            grayOutItem(lunModel.getGrayedOutReasons(), lunModel, table);
        }
    }
    addOpenHandlerToTree(tree, item, table);
    return item;
}
Also used : SortedListModel(org.ovirt.engine.ui.uicommonweb.models.SortedListModel) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) SingleSelectionModel(com.google.gwt.view.client.SingleSelectionModel) TreeItem(com.google.gwt.user.client.ui.TreeItem) AbstractLunTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunTextColumn) AbstractLunRemoveColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunRemoveColumn) SortedListModel(org.ovirt.engine.ui.uicommonweb.models.SortedListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) List(java.util.List) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) AbstractLunSelectionColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunSelectionColumn)

Example 3 with LunModel

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

the class DataCenterGuideModel method onSaveSanStorage.

private void onSaveSanStorage() {
    ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
    if (confirmationModel != null && !confirmationModel.validate()) {
        return;
    }
    cancelConfirm();
    getWindow().startProgress();
    StorageModel model = (StorageModel) getWindow();
    SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
    VDS host = model.getHost().getSelectedItem();
    boolean force = sanModel.isForce();
    HashSet<String> lunIds = new HashSet<>();
    for (LunModel lun : sanModel.getAddedLuns()) {
        lunIds.add(lun.getLunId());
    }
    AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain);
    params.setVdsId(host.getId());
    params.setLunIds(new HashSet<>(lunIds));
    params.setForce(force);
    Frontend.getInstance().runAction(ActionType.AddSANStorageDomain, params, result -> {
        DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
        StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
        StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
        if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
            ActionReturnValue returnValue = result.getReturnValue();
            Guid storageId = returnValue.getActionReturnValue();
            dataCenterGuideModel.attachStorageToDataCenter(storageId, dataCenter.getId());
        }
        dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
    }, this);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Guid(org.ovirt.engine.core.compat.Guid) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) HashSet(java.util.HashSet)

Example 4 with LunModel

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

the class DataCenterGuideModel method saveNewSanStorage.

public void saveNewSanStorage() {
    StorageModel storageModel = (StorageModel) getWindow();
    final SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
    Guid hostId = sanStorageModelBase.getContainer().getHost().getSelectedItem().getId();
    Set<String> unkownStatusLuns = new HashSet<>();
    for (LunModel lunModel : sanStorageModelBase.getAddedLuns()) {
        unkownStatusLuns.add(lunModel.getLunId());
    }
    Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModelBase.getType(), true, unkownStatusLuns, false), new AsyncQuery<QueryReturnValue>(response -> {
        if (response.getSucceeded()) {
            List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue();
            postGetLunsMessages(sanStorageModelBase.getUsedLunsMessages(checkedLuns));
        } else {
            sanStorageModelBase.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
        }
    }, true));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) GuideModel(org.ovirt.engine.ui.uicommonweb.models.GuideModel) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) NewEditStorageModelBehavior(org.ovirt.engine.ui.uicommonweb.models.storage.NewEditStorageModelBehavior) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) MoveHost(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) ITaskTarget(org.ovirt.engine.ui.uicompat.ITaskTarget) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) TaskContext(org.ovirt.engine.ui.uicompat.TaskContext) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) FrontendMultipleActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult) Task(org.ovirt.engine.ui.uicompat.Task) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) MoveHostData(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) Timer(com.google.gwt.user.client.Timer) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) Guid(org.ovirt.engine.core.compat.Guid) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) List(java.util.List) ArrayList(java.util.ArrayList) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) HashSet(java.util.HashSet)

Example 5 with LunModel

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

the class SanStorageLunToTargetList method createRootNode.

@Override
protected TreeItem createRootNode(LunModel rootModel) {
    final EntityModelCellTable<ListModel<LunModel>> table = new EntityModelCellTable<>(multiSelection, (Resources) GWT.create(SanStorageListLunRootResources.class));
    // Create table
    initRootNodeTable(table);
    // Set custom selection column
    AbstractLunSelectionColumn lunSelectionColumn = new AbstractLunSelectionColumn(multiSelection) {

        @Override
        public LunModel getValue(LunModel object) {
            return object;
        }
    };
    // $NON-NLS-1$
    table.setCustomSelectionColumn(lunSelectionColumn, "20px");
    // Add items
    List<LunModel> items = new ArrayList<>();
    items.add(rootModel);
    ListModel<LunModel> listModel = new ListModel<>();
    listModel.setItems(items);
    // Update table
    table.setRowData(items);
    table.asEditor().edit(listModel);
    // $NON-NLS-1$
    table.setWidth("100%");
    // This was the height of the header
    // $NON-NLS-1$
    table.setHeight("26px");
    rootModel.getPropertyChangedEvent().removeListener(lunModelSelectedItemListener);
    rootModel.getPropertyChangedEvent().addListener(lunModelSelectedItemListener, table);
    if (!multiSelection) {
        table.getSelectionModel().addSelectionChangeHandler(event -> {
            SingleSelectionModel SingleSelectionModel = (SingleSelectionModel) event.getSource();
            LunModel selectedLunModel = (LunModel) SingleSelectionModel.getSelectedObject();
            if (selectedLunModel != null) {
                updateSelectedLunWarning(selectedLunModel);
            }
        });
    } else {
        table.getSelectionModel().setSelected(rootModel, rootModel.getIsSelected());
        table.getSelectionModel().addSelectionChangeHandler(event -> model.updateLunWarningForDiscardAfterDelete());
    }
    // Create tree item
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(table);
    // $NON-NLS-1$
    panel.setWidth("100%");
    panel.getElement().getStyle().setTableLayout(TableLayout.FIXED);
    TreeItem item = new TreeItem(table);
    // Display LUNs as grayed-out if needed
    if (rootModel.getIsGrayedOut()) {
        grayOutItem(rootModel.getGrayedOutReasons(), rootModel, table);
    }
    return item;
}
Also used : EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) SingleSelectionModel(com.google.gwt.view.client.SingleSelectionModel) TreeItem(com.google.gwt.user.client.ui.TreeItem) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) AbstractLunSelectionColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLunSelectionColumn)

Aggregations

LunModel (org.ovirt.engine.ui.uicommonweb.models.storage.LunModel)6 ArrayList (java.util.ArrayList)4 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)4 TreeItem (com.google.gwt.user.client.ui.TreeItem)3 SingleSelectionModel (com.google.gwt.view.client.SingleSelectionModel)3 List (java.util.List)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 HashSet (java.util.HashSet)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 AddSANStorageDomainParameters (org.ovirt.engine.core.common.action.AddSANStorageDomainParameters)2 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 EntityModelCellTable (org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable)2 AbstractLunRemoveColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLunRemoveColumn)2 AbstractLunSelectionColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLunSelectionColumn)2 AbstractLunTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLunTextColumn)2 SanStorageModelBase (org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase)2 GWT (com.google.gwt.core.client.GWT)1 Scheduler (com.google.gwt.core.client.Scheduler)1