/// <summary> /// Rebuilds the whole structure according to the MacroDesignerTree object. /// </summary> public void RebuildDesigner() { MacroDesignerGroup root = GetRootGroup(); root.StoreData(); root.BuildDesigner(true); }
/// <summary> /// Moves the group to given location. /// </summary> /// <param name="sourcePath">Position path of the source</param> /// <param name="targetPath">Position path of the target</param> /// <param name="targetPos">Position within the target</param> public void MoveGroup(string sourcePath, string targetPath, int targetPos) { MacroDesignerGroup root = GetRootGroup(); root.StoreData(); root.CurrentGroup.MoveGroup(sourcePath, targetPath, targetPos); root.BuildDesigner(true); }
/// <summary> /// Builds the designer controls structure. /// </summary> public override void BuildDesigner(bool recursive) { // Append child groups and expressions pnlGroups.Controls.Clear(); if (CurrentGroup.IsLeaf) { plcNoItems.Visible = false; AddExpression(CurrentGroup.LeftExpression, CurrentGroup.RightExpression, CurrentGroup.Operator, CurrentGroup.IDPath); } else { if (CurrentGroup.Level == 0) { plcNoItems.Visible = true; } // Add child groups foreach (MacroDesignerTree child in CurrentGroup.ChildGroups) { MacroDesignerGroup ctrl = (MacroDesignerGroup)AddGroup(child.IDPath); ctrl.GroupOperator = child.GroupOperator; ctrl.CurrentGroup = child; if (recursive) { ctrl.BuildDesigner(true); } plcNoItems.Visible = false; } // Drop cue Panel pnlCue = new Panel(); pnlCue.ID = "pnlCue"; pnlCue.CssClass = "MacroDesignerCue"; pnlGroups.Controls.Add(pnlCue); pnlCue.Controls.Add(new LiteralControl(" ")); pnlCue.Style.Add("display", "none"); // Create drag and drop extender extDragDrop = new DragAndDropExtender(); extDragDrop.ID = "extDragDrop"; extDragDrop.TargetControlID = pnlGroups.ID; extDragDrop.DragItemClass = "MacroElement"; extDragDrop.DragItemHandleClass = "MacroElementHandle"; extDragDrop.DropCueID = pnlCue.ID; extDragDrop.OnClientDrop = "OnDropGroup"; pnlGroups.Controls.Add(extDragDrop); } }
protected void btnAddGroup_Click(object sender, ImageClickEventArgs e) { MacroDesignerGroup root = GetRootGroup(); root.StoreData(); MacroDesignerTree item = CurrentGroup.AddGroup(); AddGroup(item.IDPath); root.BuildDesigner(true); }
protected void btnAddExp_Click(object sender, ImageClickEventArgs e) { MacroDesignerGroup root = GetRootGroup(); root.StoreData(); MacroDesignerTree item = this.CurrentGroup.AddExpression(); MacroDesignerGroup ctrl = (MacroDesignerGroup)this.AddGroup(item.IDPath); ctrl.CurrentGroup = item; root.BuildDesigner(true); }