use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class AbstractModelBoundPopupPresenterWidget method addFooterButtons.
void addFooterButtons(T model) {
for (int i = model.getCommands().size() - 1; i >= 0; i--) {
UICommand command = model.getCommands().get(i);
final HasUiCommandClickHandlers button = getView().addFooterButton(command.getTitle(), command.getName(), model.getDefaultCommand() != null && model.getDefaultCommand().equals(command));
button.setCommand(command);
// Register command execution handler
registerHandler(button.addClickHandler(event -> {
getView().flush();
beforeCommandExecuted(button.getCommand());
button.getCommand().execute();
}));
}
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGeneralModel method fetchAndImportNewGlusterHosts.
public void fetchAndImportNewGlusterHosts() {
if (getWindow() != null) {
return;
}
final MultipleHostsModel hostsModel = new MultipleHostsModel();
setWindow(hostsModel);
hostsModel.setTitle(ConstantsManager.getInstance().getConstants().addMultipleHostsTitle());
hostsModel.setHelpTag(HelpTag.add_hosts);
// $NON-NLS-1$
hostsModel.setHashName("add_hosts");
// $NON-NLS-1$
UICommand command = UICommand.createOkUiCommand("OnSaveHosts", this);
hostsModel.getCommands().add(command);
hostsModel.getHosts().setItems(new ArrayList<EntityModel<HostDetailModel>>());
// $NON-NLS-1$
hostsModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
hostsModel.startProgress();
AsyncDataProvider.getInstance().getGlusterHostsNewlyAdded(new AsyncQuery<>(hostMap -> {
if (hostMap == null || hostMap.isEmpty()) {
hostsModel.setMessage(ConstantsManager.getInstance().getConstants().emptyNewGlusterHosts());
} else {
ArrayList<EntityModel<HostDetailModel>> list = new ArrayList<>();
for (Map.Entry<String, String> host : hostMap.entrySet()) {
HostDetailModel hostModel = new HostDetailModel(host.getKey(), host.getValue());
hostModel.setName(host.getKey());
// $NON-NLS-1$
hostModel.setPassword("");
EntityModel<HostDetailModel> entityModel = new EntityModel<>(hostModel);
list.add(entityModel);
}
hostsModel.getHosts().setItems(list);
}
hostsModel.stopProgress();
}), getEntity().getId(), true);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGlusterHookListModel method viewHook.
private void viewHook() {
if (getWindow() != null) {
return;
}
GlusterHookEntity hookEntity = getSelectedItem();
if (hookEntity == null) {
return;
}
final GlusterHookContentModel contentModel = new GlusterHookContentModel();
contentModel.setTitle(ConstantsManager.getInstance().getConstants().viewContentGlusterHookTitle());
contentModel.setHelpTag(HelpTag.view_gluster_hook);
// $NON-NLS-1$
contentModel.setHashName("view_gluster_hook");
setWindow(contentModel);
contentModel.startProgress();
AsyncDataProvider.getInstance().getGlusterHookContent(new AsyncQuery<>(content -> {
contentModel.getContent().setEntity(content);
if (content == null) {
contentModel.getContent().setIsAvailable(false);
contentModel.setMessage(ConstantsManager.getInstance().getConstants().viewContentErrorGlusterHook());
} else if (content.length() == 0) {
contentModel.getContent().setIsAvailable(false);
contentModel.setMessage(ConstantsManager.getInstance().getConstants().viewContentEmptyGlusterHook());
}
contentModel.stopProgress();
}), hookEntity.getId(), null);
// $NON-NLS-1$
UICommand command = new UICommand("Cancel", this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
contentModel.getCommands().add(command);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGlusterHookListModel method disableHook.
private void disableHook() {
if (getWindow() != null) {
return;
}
if (getSelectedItems() == null || getSelectedItems().size() == 0) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().confirmDisableGlusterHooks());
model.setHelpTag(HelpTag.disable_hooks);
// $NON-NLS-1$
model.setHashName("disable_hooks");
model.setMessage(ConstantsManager.getInstance().getConstants().disableGlusterHooksMessage());
ArrayList<String> list = new ArrayList<>();
for (GlusterHookEntity hook : getSelectedItems()) {
list.add(hook.getName());
}
model.setItems(list);
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnDisableHook", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("OnCancelConfirmation", this);
model.getCommands().add(cancelCommand);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class ClusterGuideModel method displayAddDataCenter.
private void displayAddDataCenter(List<EntityModel<StoragePool>> dataCenters) {
ListModel<EntityModel<StoragePool>> dataCentersModel = new ListModel<>();
dataCentersModel.setItems(dataCenters);
dataCentersModel.setTitle(addDataCenterTitle);
// $NON-NLS-1$
dataCentersModel.setHashName("add_datacenter");
setWindow(dataCentersModel);
UICommand tempVar = UICommand.createDefaultOkUiCommand(ON_ADD_DATACENTER, ClusterGuideModel.this);
dataCentersModel.getCommands().add(tempVar);
UICommand tempVar2 = UICommand.createCancelUiCommand(CANCEL, ClusterGuideModel.this);
dataCentersModel.getCommands().add(tempVar2);
}
Aggregations