Search in sources :

Example 66 with UICommand

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

the class VmBaseListModel method setupNewVmModel.

protected void setupNewVmModel(UnitVmModel model, VmType vmtype, List<UICommand> uiCommands) {
    model.setTitle(ConstantsManager.getInstance().getConstants().newVmTitle());
    model.setHelpTag(HelpTag.new_vm);
    // $NON-NLS-1$
    model.setHashName("new_vm");
    model.setIsNew(true);
    model.getVmType().setSelectedItem(vmtype);
    model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList());
    // $NON-NLS-1$
    model.setIsAdvancedModeLocalStorageKey("wa_vm_dialog");
    setWindow(model);
    model.initialize();
    VmBasedWidgetSwitchModeCommand switchModeCommand = new VmBasedWidgetSwitchModeCommand();
    switchModeCommand.init(model);
    model.getCommands().add(switchModeCommand);
    model.getProvisioning().setEntity(true);
    for (UICommand uicommand : uiCommands) {
        model.getCommands().add(uicommand);
    }
    model.initForemanProviders(null);
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VmBasedWidgetSwitchModeCommand(org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand)

Example 67 with UICommand

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

the class StorageDRListModel method newDR.

private void newDR() {
    if (getWindow() != null) {
        return;
    }
    final StorageDomain storageDomain = getEntity();
    if (storageDomain == null) {
        return;
    }
    final StorageDRModel model = new StorageDRModel();
    model.setHelpTag(HelpTag.new_storage_dr);
    // $NON-NLS-1$
    model.setHashName("new_storage_dr");
    model.setTitle(ConstantsManager.getInstance().getConstants().newDRSetup());
    setWindow(model);
    model.getStorageDomain().setEntity(storageDomain);
    model.startProgress();
    AsyncDataProvider.getInstance().getGlusterGeoRepSessionsForStorageDomain(new AsyncQuery<>(geoRepSessions -> {
        model.getGeoRepSession().setItems(geoRepSessions);
        // show error if there are no associated geoRepSessions
        if (geoRepSessions.isEmpty()) {
            model.setMessage(ConstantsManager.getInstance().getConstants().noGeoRepSessionForGlusterVolume());
        }
        model.stopProgress();
    }), storageDomain.getId());
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Guid(org.ovirt.engine.core.compat.Guid) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) Map(java.util.Map) StorageSyncScheduleParameters(org.ovirt.engine.core.common.action.StorageSyncScheduleParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 68 with UICommand

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

the class StorageDataCenterListModel method postAttachInit.

public void postAttachInit(ArrayList<EntityModel> datacenters) {
    ListModel<EntityModel> model = new ListModel<>();
    model.setHelpTag(HelpTag.attach_storage);
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().attachToDataCenterTitle());
    if (getEntity() != null) {
        switch(getEntity().getStorageDomainType()) {
            case ISO:
                setHelpTag(HelpTag.attach_iso_library);
                break;
            case Data:
                setHelpTag(HelpTag.attach_storage);
                break;
            case ImportExport:
                setHelpTag(HelpTag.attach_export_domain);
                break;
        }
    }
    if (datacenters.isEmpty()) {
        model.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoDataCenterStorageDomainAttachedMsg());
        // $NON-NLS-1$
        UICommand tempVar = new UICommand("Cancel", this);
        tempVar.setTitle(ConstantsManager.getInstance().getConstants().close());
        tempVar.setIsDefault(true);
        tempVar.setIsCancel(true);
        model.getCommands().add(tempVar);
    } else {
        model.setItems(datacenters);
        List<EntityModel> initialSelection = new ArrayList<>();
        initialSelection.add(datacenters.get(0));
        model.setSelectedItems(initialSelection);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttach", this);
        model.getCommands().add(tempVar2);
        // $NON-NLS-1$
        UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this);
        model.getCommands().add(tempVar3);
    }
}
Also used : SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 69 with UICommand

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

the class StorageDataCenterListModel method detach.

private void detach() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle());
    model.setHelpTag(HelpTag.detach_storage);
    // $NON-NLS-1$
    model.setHashName("detach_storage");
    model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg());
    ArrayList<String> items = new ArrayList<>();
    boolean shouldAddressWarnning = false;
    for (Object item : getSelectedItems()) {
        StorageDomain a = (StorageDomain) item;
        items.add(a.getStoragePoolName());
        if (a.getStorageDomainType().isDataDomain()) {
            shouldAddressWarnning = true;
            break;
        }
    }
    model.setItems(items);
    if (containsLocalStorage(model)) {
        model.getForce().setIsAvailable(true);
        model.getForce().setIsChangeable(true);
        model.setForceLabel(ConstantsManager.getInstance().getConstants().storageRemovePopupFormatLabel());
        shouldAddressWarnning = false;
        model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString()));
    }
    if (shouldAddressWarnning) {
        model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote());
    }
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnDetach", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 70 with UICommand

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

the class UploadImageModel method showUploadDialog.

/**
 * Build and display the Upload Image dialog.
 *
 * @param parent Parent model
 * @param helpTag Help tag (dependent upon location in UI)
 * @param limitToStorageDomainId Pre-selected storage domain, or null to not limit selection
 * @param resumeUploadDisk DiskImage corresponding to upload being resumed, or null for new upload
 */
public static <T extends Model & ICommandTarget> void showUploadDialog(T parent, HelpTag helpTag, Guid limitToStorageDomainId, DiskImage resumeUploadDisk) {
    UploadImageModel model = new UploadImageModel(limitToStorageDomainId, resumeUploadDisk);
    // Silently resume upload if handler already exists in UploadImageManager
    if (resumeUploadDisk != null && UploadImageManager.getInstance().isUploadImageHandlerExists(resumeUploadDisk.getId())) {
        model.initiateSilentResumeUpload();
        return;
    }
    model.setTitle(resumeUploadDisk == null ? ConstantsManager.getInstance().getConstants().uploadImageTitle() : ConstantsManager.getInstance().getConstants().uploadImageResumeTitle());
    model.setHelpTag(helpTag);
    // $NON-NLS-1$
    model.setHashName("upload_disk_image");
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", parent);
    model.setCancelCommand(cancelCommand);
    model.getCommands().add(cancelCommand);
    parent.setWindow(model);
    model.initialize();
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)257 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)134 ArrayList (java.util.ArrayList)105 List (java.util.List)49 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)49 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)49 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)48 ActionType (org.ovirt.engine.core.common.action.ActionType)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)47 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)44 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)41 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)36 Guid (org.ovirt.engine.core.compat.Guid)36 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)33 QueryType (org.ovirt.engine.core.common.queries.QueryType)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)30 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)29 Linq (org.ovirt.engine.ui.uicommonweb.Linq)28 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)26 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)24