private void AddAttribute(string name, JbstControl value) { if (this.current == null) { throw new InvalidOperationException("Unexpected attribute"); } this.current.Attributes[name] = value; }
private void AppendChild(JbstControl child) { if (child == null) { return; } if (this.current == null) { this.current = this.document; } this.current.ChildControls.Add(child); }
/// <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); }
/// <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); }