Esempio n. 1
0
        /// <summary>
        /// Adds a child QueryOption node, registering 'option changed' event to root node</summary>
        /// <param name="parentNode">Node to receive child</param>
        /// <returns>Instance of the new QueryOption child node</returns>
        public static QueryOption AddOption(this QueryNode parentNode)
        {
            QueryOption newQueryOption = parentNode.Add(new QueryOption()) as QueryOption;

            // register 'option changed' event to root node
            QueryRoot rootNode = newQueryOption.Root as QueryRoot;

            if (rootNode != null)
            {
                rootNode.RegisterQueryOption(newQueryOption);
            }

            return(newQueryOption);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a child QueryTextInput node, registering 'replace text changed' event to root node</summary>
        /// <param name="parentNode">QueryNode to receive child</param>
        /// <param name="textInput">Null, or instance of QueryTextInput to use as child (for sharing same text input instance between nodes)</param>
        /// <param name="isNumericalText">Whether text input to text box is numeric or not</param>
        /// <returns>Instance of the new (or passed in) QueryTextInput child node</returns>
        public static QueryTextInput AddReplaceTextInput(this QueryNode parentNode, QueryTextInput textInput, bool isNumericalText)
        {
            QueryTextInput newTextInput = AddTextInput(parentNode, textInput, isNumericalText);

            if (newTextInput != null && newTextInput != textInput)
            {
                // register 'replace text changed' event to root node
                QueryRoot rootNode = newTextInput.Root as QueryRoot;
                if (rootNode != null)
                {
                    rootNode.RegisterReplaceQueryTextInput(newTextInput);
                }
            }

            return(newTextInput);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds a child QueryTextInput node for numerical text input, registering 'search text changed' event to root node</summary>
        /// <param name="parentNode">QueryNode to receive child</param>
        /// <param name="textInput">Null, or instance of QueryTextInput to use as child (for sharing same text input instance between nodes)</param>
        /// <returns>Instance of the new (or passed in) QueryTextInput child node</returns>
        public static QueryTextInput AddNumericalSearchTextInput(this QueryNode parentNode, QueryTextInput textInput)
        {
            QueryTextInput newTextInput = AddTextInput(parentNode, textInput, true);

            if (newTextInput != null && newTextInput != textInput)
            {
                // register 'search text changed' event to root node
                QueryRoot rootNode = newTextInput.Root as QueryRoot;
                if (rootNode != null)
                {
                    rootNode.RegisterSearchQueryTextInput(newTextInput);
                }
            }

            return(newTextInput);
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="parentNode">Parent QueryNode</param>
        /// <param name="numericalQueryOptions">Numerical search types</param>
        public QueryNumericalInput(QueryNode parentNode, NumericalQuery numericalQueryOptions)
        {
            m_textInput1 = null;
            m_textInput2 = null;

            parentNode.Add(this);

            // get root node
            QueryNode nodeAbove = parentNode;

            while (nodeAbove.Parent != null)
            {
                nodeAbove = nodeAbove.Parent as QueryNode;
            }

            // register 'option changed' event to root node
            QueryRoot rootNode = nodeAbove as QueryRoot;

            if (rootNode != null)
            {
                rootNode.RegisterQueryOption(this);
            }

            if (numericalQueryOptions != NumericalQuery.None)
            {
                QueryOptionItem newOptionItem;

                // "equals"
                if ((numericalQueryOptions & NumericalQuery.Equals) != 0)
                {
                    newOptionItem = this.AddOptionItem("equals", (UInt64)NumericalQuery.Equals);
                    m_textInput1  = newOptionItem.AddNumericalSearchTextInput(m_textInput1);
                }

                // "lesser than"
                if ((numericalQueryOptions & NumericalQuery.Lesser) != 0)
                {
                    newOptionItem = this.AddOptionItem("is less than", (UInt64)NumericalQuery.Lesser);
                    m_textInput1  = newOptionItem.AddNumericalSearchTextInput(m_textInput1);
                }

                // "lesser than or equal to"
                if ((numericalQueryOptions & NumericalQuery.LesserEqual) != 0)
                {
                    newOptionItem = this.AddOptionItem("is lesser or equal to", (UInt64)NumericalQuery.LesserEqual);
                    m_textInput1  = newOptionItem.AddNumericalSearchTextInput(m_textInput1);
                }

                // "greater than or equal"
                if ((numericalQueryOptions & NumericalQuery.GreaterEqual) != 0)
                {
                    newOptionItem = this.AddOptionItem("is greater or equal to", (UInt64)NumericalQuery.GreaterEqual);
                    m_textInput1  = newOptionItem.AddNumericalSearchTextInput(m_textInput1);
                }

                // "greater than"
                if ((numericalQueryOptions & NumericalQuery.Greater) != 0)
                {
                    newOptionItem = this.AddOptionItem("is greater than", (UInt64)NumericalQuery.Greater);
                    m_textInput1  = newOptionItem.AddNumericalSearchTextInput(m_textInput1);
                }

                // "between"
                if ((numericalQueryOptions & NumericalQuery.Between) != 0)
                {
                    newOptionItem = this.AddOptionItem("is between", (UInt64)NumericalQuery.Between);
                    m_textInput1  = newOptionItem.AddNumericalSearchTextInput(m_textInput1);
                    newOptionItem.AddLabel("and");
                    m_textInput2 = newOptionItem.AddNumericalSearchTextInput(m_textInput2);
                }
            }
        }
        /// <summary>
        /// Constructor</summary>
        /// <param name="parentNode">Parent QueryNode</param>
        /// <param name="stringQueryOptions">String search types</param>
        public QueryStringInput(QueryNode parentNode, StringQuery stringQueryOptions)
        {
            m_textInput = null;

            parentNode.Add(this);

            // get root node
            QueryNode nodeAbove = parentNode;

            while (nodeAbove.Parent != null)
            {
                nodeAbove = nodeAbove.Parent as QueryNode;
            }

            // register 'option changed' event to root node
            QueryRoot rootNode = nodeAbove as QueryRoot;

            if (rootNode != null)
            {
                rootNode.RegisterQueryOption(this);
            }

            if (stringQueryOptions != StringQuery.None)
            {
                QueryOptionItem newOptionItem;

                // "regular expression"
                if ((stringQueryOptions & StringQuery.RegularExpression) != 0)
                {
                    newOptionItem = this.AddOptionItem("matches the regular expression", (UInt64)StringQuery.RegularExpression);
                    m_textInput   = newOptionItem.AddStringSearchTextInput(m_textInput);
                }

                // "contains"
                if ((stringQueryOptions & StringQuery.Contains) != 0)
                {
                    newOptionItem = this.AddOptionItem("contains", (UInt64)StringQuery.Contains);
                    m_textInput   = newOptionItem.AddStringSearchTextInput(m_textInput);
                }

                // "matches"
                if ((stringQueryOptions & StringQuery.Matches) != 0)
                {
                    newOptionItem = this.AddOptionItem("is", (UInt64)StringQuery.Matches);
                    m_textInput   = newOptionItem.AddStringSearchTextInput(m_textInput);
                }

                // "begins with"
                if ((stringQueryOptions & StringQuery.BeginsWith) != 0)
                {
                    newOptionItem = this.AddOptionItem("begins with", (UInt64)StringQuery.BeginsWith);
                    m_textInput   = newOptionItem.AddStringSearchTextInput(m_textInput);
                }

                // "ends with"
                if ((stringQueryOptions & StringQuery.EndsWith) != 0)
                {
                    newOptionItem = this.AddOptionItem("ends with", (UInt64)StringQuery.EndsWith);
                    m_textInput   = newOptionItem.AddStringSearchTextInput(m_textInput);
                }
            }
        }