use of org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel in project ovirt-engine by oVirt.
the class RoleListModel method setAttachedActionGroups.
void setAttachedActionGroups(List<ActionGroup> attachedActions) {
Role role = getSelectedItem();
RoleModel model = (RoleModel) getWindow();
ArrayList<SelectionTreeNodeModel> selectionTree = RoleTreeView.getRoleTreeView(model.getIsNew() ? false : role.isReadonly(), model.getIsAdminRole().getEntity());
for (SelectionTreeNodeModel sm : selectionTree) {
for (SelectionTreeNodeModel smChild : sm.getChildren()) {
smChild.setParent(sm);
smChild.setIsSelectedNotificationPrevent(false);
for (SelectionTreeNodeModel smGrandChild : smChild.getChildren()) {
smGrandChild.setParent(smChild);
smGrandChild.setIsSelectedNotificationPrevent(false);
if (attachedActions.contains(ActionGroup.valueOf(smGrandChild.getTitle()))) {
smGrandChild.setIsSelectedNullable(true);
smGrandChild.updateParentSelection();
}
if (smChild.getChildren().get(0).equals(smGrandChild)) {
smGrandChild.updateParentSelection();
}
}
}
}
model.setPermissionGroupModels(selectionTree);
}
use of org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel in project ovirt-engine by oVirt.
the class RoleListModel method onReset.
public void onReset() {
RoleModel model = (RoleModel) getWindow();
ArrayList<ActionGroup> attachedActions = commandType == CommandType.New ? new ArrayList<ActionGroup>() : publicAttachedActions;
for (SelectionTreeNodeModel sm : model.getPermissionGroupModels()) {
for (SelectionTreeNodeModel smChild : sm.getChildren()) {
for (SelectionTreeNodeModel smGrandChild : smChild.getChildren()) {
smGrandChild.setIsSelectedNullable(attachedActions.contains(ActionGroup.valueOf(smGrandChild.getTitle())));
}
}
}
}
use of org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel in project ovirt-engine by oVirt.
the class RoleTreeView method getRoleTreeView.
public static ArrayList<SelectionTreeNodeModel> getRoleTreeView(boolean isReadOnly, boolean isAdmin) {
RoleNode tree = initTreeView();
ArrayList<SelectionTreeNodeModel> roleTreeView = new ArrayList<>();
SelectionTreeNodeModel firstNode;
SelectionTreeNodeModel secondNode;
SelectionTreeNodeModel thirdNode;
for (RoleNode first : tree.getLeafRoles()) {
firstNode = createSelectionTreeNodeModel(isReadOnly, first);
for (RoleNode second : first.getLeafRoles()) {
secondNode = createSelectionTreeNodeModel(isReadOnly, second);
secondNode.setTooltip(second.getTooltip());
for (RoleNode third : second.getLeafRoles()) {
thirdNode = createLeafSelectionTreeNodeModel(isReadOnly, third);
if (isAdmin || isUser(thirdNode)) {
secondNode.getChildren().add(thirdNode);
}
}
if (secondNode.getChildren().size() > 0) {
firstNode.getChildren().add(secondNode);
}
}
if (firstNode.getChildren().size() > 0) {
roleTreeView.add(firstNode);
}
}
return roleTreeView;
}
use of org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel in project ovirt-engine by oVirt.
the class RoleTreeView method createSelectionTreeNodeModel.
protected static SelectionTreeNodeModel createSelectionTreeNodeModel(boolean isReadOnly, RoleNode roleNode) {
SelectionTreeNodeModel nodeModel;
nodeModel = new SelectionTreeNodeModel();
nodeModel.setTitle(roleNode.getName());
nodeModel.setDescription(roleNode.getDesc());
nodeModel.setIsChangeable(!isReadOnly);
return nodeModel;
}
use of org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel in project ovirt-engine by oVirt.
the class TagListModel method createTree.
public SelectionTreeNodeModel createTree(TagModel tag) {
SelectionTreeNodeModel node = new SelectionTreeNodeModel();
node.setDescription(tag.getName().getEntity());
node.setIsSelectedNullable(tag.getSelection());
node.setIsChangeable(tag.getIsChangable());
node.setIsSelectedNotificationPrevent(true);
node.setEntity(tag);
node.getPropertyChangedEvent().addListener(this);
if (tag.getChildren().isEmpty()) {
getSelectionNodeList().add(node);
return node;
}
for (TagModel childTag : tag.getChildren()) {
SelectionTreeNodeModel childNode = createTree(childTag);
childNode.setParent(node);
node.getChildren().add(childNode);
}
return node;
}
Aggregations