private static void AddLinkFromCapability(ShuffleBuilder tree, string name, string tag = null, bool alignright = false) { var link = new LinkLabel { AutoSize = true, Dock = alignright ? DockStyle.Right : DockStyle.Left, TabIndex = tree.gbNodeQuickActions.Controls.Count, TabStop = true, Text = name }; var tagstr = tag ?? name; if (!string.IsNullOrEmpty(tagstr)) { link.Tag = tagstr; link.LinkBehavior = LinkBehavior.HoverUnderline; link.LinkClicked += tree.QuickActionLink_LinkClicked; } else { link.Enabled = false; } tree.gbNodeQuickActions.Controls.Add(link); if (!alignright) { link.BringToFront(); } }
public ImportAttributeControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : this() { if (collection != null) { collec = collection; } FillControls(); Saved += shuffleBuilder.CtrlSaved; }
public DataBlockExportControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : this() { if (collection != null) { collec = collection; } FillControls(); Saved += shuffleBuilder.CtrlSaved; }
public PreReqSolutionControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : this() { if (collection != null) { collec = collection; } FillControls(); Saved += shuffleBuilder.CtrlSaved; }
private static void AddLinkSeparator(ShuffleBuilder tree) { var sep = new Label { AutoSize = true, Dock = DockStyle.Left, Text = "|" }; tree.gbNodeQuickActions.Controls.Add(sep); sep.BringToFront(); }
public DataBlockImportControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { var overwrite = collection.ContainsKey("Overwrite") ? collection["Overwrite"] : ""; if (!string.IsNullOrWhiteSpace(overwrite)) { txtOverwrite.Text = overwrite; lblDeprecated.Visible = true; lblDeprOverwrite.Visible = true; txtOverwrite.Visible = true; MessageBox.Show("This is currently using deprecated attribute Overwrite.\nPlease specify Save-option instead."); } }
/// <summary> /// Adds a new TreeNode to the parent object from the XmlNode information /// </summary> /// <param name="parentObject">Object (TreeNode or TreeView) where to add a new TreeNode</param> /// <param name="xmlNode">Xml node from the sitemap</param> /// <param name="form">Current application form</param> /// <param name="isDisabled"> </param> public static void AddTreeViewNode(object parentObject, XmlNode xmlNode, ShuffleBuilder form, bool isDisabled = false) { TreeNode node = new TreeNode(xmlNode.Name); Dictionary <string, string> attributes = new Dictionary <string, string>(); foreach (XmlAttribute attr in xmlNode.Attributes) { attributes.Add(attr.Name, attr.Value); } node.Tag = attributes; SetNodeText(node); node.Name = node.Text.Replace(" ", ""); AddContextMenu(node, form); if (parentObject is TreeView) { ((TreeView)parentObject).Nodes.Add(node); } else if (parentObject is TreeNode) { ((TreeNode)parentObject).Nodes.Add(node); } else { throw new Exception("AddTreeViewNode: Unsupported control type"); } foreach (XmlNode childNode in xmlNode.ChildNodes) { if (childNode.NodeType != XmlNodeType.Comment) { AddTreeViewNode(node, childNode, form); } else { //var commentDoc = new XmlDocument(); //commentDoc.LoadXml(childNode.InnerText); //AddTreeViewNode(node, commentDoc.DocumentElement, form, true); } } }
/// <summary> /// Adds a context menu to a TreeNode control /// </summary> /// <param name="node">TreeNode where to add the context menu</param> /// <param name="tree">Current application form</param> public static void AddContextMenu(TreeNode node, ShuffleBuilder tree) { tree.addMenu.Items.Clear(); tree.gbNodeQuickActions.Controls.Clear(); if (node == null && tree.tvDefinition.Nodes.Count > 0) { node = tree.tvDefinition.Nodes[0]; } if (node != null) { var nodecapabilities = new DefinitionNodeCapabilities(node); foreach (var childcapability in nodecapabilities.ChildTypes) { if (childcapability.Name == "-") { tree.addMenu.Items.Add(new ToolStripSeparator()); AddLinkSeparator(tree); } else if (childcapability.Multiple || !node.Nodes.ContainsKey(childcapability.Name)) { AddMenuFromCapability(tree.addMenu, childcapability.Name); AddLinkFromCapability(tree, childcapability.Name, null, childcapability.Name == "#comment"); } } if (tree.addMenu.Items.Count == 0) { AddLinkFromCapability(tree, "nothing to add", string.Empty); var dummy = tree.addMenu.Items.Add("nothing to add"); dummy.Enabled = false; } tree.deleteToolStripMenuItem.Enabled = nodecapabilities.Delete; tree.commentToolStripMenuItem.Enabled = nodecapabilities.Comment; tree.uncommentToolStripMenuItem.Enabled = nodecapabilities.Uncomment; tree.cutToolStripMenuItem.Enabled = nodecapabilities.CutCopy; tree.copyToolStripMenuItem.Enabled = nodecapabilities.CutCopy; tree.pasteToolStripMenuItem.Enabled = tree.clipboard.IsValidForPaste(node); node.ContextMenuStrip = tree.nodeMenu; } return; }
public ControlBase(string nodename, Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : this() { this.shuffleBuilder = shuffleBuilder; if (collection != null) { attributeCollection = collection; } else { attributeCollection = new Dictionary <string, string>(); } Saved += shuffleBuilder.CtrlSaved; if (string.IsNullOrEmpty(nodename)) { nodename = GetCallingNodeName(); } txtInfo.Text = ShuffleHelper.GetNodeDocumentation(nodename); gbInfo.Visible = !string.IsNullOrEmpty(txtInfo.Text); LayoutControls(); }
public SolutionBlockControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : this() { if (collection != null) { collec = collection; } cmbName.Items.Clear(); if (shuffleBuilder.Solutions != null && shuffleBuilder.Solutions.Count > 0) { //cmbName.Items.AddRange(shuffleBuilder.Solutions.ToArray()); foreach (var solution in shuffleBuilder.Solutions) { cmbName.Items.Add(solution.Property("uniquename", "-")); } cmbName.DropDownStyle = ComboBoxStyle.DropDown; } else { cmbName.DropDownStyle = ComboBoxStyle.Simple; } FillControls(); Saved += shuffleBuilder.CtrlSaved; }
public SolutionBlockExportControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { }
public ExportAttributeControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder, string entity) : base(collection, shuffleBuilder) { this.entity = entity; }
public ShuffleDefinitionControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { }
public FilterControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder, string entity) : base(collection, shuffleBuilder) { this.entity = entity; }
public PreReqSolutionControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { }
public SettingsControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { }
public ImportMatchControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { }
/// <summary> /// Adds a new TreeNode to the parent object from the XmlNode information /// </summary> /// <param name="parentObject">Object (TreeNode or TreeView) where to add a new TreeNode</param> /// <param name="xmlNode">Xml node from the sitemap</param> /// <param name="form">Current application form</param> /// <param name="isDisabled"> </param> public static TreeNode AddTreeViewNode(object parentObject, XmlNode xmlNode, ShuffleBuilder form, int index = -1) { TreeNode node = null; if (xmlNode is XmlElement || xmlNode is XmlComment) { node = new TreeNode(xmlNode.Name) { Name = xmlNode.Name }; var attributes = new Dictionary <string, string>(); if (xmlNode.NodeType == XmlNodeType.Comment) { attributes.Add("#comment", xmlNode.Value); node.ForeColor = System.Drawing.Color.Gray; } else if (xmlNode.Attributes != null) { foreach (XmlAttribute attr in xmlNode.Attributes) { attributes.Add(attr.Name, attr.Value); } } if (parentObject is TreeView) { ((TreeView)parentObject).Nodes.Add(node); } else if (parentObject is TreeNode) { if (index == -1) { ((TreeNode)parentObject).Nodes.Add(node); } else { ((TreeNode)parentObject).Nodes.Insert(index, node); } } else { throw new Exception("AddTreeViewNode: Unsupported control type"); } node.Tag = attributes; AddContextMenu(node, form); foreach (XmlNode childNode in xmlNode.ChildNodes) { AddTreeViewNode(node, childNode, form); } SetNodeText(node); } else if (xmlNode is XmlText && parentObject is TreeNode) { var treeNode = (TreeNode)parentObject; if (treeNode.Tag is Dictionary <string, string> ) { var attributes = (Dictionary <string, string>)treeNode.Tag; attributes.Add("#text", ((XmlText)xmlNode).Value); } } return(node); }
public DataBlockControl(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder, List <EntityMetadata> entities) : base(collection, shuffleBuilder) { this.entities = entities; }
public RelationControl(Dictionary <string, string> collection, TreeNode selectedNode, ShuffleBuilder shuffleBuilder) : this() { if (collection != null) { collec = collection; } FillOptions(selectedNode); FillControls(); Saved += shuffleBuilder.CtrlSaved; }
public RelationControl(Dictionary <string, string> collection, TreeNode selectedNode, ShuffleBuilder shuffleBuilder) : base(collection, shuffleBuilder) { node = selectedNode; }
public ControlBase(Dictionary <string, string> collection, ShuffleBuilder shuffleBuilder) : this(string.Empty, collection, shuffleBuilder) { }
/// <summary> /// Adds a context menu to a TreeNode control /// </summary> /// <param name="node">TreeNode where to add the context menu</param> /// <param name="form">Current application form</param> public static void AddContextMenu(TreeNode node, ShuffleBuilder form) { var collec = (Dictionary <string, string>)node.Tag; HideAllContextMenuItems(form.nodeMenu); form.deleteToolStripMenuItem.Visible = true; var nodetype = node.Text.Split(' ')[0]; var delete = false; var cutcopy = false; switch (nodetype) { case "Blocks": form.addDataBlockToolStripMenuItem.Visible = true; form.addSolutionBlockToolStripMenuItem.Visible = true; break; case "DataBlock": case "SolutionBlock": if (!node.Nodes.ContainsKey("Export")) { form.addExportToolStripMenuItem.Visible = true; } if (!node.Nodes.ContainsKey("Import")) { form.addImportToolStripMenuItem.Visible = true; } if (nodetype == "DataBlock") { form.addRelationToolStripMenuItem.Visible = true; } delete = true; cutcopy = true; break; case "Export": if (node.Parent != null && node.Parent.Text.Split(' ')[0] == "DataBlock") { form.addFilterToolStripMenuItem.Visible = true; form.addSortToolStripMenuItem.Visible = true; } else if (node.Parent != null && node.Parent.Text.Split(' ')[0] == "SolutionBlock" && !node.Nodes.ContainsKey("Settings")) { form.addSettingsToolStripMenuItem.Visible = true; } delete = true; cutcopy = true; break; case "Import": if (node.Parent != null && node.Parent.Text.Split(' ')[0] == "DataBlock" && !node.Nodes.ContainsKey("Match")) { form.addMatchToolStripMenuItem.Visible = true; } else if (node.Parent != null && node.Parent.Text.Split(' ')[0] == "SolutionBlock" && !node.Nodes.ContainsKey("PreRequisites")) { form.addPreRequisitesToolStripMenuItem.Visible = true; } delete = true; cutcopy = true; break; case "Attributes": case "Match": form.addAttributeToolStripMenuItem.Visible = true; delete = nodetype == "Match"; cutcopy = true; break; case "Attribute": delete = node.Parent != null && node.Parent.Nodes.Count > 1; cutcopy = true; break; case "Filter": case "Sort": case "Relation": case "Settings": delete = true; cutcopy = true; break; case "PreRequisites": form.addSolutionToolStripMenuItem.Visible = true; delete = true; cutcopy = true; break; case "Solution": delete = node.Parent != null && node.Parent.Nodes.Count > 1; cutcopy = true; break; } form.deleteToolStripMenuItem.Visible = delete; form.cutToolStripMenuItem.Enabled = cutcopy; form.copyToolStripMenuItem.Enabled = cutcopy; form.pasteToolStripMenuItem.Enabled = form.clipboard.IsValidForPaste(node); node.ContextMenuStrip = form.nodeMenu; }