Skip to content

Commit

Permalink
Merge pull request #766 from rappen/view-layout
Browse files Browse the repository at this point in the history
View layout feature
  • Loading branch information
rappen authored Aug 16, 2022
2 parents 7b9b6ef + 6fc3b14 commit b4df123
Show file tree
Hide file tree
Showing 27 changed files with 1,217 additions and 444 deletions.
2 changes: 1 addition & 1 deletion FXBEditorUtils/Prompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static string ShowDialog(string text, string caption, string startvalue =
Label textLabel = new Label() { Left = 50, Top = 20, Width = 430, Text = text };
TextBox textBox = new TextBox() { Left = 50, Top = 45, Width = 400, Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right, Text = startvalue };
Button cancellation = new Button() { Text = "Cancel", Left = 220, Width = 100, Top = 80, DialogResult = DialogResult.Cancel };
Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 80, DialogResult = DialogResult.OK };
Button confirmation = new Button() { Text = "OK", Left = 350, Width = 100, Top = 80, DialogResult = DialogResult.OK };
//confirmation.Click += (sender, e) => { prompt.Close(); };
prompt.Controls.Add(textBox);
prompt.Controls.Add(cancellation);
Expand Down
43 changes: 43 additions & 0 deletions FetchXmlBuilder/Builder/TreeNodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ internal static string Value(this TreeNode node, string key)
return string.Empty;
}

internal static void SetValue(this TreeNode node, string key, object value)
{
if (node == null)
{
return;
}
if (node.Tag == null)
{
node.Tag = new Dictionary<string, string>();
}
if (node.Tag is Dictionary<string, string> tag)
{
tag[key] = value.ToString();
}
}

internal static bool IsFetchAggregate(this TreeNode node)
{
var aggregate = false;
Expand Down Expand Up @@ -71,6 +87,33 @@ internal static bool IsFetchDistinct(this TreeNode node)
return distinct;
}

internal static bool IsAttributeValidForView(this TreeNode node)
{
var entity = node.Parent;
return node.Name == "attribute" && (entity?.Name == "entity" || (entity?.Name == "link-entity" && !string.IsNullOrWhiteSpace(entity.Value("alias"))));
}

internal static string GetAttributeLayoutName(this TreeNode node)
{
var entity = node.LocalEntityNode();
var entityalias = entity.Name == "link-entity" ? entity.Value("alias") : string.Empty;
var attribute = node.Value("name");
var alias = node.Value("alias");
if (!string.IsNullOrWhiteSpace(alias))
{
attribute = alias;
}
else if (!string.IsNullOrWhiteSpace(entityalias))
{
attribute = entityalias + "." + attribute;
}
if (!string.IsNullOrWhiteSpace(attribute))
{
return attribute;
}
return null;
}

internal static string GetTooltip(this TreeNode node)
{
if (node == null)
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Controls/FetchXmlElementControlBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void InitializeFXB(Dictionary<string, string> collection, FetchXmlBuilder

protected FetchXmlBuilder fxb { get; set; }

protected TreeNode Node { get; set; }
internal TreeNode Node { get; set; }

protected TreeBuilderControl Tree { get; set; }

Expand Down
156 changes: 130 additions & 26 deletions FetchXmlBuilder/Controls/attributeControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4df123

Please sign in to comment.