use of org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel in project ovirt-engine by oVirt.
the class UserListModel method assignTags.
public void assignTags() {
if (getWindow() != null) {
return;
}
TagListModel model = new TagListModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().assignTagsTitle());
model.setHelpTag(HelpTag.assign_tags_users);
// $NON-NLS-1$
model.setHashName("assign_tags_users");
getAttachedTagsToSelectedUsers(model);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnAssignTags", 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.models.tags.TagListModel in project ovirt-engine by oVirt.
the class VmListModel method postOnAssignTags.
@Override
public void postOnAssignTags(Map<Guid, Boolean> attachedTags) {
TagListModel model = (TagListModel) getWindow();
ArrayList<Guid> vmIds = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
vmIds.add(vm.getId());
}
// prepare attach/detach lists
ArrayList<Guid> tagsToAttach = new ArrayList<>();
ArrayList<Guid> tagsToDetach = new ArrayList<>();
if (model.getItems() != null && model.getItems().size() > 0) {
ArrayList<TagModel> tags = (ArrayList<TagModel>) model.getItems();
TagModel rootTag = tags.get(0);
TagModel.recursiveEditAttachDetachLists(rootTag, attachedTags, tagsToAttach, tagsToDetach);
}
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (Guid a : tagsToAttach) {
parameters.add(new AttachEntityToTagParameters(a, vmIds));
}
Frontend.getInstance().runMultipleAction(ActionType.AttachVmsToTag, parameters);
parameters = new ArrayList<>();
for (Guid a : tagsToDetach) {
parameters.add(new AttachEntityToTagParameters(a, vmIds));
}
Frontend.getInstance().runMultipleAction(ActionType.DetachVmFromTag, parameters);
cancel();
}
use of org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel in project ovirt-engine by oVirt.
the class VmListModel method onAssignTags.
private void onAssignTags() {
TagListModel model = (TagListModel) getWindow();
getAttachedTagsToSelectedVMs(model);
}
Aggregations