Search in sources :

Example 1 with EntityModelCellTable

use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable in project ovirt-engine by oVirt.

the class DisksTree method getNodeHeader.

@Override
protected TreeItem getNodeHeader() {
    EntityModelCellTable<ListModel> table = new EntityModelCellTable<>(false, true);
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.empty(), "20px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.domainNameDisksTree(), "");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.domainTypeDisksTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.statusDisksTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.freeSpaceDisksTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.usedSpaceDisksTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.totalSpaceDisksTree(), "130px");
    table.setRowData(new ArrayList());
    // $NON-NLS-1$
    table.setWidth("100%");
    // $NON-NLS-1$
    table.setHeight("30px");
    return new TreeItem(table);
}
Also used : EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) EmptyColumn(org.ovirt.engine.ui.common.widget.table.column.EmptyColumn) TreeItem(com.google.gwt.user.client.ui.TreeItem) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) TemplateDiskListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateDiskListModel) ArrayList(java.util.ArrayList)

Example 2 with EntityModelCellTable

use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable in project ovirt-engine by oVirt.

the class StoragesTree method getNodeHeader.

@Override
protected TreeItem getNodeHeader() {
    EntityModelCellTable<ListModel> table = new EntityModelCellTable<>(false, true);
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.empty(), "30px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.aliasDisk(), "");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.sizeStorageTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.statusStorageTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.allocationStorageTree(), "120px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.interfaceStorageTree(), "110px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.typeDisk(), "110px");
    // $NON-NLS-1$
    table.addColumn(new EmptyColumn(), constants.creationDateStorageTree(), "100px");
    table.setRowData(new ArrayList());
    // $NON-NLS-1$
    table.setWidth("100%");
    // $NON-NLS-1$
    table.setHeight("30px");
    TreeItem item = new TreeItem(table);
    item.setUserObject(NODE_HEADER);
    item.getElement().getStyle().setPadding(0, Unit.PX);
    return item;
}
Also used : EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) EmptyColumn(org.ovirt.engine.ui.common.widget.table.column.EmptyColumn) TreeItem(com.google.gwt.user.client.ui.TreeItem) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) TemplateStorageListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateStorageListModel) ArrayList(java.util.ArrayList)

Example 3 with EntityModelCellTable

use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable 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 4 with EntityModelCellTable

use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable 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 5 with EntityModelCellTable

use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable 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)

Aggregations

EntityModelCellTable (org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable)8 ArrayList (java.util.ArrayList)7 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)7 TreeItem (com.google.gwt.user.client.ui.TreeItem)6 SingleSelectionModel (com.google.gwt.view.client.SingleSelectionModel)3 List (java.util.List)3 AbstractLunSelectionColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLunSelectionColumn)3 EmptyColumn (org.ovirt.engine.ui.common.widget.table.column.EmptyColumn)3 LunModel (org.ovirt.engine.ui.uicommonweb.models.storage.LunModel)3 GWT (com.google.gwt.core.client.GWT)2 Resources (com.google.gwt.user.cellview.client.DataGrid.Resources)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 AbstractLunRemoveColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLunRemoveColumn)2 AbstractLunTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLunTextColumn)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 SanTargetModel (org.ovirt.engine.ui.uicommonweb.models.storage.SanTargetModel)2 Scheduler (com.google.gwt.core.client.Scheduler)1 TableLayout (com.google.gwt.dom.client.Style.TableLayout)1 EventBus (com.google.gwt.event.shared.EventBus)1 UiBinder (com.google.gwt.uibinder.client.UiBinder)1