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

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

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

            this.current.ChildControls.Add(child);
        }
Beispiel #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);
        }
Beispiel #4
0
        private void AppendChild(JbstControl child)
        {
            if (child == null)
            {
                return;
            }

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

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

            this.current.Attributes[name] = value;
        }
        /// <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);
        }