private void addUpgradeCommands(VDS host, boolean isOnlyClose) { if (!isOnlyClose) { UICommand command = UICommand.createDefaultOkUiCommand(ON_UPGRADE, this); getCommands().add(0, command); } getUserName().setEntity(host.getSshUsername()); getCancelCommand().setTitle(isOnlyClose ? constants.close() : constants.cancel()); }
public void init(final Collection<VmTemplate> externalTemplates, final Guid dataCenterId) { setCloseCommand(new UICommand(null, this) .setTitle(ConstantsManager.getInstance().getConstants().close()) .setIsDefault(true) .setIsCancel(true));
private void addInstallCommands(InstallModel model, VDS host, boolean isOnlyClose) { if (!isOnlyClose) { UICommand command = UICommand.createDefaultOkUiCommand("OnInstall", this); //$NON-NLS-1$ model.getCommands().add(command); } model.getUserName().setEntity(host.getSshUsername()); UICommand command = new UICommand("Cancel", this); //$NON-NLS-1$ command.setTitle(isOnlyClose ? ConstantsManager.getInstance().getConstants().close() : ConstantsManager.getInstance().getConstants().cancel()); command.setIsCancel(true); model.getCommands().add(command); }
private void postAttachInternal(List<EntityModel> models) { ListModel listModel = (ListModel) getWindow(); listModel.setItems(models); if (models.isEmpty()) { listModel.setMessage(ConstantsManager.getInstance() .getConstants() .thereAreNoCompatibleStorageDomainsAttachThisDcMsg()); UICommand tempVar = new UICommand("Cancel", this); //$NON-NLS-1$ tempVar.setTitle(ConstantsManager.getInstance().getConstants().close()); tempVar.setIsDefault(true); tempVar.setIsCancel(true); listModel.getCommands().add(tempVar); } else { UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttach", this); //$NON-NLS-1$ listModel.getCommands().add(tempVar2); UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this); //$NON-NLS-1$ listModel.getCommands().add(tempVar3); } }
private void initVmSnapshots() { AsyncDataProvider.getInstance().getVmSnapshotList(new AsyncQuery<>(snapshots -> { if (showWarningForByVmSnapshotsValidation(snapshots)) { UICommand closeCommand = getCancelCommand() .setTitle(ConstantsManager.getInstance().getConstants().close()); getCommands().add(closeCommand); stopProgress(); } else { initVmDisks(); } }), vm.getId()); }
private void initCommands() { if (!clusterPolicy.isLocked() || commandType == CommandType.Clone) { UICommand onSaveCommand = UICommand.createDefaultOkUiCommand("OnSave", this); //$NON-NLS-1$ getCommands().add(onSaveCommand); UICommand onResetCommand = new UICommand("OnReset", this); //$NON-NLS-1$ onResetCommand.setTitle(ConstantsManager.getInstance().getConstants().resetTitle()); getCommands().add(onResetCommand); } UICommand cancelCommand = new UICommand("Cancel", this); //$NON-NLS-1$ cancelCommand.setTitle(!clusterPolicy.isLocked() ? ConstantsManager.getInstance().getConstants().cancel() : ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); getCommands().add(cancelCommand); }
protected void postCopyOrMoveInit() { ICommandTarget target = (ICommandTarget) getEntity(); if (getActiveStorageDomains().isEmpty()) { setMessage(constants.noStorageDomainAvailableMsg()); UICommand closeCommand = new UICommand("Cancel", target); //$NON-NLS-1$ closeCommand.setTitle(constants.close()); closeCommand.setIsDefault(true); closeCommand.setIsCancel(true); getCommands().add(closeCommand); } else { if (!problematicDisks.isEmpty()) { setMessage(getWarning(problematicDisks)); } UICommand actionCommand = new UICommand("OnExecute", this); //$NON-NLS-1$ actionCommand.setTitle(constants.ok()); actionCommand.setIsDefault(true); getCommands().add(actionCommand); UICommand cancelCommand = new UICommand("Cancel", target); //$NON-NLS-1$ cancelCommand.setTitle(constants.cancel()); cancelCommand.setIsCancel(true); getCommands().add(cancelCommand); } stopProgress(); }
@Override public void init(final List<VM> externalVms, final Guid dataCenterId) { setCloseCommand(new UICommand(null, this) .setTitle(ConstantsManager.getInstance().getConstants().close()) .setIsDefault(true) .setIsCancel(true)); initIsoAndAttachDriversFields(externalVms); setTargetArchitecture(externalVms); withDataCenterLoaded(dataCenterId, returnValue -> setItems(r -> doInit(), externalVms)); }
private void consoleModelError(Object sender, String message) { ConfirmationModel model = new ConfirmationModel(); if (parentModel.getConfirmWindow() == null) { parentModel.setConfirmWindow(model); } model.setTitle(ConstantsManager.getInstance().getConstants().consoleDisconnectedTitle()); model.setHelpTag(HelpTag.console_disconnected); model.setHashName("console_disconnected"); //$NON-NLS-1$ model.setMessage(message); UICommand tempVar = new UICommand("CancelError", this); //$NON-NLS-1$ tempVar.setTitle(ConstantsManager.getInstance().getConstants().close()); tempVar.setIsDefault(true); tempVar.setIsCancel(true); model.getCommands().add(tempVar); }
private void details() { AuditLog event = getSelectedItem(); if (getWindow() != null || event == null) { return; } EventModel model = new EventModel(); model.setEvent(event); model.setTitle(ConstantsManager.getInstance().getConstants().eventDetailsTitle()); model.setHelpTag(HelpTag.event_details); model.setHashName("event_details"); //$NON-NLS-1$ setWindow(model); UICommand command = new UICommand("Cancel", this); //$NON-NLS-1$ command.setTitle(ConstantsManager.getInstance().getConstants().close()); command.setIsCancel(true); model.getCommands().add(command); }
@Override protected void restore() { if (getWindow() != null) { return; } if (!validateSingleArchitecture()) { return; } ImportVmFromExportDomainModel model = importModelProvider.get(); model.setEntity(getEntity().getId()); setWindow(model); model.startProgress(); model.setTitle(ConstantsManager.getInstance().getConstants().importVirtualMachinesTitle()); model.getCommands().add(UICommand.createDefaultOkUiCommand("OnRestore", this)); //$NON-NLS-1$ model.getCommands().add(UICommand.createCancelUiCommand(CANCEL_COMMAND, this)); //$NON-NLS-1$); model.init(getSelectedItems(), getEntity().getId()); model.setTargetArchitecture(getArchitectureFromItem(getSelectedItems().get(0))); // Add 'Close' command model.setCloseCommand(new UICommand(CANCEL_COMMAND, this) //$NON-NLS-1$ .setTitle(ConstantsManager.getInstance().getConstants().close()) .setIsDefault(true) .setIsCancel(true) ); }
@Override protected void restore() { if (getWindow() != null) { return; } if (!validateSingleArchitecture()) { return; } ImportTemplateFromExportDomainModel model = importModelProvider.get(); model.setEntity(getEntity().getId()); setWindow(model); model.startProgress(); model.setTitle(ConstantsManager.getInstance().getConstants().importTemplatesTitle()); model.getCommands().add(UICommand.createDefaultOkUiCommand("OnRestore", this)); //$NON-NLS-1$ model.getCommands().add(UICommand.createCancelUiCommand(CANCEL_COMMAND, this)); //$NON-NLS-1$); model.init(getSelectedItems(), getEntity().getId()); model.setTargetArchitecture(getArchitectureFromItem(getSelectedItems().get(0))); // Add 'Close' command model.setCloseCommand(new UICommand(CANCEL_COMMAND, this) //$NON-NLS-1$ .setTitle(ConstantsManager.getInstance().getConstants().close()) .setIsDefault(true) .setIsCancel(true) ); ((TemplateImportDiskListModel) ((ImportTemplateFromExportDomainModel) getWindow()).getImportDiskListModel()).setExtendedItems(extendedItems); }
private void stopRemoveBricks() { if (getConfirmWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksTitle()); model.setMessage(ConstantsManager.getInstance().getConstants().stopRemoveBricksMessage()); model.setHelpTag(HelpTag.volume_remove_bricks_stop); model.setHashName("volume_remove_bricks_stop"); //$NON-NLS-1$ GlusterVolumeEntity volumeEntity = getVolumeEntity(); GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask(); ArrayList<String> list = new ArrayList<>(); for (GlusterBrickEntity brick : volumeEntity.getBricks()) { if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.STARTED) { list.add(brick.getQualifiedName()); } } model.setItems(list); UICommand okCommand = UICommand.createDefaultOkUiCommand("OnStopRemoveBricks", this); //$NON-NLS-1$ model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("CancelConfirmation", this); //$NON-NLS-1$ cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); model.getCommands().add(cancelCommand); }
private void retainBricks() { if (getConfirmWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().retainBricksTitle()); model.setMessage(ConstantsManager.getInstance().getConstants().retainBricksMessage()); model.setHelpTag(HelpTag.volume_retain_brick); model.setHashName("volume_retain_brick"); //$NON-NLS-1$ GlusterVolumeEntity volumeEntity = getVolumeEntity(); GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask(); ArrayList<String> list = new ArrayList<>(); for (GlusterBrickEntity brick : volumeEntity.getBricks()) { if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.FINISHED) { list.add(brick.getQualifiedName()); } } model.setItems(list); UICommand okCommand = UICommand.createDefaultOkUiCommand("OnRetainBricks", this); //$NON-NLS-1$ model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("CancelConfirmation", this); //$NON-NLS-1$ cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); model.getCommands().add(cancelCommand); }
private void showVolumeProfiling() { if(getSelectedItem() == null || getWindow()!= null) { return; } GlusterVolumeEntity selectedVolume = getSelectedItem(); VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName()); setWindow(profileStatsModel); setHelpTag(HelpTag.volume_profile_statistics); setHashName("volume_profile_statistics"); //$NON-NLS-1$ profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());//$NON-NLS-1$ UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this);//$NON-NLS-1$ closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close()); closeProfilingStats.setIsCancel(true); profileStatsModel.getCommands().add(closeProfilingStats); if (selectedVolume.isNfsEnabled()) { profileStatsModel.queryBackend(true); } profileStatsModel.queryBackend(false); }
private void managePolicyUnits() { if (getWindow() != null) { return; } policyUnitModel = new ManagePolicyUnitModel(); policyUnitModel.setTitle(ConstantsManager.getInstance().getConstants().managePolicyUnits()); policyUnitModel.setHelpTag(HelpTag.manage_policy_units); policyUnitModel.setHashName("manage_policy_units"); //$NON-NLS-1$ policyUnitModel.setPolicyUnits(new ListModel()); policyUnitModel.getPolicyUnits().setItems(sort(policyUnits)); policyUnitModel.getRefreshPolicyUnitsEvent().addListener((ev, sender, args) -> { setIsQueryFirstTime(true); syncSearch(); }); UICommand command = new UICommand("Cancel", this); //$NON-NLS-1$ command.setTitle(ConstantsManager.getInstance().getConstants().close()); command.setIsCancel(true); policyUnitModel.getCommands().add(command); setWindow(policyUnitModel); }
public void add() { if (getWindow() != null) { return; } AdElementListModel model = new AdElementListModel(); if (getUserOrGroup() == UserOrGroup.Group) { model.setSearchType(AdSearchType.GROUP); } else { model.setSearchType(AdSearchType.USER); } setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().addUsersAndGroupsTitle()); model.setHelpTag(HelpTag.add_users_and_groups); model.setHashName("add_users_and_groups"); //$NON-NLS-1$ model.setIsRoleListHidden(true); model.getIsEveryoneSelectionHidden().setEntity(true); UICommand addCommand = new UICommand("OnAdd", this); //$NON-NLS-1$ addCommand.setTitle(ConstantsManager.getInstance().getConstants().add()); model.getCommands().add(addCommand); UICommand addAndCloseCommand = new UICommand("OnAddAndClose", this); //$NON-NLS-1$ addAndCloseCommand.setTitle(ConstantsManager.getInstance().getConstants().addAndClose()); addAndCloseCommand.setIsDefault(true); model.getCommands().add(addAndCloseCommand); UICommand closeCommand = new UICommand("Cancel", this); //$NON-NLS-1$ closeCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); closeCommand.setIsCancel(true); model.getCommands().add(closeCommand); }
private void checkUpServerAndAddBricks() { if (getWindow() != null) { return; } final GlusterVolumeEntity volumeEntity = getEntity(); cancelConfirmation(); if (volumeEntity == null) { return; } AsyncDataProvider.getInstance().isAnyHostUpInCluster(new AsyncQuery<>(clusterHasUpHost -> { if (clusterHasUpHost) { preAddBricks(volumeEntity); } else { ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle()); model.setMessage(ConstantsManager.getInstance() .getConstants() .cannotAddBricksNoUpServerFound()); model.setHelpTag(HelpTag.cannot_add_bricks); model.setHashName("cannot_add_bricks"); //$NON-NLS-1$ UICommand command = new UICommand("Cancel", VolumeBrickListModel.this); //$NON-NLS-1$ command.setTitle(ConstantsManager.getInstance().getConstants().close()); command.setIsCancel(true); model.getCommands().add(command); return; } }), volumeEntity.getClusterName()); }
command.setTitle(ConstantsManager.getInstance().getConstants().close()); command.setIsCancel(true); contentModel.getCommands().add(command);
command.setTitle(ConstantsManager.getInstance().getConstants().close()); command.setIsCancel(true); glusterSwiftModel.getCommands().add(command);