Common base for all JBST nodes.
예제 #1
0
        private void AddAttribute(string name, JbstControl value)
        {
            if (this.current == null)
            {
                throw new InvalidOperationException("Unexpected attribute");
            }

            this.current.Attributes[name] = value;
        }
예제 #2
0
        private void AppendChild(JbstControl child)
        {
            if (child == null)
            {
                return;
            }

            if (this.current == null)
            {
                this.current = this.document;
            }

            this.current.ChildControls.Add(child);
        }
예제 #3
0
        /// <summary>
        /// Append another code block onto declaration block
        /// </summary>
        /// <param name="control"></param>
        public void Append(JbstControl control)
        {
            if (control is JbstCodeBlock)
            {
                this.Content.Append(((JbstCodeBlock)control).Code);
            }
            else if (control is JbstLiteral)
            {
                this.Content.Append(((JbstLiteral)control).Text);
            }
            else if (control is JbstContainerControl)
            {
                JbstContainerControl parent = (JbstContainerControl)control;

                while (parent.ChildControlsSpecified)
                {
                    // this will remove it from the collection
                    this.Append(parent.ChildControls[0]);
                }
            }

            // remove from the parse tree since is pre-aggregated
            control.Parent.ChildControls.Remove(control);
        }
예제 #4
0
        private void AppendChild(JbstControl child)
        {
            if (child == null)
            {
                return;
            }

            if (this.current == null)
            {
                this.current = this.document;
            }

            this.current.ChildControls.Add(child);
        }
예제 #5
0
        private void AddAttribute(string name, JbstControl value)
        {
            if (this.current == null)
            {
                throw new InvalidOperationException("Unexpected attribute");
            }

            this.current.Attributes[name] = value;
        }
예제 #6
0
        /// <summary>
        /// Append another code block onto declaration block
        /// </summary>
        /// <param name="control"></param>
        public void Append(JbstControl control)
        {
            if (control is JbstCodeBlock)
            {
                this.Content.Append( ((JbstCodeBlock)control).Code );
            }
            else if (control is JbstLiteral)
            {
                this.Content.Append( ((JbstLiteral)control).Text );
            }
            else if (control is JbstContainerControl)
            {
                JbstContainerControl parent = (JbstContainerControl)control;

                while (parent.ChildControlsSpecified)
                {
                    // this will remove it from the collection
                    this.Append(parent.ChildControls[0]);
                }
            }

            // remove from the parse tree since is pre-aggregated
            control.Parent.ChildControls.Remove(control);
        }