Skip to content

Commit 06550fa

Browse files
caleblanchardCaleb Blanchard
andauthored
Add label fields to menu item cross reference table/form (#32)
Co-authored-by: Caleb Blanchard <caleb.blanchard@arbelatech.com>
1 parent 6d3f7c6 commit 06550fa

4 files changed

Lines changed: 88 additions & 0 deletions

File tree

Metadata/AOTBrowser/AOTBrowser/AxClass/ARBMenuItemRefPopulateService.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
1717
ARBMenuItemReferences menuItemRefs;
1818
RecordInsertList menuItemRefsInsertList = new RecordInsertList(tableNum(ARBMenuItemReferences));
1919
str currentObjectName;
20+
str currentObjectLabel;
2021
ARBAOTObjectType currentObjectType;
2122
2223
}
@@ -78,6 +79,24 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
7879
menuItemRefsInsertList.insertDatabase();
7980
}
8081
82+
]]></Source>
83+
</Method>
84+
<Method>
85+
<Name>getLabelForObject</Name>
86+
<Source><![CDATA[
87+
protected str getLabelForObject(anytype _object)
88+
{
89+
System.Type objectType = _object.GetType();
90+
PropertyInfo labelProp = objectType.GetProperty('Label');
91+
92+
if (labelProp)
93+
{
94+
return SysLabel::labelId2String(labelProp.GetValue(_object).ToString());
95+
}
96+
97+
return '';
98+
}
99+
81100
]]></Source>
82101
</Method>
83102
<Method>
@@ -91,6 +110,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
91110
{
92111
AxWorkflowTemplate workflowType = Xpp.MetadataSupport::GetWorkflowTemplate(workflowTypesEnum.Current);
93112
currentObjectName = workflowType.Name;
113+
currentObjectLabel = this.getLabelForObject(workflowType);
94114
95115
this.processWorkflowType(workflowType, '');
96116
}
@@ -147,6 +167,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
147167
{
148168
AxKPI kpi = Xpp.MetadataSupport::GetKPI(kpisEnum.Current);
149169
currentObjectName = kpi.Name;
170+
currentObjectLabel = this.getLabelForObject(kpi);
150171
151172
this.processKPI(kpi, '');
152173
}
@@ -188,6 +209,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
188209
{
189210
AxMap map = Xpp.MetadataSupport::GetMap(mapsEnum.Current);
190211
currentObjectName = map.Name;
212+
currentObjectLabel = this.getLabelForObject(map);
191213
192214
this.processMap(map, '');
193215
}
@@ -219,6 +241,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
219241
{
220242
AxCompositeDataEntityView compositeDataEntity = ArbelaXpp.MetadataSupport::GetCompositeDataEntity(compositeEntitiesEnum.Current);
221243
currentObjectName = compositeDataEntity.Name;
244+
currentObjectLabel = this.getLabelForObject(compositeDataEntity);
222245
223246
this.processCompositeDataEntity(compositeDataEntity, '');
224247
}
@@ -250,6 +273,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
250273
{
251274
AxView view = Xpp.MetadataSupport::GetView(viewsEnum.Current);
252275
currentObjectName = view.Name;
276+
currentObjectLabel = this.getLabelForObject(view);
253277
254278
this.processView(view, '');
255279
}
@@ -281,6 +305,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
281305
{
282306
AxDataEntityView dataEntity = Xpp.MetadataSupport::GetDataEntityView(dataEntitiesEnum.Current);
283307
currentObjectName = dataEntity.Name;
308+
currentObjectLabel = this.getLabelForObject(dataEntity);
284309
285310
this.processDataEntityView(dataEntity, '');
286311
}
@@ -312,6 +337,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
312337
{
313338
AxTable table = Xpp.MetadataSupport::GetTable(tablesEnum.Current);
314339
currentObjectName = table.Name;
340+
currentObjectLabel = this.getLabelForObject(table);
315341
316342
this.processTable(table, '');
317343
}
@@ -358,6 +384,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
358384
{
359385
AxWorkflowTask workflowTask = Xpp.MetadataSupport::GetWorkflowTask(workflowTasksEnum.Current);
360386
currentObjectName = workflowTask.Name;
387+
currentObjectLabel = this.getLabelForObject(workflowTask);
361388
362389
this.processWorkflowTask(workflowTask, '');
363390
}
@@ -410,6 +437,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
410437
{
411438
AxSecurityPrivilege securityPrivilege = ArbelaXpp.MetadataSupport::GetSecurityPrivilege(securityPrivilegesEnum.Current);
412439
currentObjectName = securityPrivilege.Name;
440+
currentObjectLabel = this.getLabelForObject(securityPrivilege);
413441
414442
this.processSecurityPrivilege(securityPrivilege, '');
415443
}
@@ -461,6 +489,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
461489
{
462490
AxWorkflowApproval workflowApproval = Xpp.MetadataSupport::GetWorkflowApproval(workflowApprovalsEnum.Current);
463491
currentObjectName = workflowApproval.Name;
492+
currentObjectLabel = this.getLabelForObject(workflowApproval);
464493
465494
this.processWorkflowApproval(workflowApproval, '');
466495
}
@@ -520,7 +549,25 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
520549
ARBMenuItemReferences menuItemReference;
521550
menuItemReference.MenuItemName = _menuItemName;
522551
menuItemReference.MenuItemType = _menuItemType;
552+
AxMenuItem menuItem;
553+
switch (_menuItemType)
554+
{
555+
case MenuItemType::Action:
556+
menuItem = Xpp.MetadataSupport::GetMenuItemAction(_menuItemName);
557+
break;
558+
case MenuItemType::Display:
559+
menuItem = Xpp.MetadataSupport::GetMenuItemDisplay(_menuItemName);
560+
break;
561+
case MenuItemType::Output:
562+
menuItem = Xpp.MetadataSupport::GetMenuItemOutput(_menuItemName);
563+
break;
564+
}
565+
if (!CLRInterop::isNull(menuItem))
566+
{
567+
menuItemReference.MenuItemLabel = SysLabel::labelId2String(menuItem.Label);
568+
}
523569
menuItemReference.RefObjectName = currentObjectName;
570+
menuItemReference.RefObjectLabel = currentObjectLabel;
524571
menuItemReference.RefObjectType = currentObjectType;
525572
menuItemReference.RefPath = _path;
526573
menuItemRefsInsertList.add(menuItemReference);
@@ -539,6 +586,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
539586
{
540587
AxTile tile = Xpp.MetadataSupport::GetTile(tileNamesEnum.Current);
541588
currentObjectName = tile.Name;
589+
currentObjectLabel = this.getLabelForObject(tile);
542590
543591
this.processTile(tile, '');
544592
}
@@ -570,6 +618,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
570618
{
571619
AxMenu menu = Xpp.MetadataSupport::GetMenu(menuNamesEnum.Current);
572620
currentObjectName = menu.Name;
621+
currentObjectLabel = this.getLabelForObject(menu);
573622
574623
var menuElementsEnum = menu.Elements.GetEnumerator();
575624
while (menuElementsEnum.MoveNext())
@@ -635,6 +684,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
635684
//AxForm form = Xpp.MetadataSupport::GetForm(formNamesEnum.Current);
636685
AxForm form = metadataProvider.Forms.Read(formNamesEnum.Current);
637686
currentObjectName = form.Name;
687+
currentObjectLabel = this.getLabelForObject(form);
638688
639689
var formControls = form.Design.Controls;
640690
var controlsEnum = formControls.GetEnumerator();

Metadata/AOTBrowser/AOTBrowser/AxForm/ARBMenuItemReferences.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public class ARBMenuItemReferences extends FormRun
6868
<Name>ARBMenuItemReferences</Name>
6969
<Table>ARBMenuItemReferences</Table>
7070
<Fields>
71+
<AxFormDataSourceField>
72+
<DataField>MenuItemLabel</DataField>
73+
</AxFormDataSourceField>
7174
<AxFormDataSourceField>
7275
<DataField>MenuItemName</DataField>
7376
</AxFormDataSourceField>
@@ -80,6 +83,9 @@ public class ARBMenuItemReferences extends FormRun
8083
<AxFormDataSourceField>
8184
<DataField>RecId</DataField>
8285
</AxFormDataSourceField>
86+
<AxFormDataSourceField>
87+
<DataField>RefObjectLabel</DataField>
88+
</AxFormDataSourceField>
8389
<AxFormDataSourceField>
8490
<DataField>RefObjectName</DataField>
8591
</AxFormDataSourceField>
@@ -201,6 +207,15 @@ public class ARBMenuItemReferences extends FormRun
201207
<DataField>MenuItemName</DataField>
202208
<DataSource>ARBMenuItemReferences</DataSource>
203209
</AxFormControl>
210+
<AxFormControl xmlns=""
211+
i:type="AxFormStringControl">
212+
<Name>ARBMenuItemReferences_MenuItemLabel</Name>
213+
<Type>String</Type>
214+
<FormControlExtension
215+
i:nil="true" />
216+
<DataField>MenuItemLabel</DataField>
217+
<DataSource>ARBMenuItemReferences</DataSource>
218+
</AxFormControl>
204219
<AxFormControl xmlns=""
205220
i:type="AxFormComboBoxControl">
206221
<Name>ARBMenuItemReferences_MenuItemType</Name>
@@ -220,6 +235,15 @@ public class ARBMenuItemReferences extends FormRun
220235
<DataField>RefObjectName</DataField>
221236
<DataSource>ARBMenuItemReferences</DataSource>
222237
</AxFormControl>
238+
<AxFormControl xmlns=""
239+
i:type="AxFormStringControl">
240+
<Name>ARBMenuItemReferences_RefObjectLabel</Name>
241+
<Type>String</Type>
242+
<FormControlExtension
243+
i:nil="true" />
244+
<DataField>RefObjectLabel</DataField>
245+
<DataSource>ARBMenuItemReferences</DataSource>
246+
</AxFormControl>
223247
<AxFormControl xmlns=""
224248
i:type="AxFormComboBoxControl">
225249
<Name>ARBMenuItemReferences_RefObjectType</Name>

Metadata/AOTBrowser/AOTBrowser/AxLabelFile/LabelResources/en-US/AOTBrowser.en-US.label.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ MenuItemAction=Action menu item
3838
;ARB_AOTBrowser
3939
MenuItemDisplay=Display menu item
4040
;ARB_AOTBrowser
41+
MenuItemLabel=Menu item label
4142
MenuItemOutput=Output menu item
4243
;ARB_AOTBrowser
4344
MenuItemReferences=Menu item references
@@ -69,6 +70,7 @@ Reference=Reference
6970
ReferenceObjectName=Reference object name
7071
ReferenceObjectType=Reference object type
7172
ReferencePath=Reference path
73+
RefObjectLabel=Reference object label
7274
Report=Report
7375
;ARB_AOTBrowser
7476
Resource=Resource

Metadata/AOTBrowser/AOTBrowser/AxTable/ARBMenuItemReferences.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ public class ARBMenuItemReferences extends common
7474
<Name>RefPath</Name>
7575
<ExtendedDataType>ARBMenuItemReferencePath</ExtendedDataType>
7676
</AxTableField>
77+
<AxTableField xmlns=""
78+
i:type="AxTableFieldString">
79+
<Name>RefObjectLabel</Name>
80+
<ExtendedDataType>Description</ExtendedDataType>
81+
<Label>@AOTBrowser:RefObjectLabel</Label>
82+
</AxTableField>
83+
<AxTableField xmlns=""
84+
i:type="AxTableFieldString">
85+
<Name>MenuItemLabel</Name>
86+
<ExtendedDataType>Description</ExtendedDataType>
87+
<Label>@AOTBrowser:MenuItemLabel</Label>
88+
</AxTableField>
7789
</Fields>
7890
<FullTextIndexes />
7991
<Indexes>

0 commit comments

Comments
 (0)