Skip to content

Commit 5c9d330

Browse files
Merge 514c0d3 into b41dcf5
2 parents b41dcf5 + 514c0d3 commit 5c9d330

19 files changed

Lines changed: 1012 additions & 55 deletions

File tree

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AxClass xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
3+
<Name>ARBAOTBrowserUrlHelper</Name>
4+
<SourceCode>
5+
<Declaration><![CDATA[
6+
/// <summary>
7+
/// Provides helper methods for building and parsing AOT Browser deep link URLs.
8+
/// </summary>
9+
public final class ARBAOTBrowserUrlHelper
10+
{
11+
}
12+
]]></Declaration>
13+
<Methods>
14+
<Method>
15+
<Name>buildUrl</Name>
16+
<Source><![CDATA[
17+
/// <summary>
18+
/// Builds a shareable URL that opens the AOT Browser for the specified object.
19+
/// </summary>
20+
/// <param name="_objectType">The AOT object type.</param>
21+
/// <param name="_objectName">The AOT object name.</param>
22+
/// <param name="_treePath">Optional slash-delimited path to select a specific tree node.</param>
23+
/// <returns>A fully-qualified URL string.</returns>
24+
public static str buildUrl(ARBAOTObjectType _objectType, TreeNodeName _objectName, str _treePath = '')
25+
{
26+
Microsoft.Dynamics.ApplicationPlatform.Environment.IApplicationEnvironment env =
27+
Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
28+
str baseUrl = env.Infrastructure.HostUrl;
29+
30+
// Trim trailing slash
31+
if (strEndsWith(baseUrl, '/'))
32+
{
33+
baseUrl = subStr(baseUrl, 1, strLen(baseUrl) - 1);
34+
}
35+
36+
str url = strFmt('%1/?mi=ARBAOTBrowser&ObjectType=%2&ObjectName=%3',
37+
baseUrl,
38+
enum2Symbol(enumNum(ARBAOTObjectType), _objectType),
39+
System.Uri::EscapeDataString(_objectName));
40+
41+
if (_treePath != '')
42+
{
43+
url += strFmt('&TreePath=%1', System.Uri::EscapeDataString(_treePath));
44+
}
45+
46+
return url;
47+
}
48+
49+
]]></Source>
50+
</Method>
51+
<Method>
52+
<Name>parseObjectType</Name>
53+
<Source><![CDATA[
54+
/// <summary>
55+
/// Converts a string representation of an AOT object type to its enum value.
56+
/// </summary>
57+
/// <param name="_value">The string name of the type (e.g., "Table", "Form", "Class").</param>
58+
/// <returns>The corresponding <c>ARBAOTObjectType</c> enum value, or <c>ARBAOTObjectType::None</c> if not found.</returns>
59+
public static ARBAOTObjectType parseObjectType(str _value)
60+
{
61+
DictEnum dictEnum = new DictEnum(enumNum(ARBAOTObjectType));
62+
int idx = dictEnum.name2Value(_value);
63+
if (idx >= 0)
64+
{
65+
return idx;
66+
}
67+
return ARBAOTObjectType::None;
68+
}
69+
70+
]]></Source>
71+
</Method>
72+
<Method>
73+
<Name>getSelectedTreePath</Name>
74+
<Source><![CDATA[
75+
/// <summary>
76+
/// Builds a slash-delimited tree path from the currently selected tree node up to (but not including) the root.
77+
/// </summary>
78+
/// <param name="_treeControl">The form tree control.</param>
79+
/// <returns>A slash-delimited path string (e.g., "Fields/AccountNum").</returns>
80+
public static str getSelectedTreePath(FormTreeControl _treeControl)
81+
{
82+
TreeItemIdx selectedIdx = _treeControl.getSelection();
83+
if (selectedIdx == 0)
84+
{
85+
return '';
86+
}
87+
88+
TreeItemIdx rootIdx = _treeControl.getRoot();
89+
if (selectedIdx == rootIdx)
90+
{
91+
return '';
92+
}
93+
94+
List pathParts = new List(Types::String);
95+
TreeItemIdx currentIdx = selectedIdx;
96+
97+
while (currentIdx != 0 && currentIdx != rootIdx)
98+
{
99+
FormTreeItem item = _treeControl.getItem(currentIdx);
100+
pathParts.addStart(item.text());
101+
currentIdx = _treeControl.getParent(currentIdx);
102+
}
103+
104+
str path = '';
105+
ListEnumerator enumerator = pathParts.getEnumerator();
106+
while (enumerator.moveNext())
107+
{
108+
if (path != '')
109+
{
110+
path += '/';
111+
}
112+
path += enumerator.current();
113+
}
114+
115+
return path;
116+
}
117+
118+
]]></Source>
119+
</Method>
120+
</Methods>
121+
</SourceCode>
122+
</AxClass>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AxClass xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
3+
<Name>ARBClipboardHelper</Name>
4+
<SourceCode>
5+
<Declaration><![CDATA[
6+
/// <summary>
7+
/// Helper class to copy text to the browser clipboard using an extensible control.
8+
/// </summary>
9+
public class ARBClipboardHelper
10+
{
11+
}
12+
]]></Declaration>
13+
<Methods>
14+
<Method>
15+
<Name>copyToClipboard</Name>
16+
<Source><![CDATA[
17+
/// <summary>
18+
/// Copies text to the browser clipboard via a transient dialog with an extensible control.
19+
/// </summary>
20+
/// <param name = "_text">The text to copy to the clipboard</param>
21+
public static void copyToClipboard(str _text)
22+
{
23+
if (!_text)
24+
{
25+
return;
26+
}
27+
28+
Args args = new Args();
29+
args.name(formStr(ARBClipboardHelper));
30+
args.parm(_text);
31+
32+
FormRun formRun = classFactory.formRunClass(args);
33+
formRun.init();
34+
formRun.run();
35+
formRun.wait();
36+
}
37+
38+
]]></Source>
39+
</Method>
40+
</Methods>
41+
</SourceCode>
42+
</AxClass>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AxClass xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
3+
<Name>ARBClipboardHelperBuild</Name>
4+
<SourceCode>
5+
<Declaration><![CDATA[
6+
/// <summary>
7+
/// Build class for the clipboard helper extensible control.
8+
/// </summary>
9+
[FormDesignControl('ARBClipboardHelper')]
10+
public class ARBClipboardHelperBuild extends FormBuildContainerControl
11+
{
12+
private str copyText;
13+
}
14+
]]></Declaration>
15+
<Methods>
16+
<Method>
17+
<Name>parmCopyText</Name>
18+
<Source><![CDATA[
19+
[FormDesignProperty("Copy text")]
20+
public str parmCopyText(str _copyText = copyText)
21+
{
22+
copyText = _copyText;
23+
return copyText;
24+
}
25+
26+
]]></Source>
27+
</Method>
28+
</Methods>
29+
</SourceCode>
30+
</AxClass>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AxClass xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
3+
<Name>ARBClipboardHelperControl</Name>
4+
<SourceCode>
5+
<Declaration><![CDATA[
6+
/// <summary>
7+
/// Runtime control for the clipboard helper extensible control.
8+
/// </summary>
9+
[FormControlAttribute('ARBClipboardHelper', '/resources/html/ARBClipboardHelper', classStr(ARBClipboardHelperBuild))]
10+
class ARBClipboardHelperControl extends FormTemplateContainerControl
11+
{
12+
private FormProperty copyText;
13+
}
14+
]]></Declaration>
15+
<Methods>
16+
<Method>
17+
<Name>new</Name>
18+
<Source><![CDATA[
19+
protected void new(FormBuildControl _build, FormRun _formRun)
20+
{
21+
super(_build, _formRun);
22+
this.setTemplateId('ARBClipboardHelper');
23+
this.setResourceBundleName('/resources/html/ARBClipboardHelper');
24+
copyText = this.addProperty(methodStr(ARBClipboardHelperControl, setCopyText), Types::String);
25+
}
26+
27+
]]></Source>
28+
</Method>
29+
<Method>
30+
<Name>applyBuild</Name>
31+
<Source><![CDATA[
32+
public void applyBuild()
33+
{
34+
super();
35+
ARBClipboardHelperBuild build = this.build();
36+
if (build)
37+
{
38+
this.setCopyTextProperty(build.parmCopyText());
39+
}
40+
}
41+
42+
]]></Source>
43+
</Method>
44+
<Method>
45+
<Name>setCopyTextProperty</Name>
46+
<Source><![CDATA[
47+
[FormPropertyAttribute(FormPropertyKind::Value, "SetCopyText")]
48+
private str setCopyTextProperty(str _value = copyText.parmValue())
49+
{
50+
if (!prmIsDefault(_value))
51+
{
52+
copyText.setValueOrBinding(_value);
53+
}
54+
return copyText.parmValue();
55+
}
56+
57+
]]></Source>
58+
</Method>
59+
<Method>
60+
<Name>setCopyText</Name>
61+
<Source><![CDATA[
62+
public void setCopyText(str _text)
63+
{
64+
this.setCopyTextProperty(_text);
65+
}
66+
67+
]]></Source>
68+
</Method>
69+
</Methods>
70+
</SourceCode>
71+
</AxClass>

0 commit comments

Comments
 (0)