Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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;
            }
        }