Search in sources :

Example 1 with TemplateListModel

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

the class TemplateSubTabPanelPresenter method initDetailTabToModelMapping.

@Override
protected void initDetailTabToModelMapping(Map<TabData, Model> mapping) {
    TemplateListModel mainModel = modelProvider.getModel();
    mapping.put(DetailTabDataIndex.TEMPLATE_GENERAL, mainModel.getGeneralModel());
    mapping.put(DetailTabDataIndex.TEMPLATE_VM, mainModel.getVmListModel());
    mapping.put(DetailTabDataIndex.TEMPLATE_INTERFACE, mainModel.getInterfaceListModel());
    mapping.put(DetailTabDataIndex.TEMPLATE_DISK, mainModel.getDiskListModel());
    mapping.put(DetailTabDataIndex.TEMPLATE_STORAGE, mainModel.getStorageListModel());
    mapping.put(DetailTabDataIndex.TEMPLATE_PERMISSION, mainModel.getPermissionListModel());
    mapping.put(DetailTabDataIndex.TEMPLATE_EVENT, mainModel.getEventListModel());
}
Also used : TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel)

Example 2 with TemplateListModel

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

the class ImportTemplatePopupView method initGeneralSubTabView.

@Override
protected void initGeneralSubTabView() {
    ScrollPanel generalPanel = new ScrollPanel();
    DetailModelProvider<TemplateListModel, TemplateGeneralModel> modelProvider = new DetailModelProvider<TemplateListModel, TemplateGeneralModel>() {

        @Override
        public TemplateGeneralModel getModel() {
            return (TemplateGeneralModel) importModel.getDetailModels().get(0);
        }

        @Override
        public void onSubTabSelected() {
        }

        @Override
        public void onSubTabDeselected() {
        }

        @Override
        public void activateDetailModel() {
        }

        @Override
        public TemplateListModel getMainModel() {
            // Not used, here to satisfy interface contract.
            return null;
        }
    };
    generalView = new ImportTemplateGeneralSubTabView(modelProvider);
    generalPanel.add(generalView);
    subTabLayoutPanel.add(generalPanel, constants.generalImpTempTab());
}
Also used : TemplateGeneralModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateGeneralModel) DetailModelProvider(org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider) TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 3 with TemplateListModel

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

the class RegisterTemplateInfoPanel method initGeneralForm.

private void initGeneralForm() {
    DetailModelProvider<TemplateListModel, TemplateGeneralModel> modelProvider = new DetailModelProvider<TemplateListModel, TemplateGeneralModel>() {

        @Override
        public TemplateGeneralModel getModel() {
            return getTemplateGeneralModel();
        }

        @Override
        public void onSubTabSelected() {
        }

        @Override
        public void onSubTabDeselected() {
        }

        @Override
        public void activateDetailModel() {
        }

        @Override
        public TemplateListModel getMainModel() {
            // Not used, here to satisfy interface contract.
            return null;
        }
    };
    generalView = new ImportTemplateGeneralSubTabView(modelProvider);
}
Also used : TemplateGeneralModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateGeneralModel) DetailModelProvider(org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider) ImportTemplateGeneralSubTabView(org.ovirt.engine.ui.webadmin.section.main.view.popup.storage.backup.ImportTemplateGeneralSubTabView) TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel)

Example 4 with TemplateListModel

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

the class TemplateModule method getTemplateListProvider.

// Main List Model
@Provides
@Singleton
public MainModelProvider<VmTemplate, TemplateListModel> getTemplateListProvider(EventBus eventBus, final Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<TemplateEditPresenterWidget> popupProvider, final Provider<VmExportPopupPresenterWidget> exportPopupProvider, final Provider<VmPopupPresenterWidget> createVmPopupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<TemplateListModel> modelProvider, final Provider<VmDiskPopupPresenterWidget> newDiskPopupProvider, final Provider<SingleSelectionVmDiskAttachPopupPresenterWidget> attachDiskPopupProvider, final Provider<VmHighPerformanceConfigurationPresenterWidget> highPerformanceConfigurationProvider) {
    MainViewModelProvider<VmTemplate, TemplateListModel> result = new MainViewModelProvider<VmTemplate, TemplateListModel>(eventBus, defaultConfirmPopupProvider) {

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(TemplateListModel source, UICommand lastExecutedCommand, Model windowModel) {
            TemplateListModel model = getModel();
            if (lastExecutedCommand == model.getEditCommand()) {
                return popupProvider.get();
            } else if (lastExecutedCommand == getModel().getExportCommand()) {
                return exportPopupProvider.get();
            } else if (lastExecutedCommand == getModel().getCreateVmFromTemplateCommand()) {
                if (windowModel instanceof AttachDiskModel) {
                    return attachDiskPopupProvider.get();
                } else if ((windowModel instanceof NewDiskModel) || (windowModel instanceof EditDiskModel)) {
                    return newDiskPopupProvider.get();
                } else {
                    return createVmPopupProvider.get();
                }
            } else {
                return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
        }

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(TemplateListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
                return removeConfirmPopupProvider.get();
            } else if ("OnSave".equals(lastExecutedCommand.getName())) {
                // $NON-NLS-1$
                return defaultConfirmPopupProvider.get();
            } else if (// $NON-NLS-1$
            "OnSaveVm".equals(lastExecutedCommand.getName()) && source.getConfirmWindow() instanceof VmHighPerformanceConfigurationModel) {
                return highPerformanceConfigurationProvider.get();
            } else {
                return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
        }
    };
    result.setModelProvider(modelProvider);
    return result;
}
Also used : MainViewModelProvider(org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) EditDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.EditDiskModel) NewDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.NewDiskModel) TemplateInterfaceListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateInterfaceListModel) TemplateEventListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateEventListModel) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) NewDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.NewDiskModel) TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) TemplateVmListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateVmListModel) TemplateStorageListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateStorageListModel) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) EditDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.EditDiskModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) TemplateDiskListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateDiskListModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) TemplateGeneralModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateGeneralModel) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) TemplateListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

TemplateListModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateListModel)4 TemplateGeneralModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateGeneralModel)3 DetailModelProvider (org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider)2 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)1 Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)1 MainViewModelProvider (org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 Model (org.ovirt.engine.ui.uicommonweb.models.Model)1 PermissionListModel (org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel)1 TemplateDiskListModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateDiskListModel)1 TemplateEventListModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateEventListModel)1 TemplateInterfaceListModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateInterfaceListModel)1 TemplateStorageListModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateStorageListModel)1 TemplateVmListModel (org.ovirt.engine.ui.uicommonweb.models.templates.TemplateVmListModel)1 AttachDiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel)1 DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)1 EditDiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.EditDiskModel)1