use of org.ovirt.engine.ui.uicommonweb.models.tags.TagModel in project ovirt-engine by oVirt.
the class TagsView method addChildTags.
private void addChildTags(List<TagModel> tagModels, HasWidgets group, final int indent) {
int newIndent = indent + 1;
for (TagModel model : tagModels) {
ListGroupItem tagItem = new ListGroupItem();
tagItem.getElement().getStyle().setPaddingLeft(indent * INDENT_WIDTH, Unit.PX);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(createActivateButton(model));
buttonGroup.add(createAddButton(model));
buttonGroup.add(createEditButton(model));
buttonGroup.add(createRemoveButton(model));
buttonGroup.addStyleName(Styles.PULL_RIGHT);
tagItem.add(buttonGroup);
tagItem.setText(model.getName().getEntity());
group.add(tagItem);
List<TagModel> children = model.getChildren();
if (children != null && !children.isEmpty()) {
addChildTags(model.getChildren(), group, newIndent);
}
}
}
use of org.ovirt.engine.ui.uicommonweb.models.tags.TagModel in project ovirt-engine by oVirt.
the class AbstractMainWithDetailsTableView method setActiveTags.
public void setActiveTags(List<TagModel> tags) {
resultList.clear();
for (final TagModel tag : tags) {
ListItem tagItem = new ListItem();
Span label = new Span();
label.addStyleName(Styles.LABEL);
label.addStyleName(PatternflyConstants.PF_LABEL_INFO);
label.setText(tag.getName().getEntity());
Anchor deactivateAnchor = new Anchor();
Span closeIconSpan = new Span();
closeIconSpan.addStyleName(PatternflyIconType.PF_BASE.getCssName());
closeIconSpan.addStyleName(PatternflyIconType.PF_CLOSE.getCssName());
deactivateAnchor.add(closeIconSpan);
deactivateAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
tag.setSelection(false);
}
});
label.add(deactivateAnchor);
tagItem.add(label);
resultList.add(tagItem);
}
resultRow.setVisible(!tags.isEmpty());
}
use of org.ovirt.engine.ui.uicommonweb.models.tags.TagModel 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();
}
Aggregations