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);
}
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);
}
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);
}
}
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);
}
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();
}
Aggregations