private void CreateAttributeValue(object sender, EventArgs args) { pol.AttributeValueElementReadWrite attr = new pol.AttributeValueElementReadWrite(Xacml.Consts.Schema1.InternalDataTypes.XsdString, "TODO: Add content", Xacml.XacmlVersion.Version11); TreeNodes.AttributeValue node = new TreeNodes.AttributeValue(attr); tvwCondition.Nodes.Add(node); _condition.Arguments.Add(attr); }
private void tvwCondition_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { if (e.Node is TreeNodes.FunctionExecution) { grpElement.Text = "Function execution"; TreeNodes.FunctionExecution node = (TreeNodes.FunctionExecution)e.Node; txtValue.Visible = false; cmbInternalFunctions.Visible = true; cmbInternalFunctions.SelectedIndex = cmbInternalFunctions.FindStringExact(node.ApplyBaseDefinition.FunctionId); label2.Text = "FunctionId:"; cmbDataType.Enabled = false; } else if (e.Node is TreeNodes.FunctionParameter) { grpElement.Text = "Function parameter"; TreeNodes.FunctionParameter node = (TreeNodes.FunctionParameter)e.Node; txtValue.Visible = false; cmbInternalFunctions.Visible = true; cmbInternalFunctions.SelectedIndex = cmbInternalFunctions.FindStringExact(node.FunctionDefinition.FunctionId); label2.Text = "FunctionId:"; cmbDataType.Enabled = false; } else if (e.Node is TreeNodes.AttributeValue) { grpElement.Text = "Attribute value"; TreeNodes.AttributeValue node = (TreeNodes.AttributeValue)e.Node; txtValue.Visible = true; cmbInternalFunctions.Visible = false; txtValue.Text = node.AttributeValueDefinition.Contents; label2.Text = "Value:"; cmbDataType.Enabled = true; cmbDataType.SelectedIndex = cmbDataType.FindStringExact(node.AttributeValueDefinition.DataType); } else if (e.Node is TreeNodes.AttributeDesignator) { grpElement.Text = "Attribute designator"; TreeNodes.AttributeDesignator node = (TreeNodes.AttributeDesignator)e.Node; txtValue.Visible = true; cmbInternalFunctions.Visible = false; txtValue.Text = node.AttributeDesignatorDefinition.AttributeId; label2.Text = "AttributeId:"; cmbDataType.Enabled = true; cmbDataType.SelectedIndex = cmbDataType.FindStringExact(node.AttributeDesignatorDefinition.DataType); } else if (e.Node is TreeNodes.AttributeSelector) { grpElement.Text = "Attribute selector"; TreeNodes.AttributeSelector node = (TreeNodes.AttributeSelector)e.Node; txtValue.Visible = true; cmbInternalFunctions.Visible = false; txtValue.Text = node.AttributeSelectorDefinition.RequestContextPath; label2.Text = "XPath:"; cmbDataType.Enabled = false; } }
private void CreateAttributeValueFromFunction(object sender, EventArgs args) { TreeNodes.FunctionExecution func = (TreeNodes.FunctionExecution)tvwCondition.SelectedNode; pol.ApplyBaseReadWrite parentApply = func.ApplyBaseDefinition; pol.AttributeValueElementReadWrite attr = new pol.AttributeValueElementReadWrite(Xacml.Consts.Schema1.InternalDataTypes.XsdString, "TODO: Add content", Xacml.XacmlVersion.Version11); TreeNodes.AttributeValue node = new TreeNodes.AttributeValue(attr); func.Nodes.Add(node); parentApply.Arguments.Add(attr); }
private void mniDelete_Click(object sender, System.EventArgs e) { TreeNodes.FunctionExecution functionNode = (TreeNodes.FunctionExecution)tvwCondition.SelectedNode.Parent; TreeNodes.NoBoldNode node = (TreeNodes.NoBoldNode)tvwCondition.SelectedNode; if (node is TreeNodes.FunctionExecution) { TreeNodes.FunctionExecution funcNode = ((TreeNodes.FunctionExecution)node); int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex((pol.ApplyElement)funcNode.ApplyBaseDefinition); functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index); functionNode.Nodes.Remove(funcNode); } else if (node is TreeNodes.FunctionParameter) { TreeNodes.FunctionParameter funcNode = ((TreeNodes.FunctionParameter)node); int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(funcNode.FunctionDefinition); functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index); functionNode.Nodes.Remove(funcNode); } else if (node is TreeNodes.AttributeValue) { TreeNodes.AttributeValue attNode = ((TreeNodes.AttributeValue)node); int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(attNode.AttributeValueDefinition); functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index); functionNode.Nodes.Remove(attNode); } else if (node is TreeNodes.AttributeDesignator) { TreeNodes.AttributeDesignator attNode = ((TreeNodes.AttributeDesignator)node); int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(attNode.AttributeDesignatorDefinition); functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index); functionNode.Nodes.Remove(attNode); } else if (node is TreeNodes.AttributeSelector) { TreeNodes.AttributeSelector attNode = ((TreeNodes.AttributeSelector)node); int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(attNode.AttributeSelectorDefinition); functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index); functionNode.Nodes.Remove(attNode); } }
private void tvwCondition_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) { TreeNodes.NoBoldNode node = (TreeNodes.NoBoldNode)tvwCondition.SelectedNode; if (node is TreeNodes.FunctionExecution) { TreeNodes.FunctionExecution funcNode = ((TreeNodes.FunctionExecution)node); funcNode.ApplyBaseDefinition.FunctionId = cmbInternalFunctions.Text; tvwCondition.SelectedNode = funcNode; tvwCondition.SelectedNode.Text = "[" + "dataType" + "] " + funcNode.ApplyBaseDefinition.FunctionId; } else if (node is TreeNodes.FunctionParameter) { TreeNodes.FunctionParameter funcNode = ((TreeNodes.FunctionParameter)node); funcNode.FunctionDefinition.FunctionId = cmbInternalFunctions.Text; tvwCondition.SelectedNode = funcNode; tvwCondition.SelectedNode.Text = "Function: " + funcNode.FunctionDefinition.FunctionId;; } else if (node is TreeNodes.AttributeValue) { TreeNodes.AttributeValue attNode = ((TreeNodes.AttributeValue)node); attNode.AttributeValueDefinition.Value = txtValue.Text; attNode.AttributeValueDefinition.DataType = cmbDataType.Text; tvwCondition.SelectedNode = attNode; tvwCondition.SelectedNode.Text = "[" + attNode.AttributeValueDefinition.DataType + "] " + attNode.AttributeValueDefinition.Contents; } else if (node is TreeNodes.AttributeDesignator) { TreeNodes.AttributeDesignator attNode = ((TreeNodes.AttributeDesignator)node); attNode.AttributeDesignatorDefinition.AttributeId = txtValue.Text; attNode.AttributeDesignatorDefinition.DataType = cmbDataType.Text; tvwCondition.SelectedNode = attNode; tvwCondition.SelectedNode.Text = "[" + attNode.AttributeDesignatorDefinition.DataType + "]:" + attNode.AttributeDesignatorDefinition.AttributeId; } else if (node is TreeNodes.AttributeSelector) { TreeNodes.AttributeSelector attNode = ((TreeNodes.AttributeSelector)node); attNode.AttributeSelectorDefinition.RequestContextPath = txtValue.Text; tvwCondition.SelectedNode = attNode; tvwCondition.SelectedNode.Text = "XPath: " + attNode.AttributeSelectorDefinition.RequestContextPath; } }
private void CreateAttributeValueFromFunction( object sender, EventArgs args ) { TreeNodes.FunctionExecution func = (TreeNodes.FunctionExecution)tvwCondition.SelectedNode; pol.ApplyBaseReadWrite parentApply = func.ApplyBaseDefinition; pol.AttributeValueElementReadWrite attr = new pol.AttributeValueElementReadWrite( Xacml.Consts.Schema1.InternalDataTypes.XsdString, "TODO: Add content", Xacml.XacmlVersion.Version11 ); TreeNodes.AttributeValue node = new TreeNodes.AttributeValue( attr ); func.Nodes.Add( node ); parentApply.Arguments.Add( attr ); }
private void CreateAttributeValue( object sender, EventArgs args ) { pol.AttributeValueElementReadWrite attr = new pol.AttributeValueElementReadWrite( Xacml.Consts.Schema1.InternalDataTypes.XsdString, "TODO: Add content", Xacml.XacmlVersion.Version11 ); TreeNodes.AttributeValue node = new TreeNodes.AttributeValue( attr ); tvwCondition.Nodes.Add( node ); _condition.Arguments.Add( attr ); }