Skip to content

Commit

Permalink
Add label fields to menu item cross reference table/form (#32)
Browse files Browse the repository at this point in the history
Co-authored-by: Caleb Blanchard <[email protected]>
  • Loading branch information
caleblanchard and Caleb Blanchard authored Feb 1, 2024
1 parent 6d3f7c6 commit 06550fa
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
ARBMenuItemReferences menuItemRefs;
RecordInsertList menuItemRefsInsertList = new RecordInsertList(tableNum(ARBMenuItemReferences));
str currentObjectName;
str currentObjectLabel;
ARBAOTObjectType currentObjectType;
}
Expand Down Expand Up @@ -78,6 +79,24 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
menuItemRefsInsertList.insertDatabase();
}
]]></Source>
</Method>
<Method>
<Name>getLabelForObject</Name>
<Source><![CDATA[
protected str getLabelForObject(anytype _object)
{
System.Type objectType = _object.GetType();
PropertyInfo labelProp = objectType.GetProperty('Label');
if (labelProp)
{
return SysLabel::labelId2String(labelProp.GetValue(_object).ToString());
}
return '';
}
]]></Source>
</Method>
<Method>
Expand All @@ -91,6 +110,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxWorkflowTemplate workflowType = Xpp.MetadataSupport::GetWorkflowTemplate(workflowTypesEnum.Current);
currentObjectName = workflowType.Name;
currentObjectLabel = this.getLabelForObject(workflowType);
this.processWorkflowType(workflowType, '');
}
Expand Down Expand Up @@ -147,6 +167,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxKPI kpi = Xpp.MetadataSupport::GetKPI(kpisEnum.Current);
currentObjectName = kpi.Name;
currentObjectLabel = this.getLabelForObject(kpi);
this.processKPI(kpi, '');
}
Expand Down Expand Up @@ -188,6 +209,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxMap map = Xpp.MetadataSupport::GetMap(mapsEnum.Current);
currentObjectName = map.Name;
currentObjectLabel = this.getLabelForObject(map);
this.processMap(map, '');
}
Expand Down Expand Up @@ -219,6 +241,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxCompositeDataEntityView compositeDataEntity = ArbelaXpp.MetadataSupport::GetCompositeDataEntity(compositeEntitiesEnum.Current);
currentObjectName = compositeDataEntity.Name;
currentObjectLabel = this.getLabelForObject(compositeDataEntity);
this.processCompositeDataEntity(compositeDataEntity, '');
}
Expand Down Expand Up @@ -250,6 +273,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxView view = Xpp.MetadataSupport::GetView(viewsEnum.Current);
currentObjectName = view.Name;
currentObjectLabel = this.getLabelForObject(view);
this.processView(view, '');
}
Expand Down Expand Up @@ -281,6 +305,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxDataEntityView dataEntity = Xpp.MetadataSupport::GetDataEntityView(dataEntitiesEnum.Current);
currentObjectName = dataEntity.Name;
currentObjectLabel = this.getLabelForObject(dataEntity);
this.processDataEntityView(dataEntity, '');
}
Expand Down Expand Up @@ -312,6 +337,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxTable table = Xpp.MetadataSupport::GetTable(tablesEnum.Current);
currentObjectName = table.Name;
currentObjectLabel = this.getLabelForObject(table);
this.processTable(table, '');
}
Expand Down Expand Up @@ -358,6 +384,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxWorkflowTask workflowTask = Xpp.MetadataSupport::GetWorkflowTask(workflowTasksEnum.Current);
currentObjectName = workflowTask.Name;
currentObjectLabel = this.getLabelForObject(workflowTask);
this.processWorkflowTask(workflowTask, '');
}
Expand Down Expand Up @@ -410,6 +437,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxSecurityPrivilege securityPrivilege = ArbelaXpp.MetadataSupport::GetSecurityPrivilege(securityPrivilegesEnum.Current);
currentObjectName = securityPrivilege.Name;
currentObjectLabel = this.getLabelForObject(securityPrivilege);
this.processSecurityPrivilege(securityPrivilege, '');
}
Expand Down Expand Up @@ -461,6 +489,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxWorkflowApproval workflowApproval = Xpp.MetadataSupport::GetWorkflowApproval(workflowApprovalsEnum.Current);
currentObjectName = workflowApproval.Name;
currentObjectLabel = this.getLabelForObject(workflowApproval);
this.processWorkflowApproval(workflowApproval, '');
}
Expand Down Expand Up @@ -520,7 +549,25 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
ARBMenuItemReferences menuItemReference;
menuItemReference.MenuItemName = _menuItemName;
menuItemReference.MenuItemType = _menuItemType;
AxMenuItem menuItem;
switch (_menuItemType)
{
case MenuItemType::Action:
menuItem = Xpp.MetadataSupport::GetMenuItemAction(_menuItemName);
break;
case MenuItemType::Display:
menuItem = Xpp.MetadataSupport::GetMenuItemDisplay(_menuItemName);
break;
case MenuItemType::Output:
menuItem = Xpp.MetadataSupport::GetMenuItemOutput(_menuItemName);
break;
}
if (!CLRInterop::isNull(menuItem))
{
menuItemReference.MenuItemLabel = SysLabel::labelId2String(menuItem.Label);
}
menuItemReference.RefObjectName = currentObjectName;
menuItemReference.RefObjectLabel = currentObjectLabel;
menuItemReference.RefObjectType = currentObjectType;
menuItemReference.RefPath = _path;
menuItemRefsInsertList.add(menuItemReference);
Expand All @@ -539,6 +586,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxTile tile = Xpp.MetadataSupport::GetTile(tileNamesEnum.Current);
currentObjectName = tile.Name;
currentObjectLabel = this.getLabelForObject(tile);
this.processTile(tile, '');
}
Expand Down Expand Up @@ -570,6 +618,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
{
AxMenu menu = Xpp.MetadataSupport::GetMenu(menuNamesEnum.Current);
currentObjectName = menu.Name;
currentObjectLabel = this.getLabelForObject(menu);
var menuElementsEnum = menu.Elements.GetEnumerator();
while (menuElementsEnum.MoveNext())
Expand Down Expand Up @@ -635,6 +684,7 @@ class ARBMenuItemRefPopulateService extends SysOperationServiceBase
//AxForm form = Xpp.MetadataSupport::GetForm(formNamesEnum.Current);
AxForm form = metadataProvider.Forms.Read(formNamesEnum.Current);
currentObjectName = form.Name;
currentObjectLabel = this.getLabelForObject(form);
var formControls = form.Design.Controls;
var controlsEnum = formControls.GetEnumerator();
Expand Down
24 changes: 24 additions & 0 deletions Metadata/AOTBrowser/AOTBrowser/AxForm/ARBMenuItemReferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class ARBMenuItemReferences extends FormRun
<Name>ARBMenuItemReferences</Name>
<Table>ARBMenuItemReferences</Table>
<Fields>
<AxFormDataSourceField>
<DataField>MenuItemLabel</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>MenuItemName</DataField>
</AxFormDataSourceField>
Expand All @@ -80,6 +83,9 @@ public class ARBMenuItemReferences extends FormRun
<AxFormDataSourceField>
<DataField>RecId</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>RefObjectLabel</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>RefObjectName</DataField>
</AxFormDataSourceField>
Expand Down Expand Up @@ -201,6 +207,15 @@ public class ARBMenuItemReferences extends FormRun
<DataField>MenuItemName</DataField>
<DataSource>ARBMenuItemReferences</DataSource>
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormStringControl">
<Name>ARBMenuItemReferences_MenuItemLabel</Name>
<Type>String</Type>
<FormControlExtension
i:nil="true" />
<DataField>MenuItemLabel</DataField>
<DataSource>ARBMenuItemReferences</DataSource>
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormComboBoxControl">
<Name>ARBMenuItemReferences_MenuItemType</Name>
Expand All @@ -220,6 +235,15 @@ public class ARBMenuItemReferences extends FormRun
<DataField>RefObjectName</DataField>
<DataSource>ARBMenuItemReferences</DataSource>
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormStringControl">
<Name>ARBMenuItemReferences_RefObjectLabel</Name>
<Type>String</Type>
<FormControlExtension
i:nil="true" />
<DataField>RefObjectLabel</DataField>
<DataSource>ARBMenuItemReferences</DataSource>
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormComboBoxControl">
<Name>ARBMenuItemReferences_RefObjectType</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ MenuItemAction=Action menu item
;ARB_AOTBrowser
MenuItemDisplay=Display menu item
;ARB_AOTBrowser
MenuItemLabel=Menu item label
MenuItemOutput=Output menu item
;ARB_AOTBrowser
MenuItemReferences=Menu item references
Expand Down Expand Up @@ -69,6 +70,7 @@ Reference=Reference
ReferenceObjectName=Reference object name
ReferenceObjectType=Reference object type
ReferencePath=Reference path
RefObjectLabel=Reference object label
Report=Report
;ARB_AOTBrowser
Resource=Resource
Expand Down
12 changes: 12 additions & 0 deletions Metadata/AOTBrowser/AOTBrowser/AxTable/ARBMenuItemReferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ public class ARBMenuItemReferences extends common
<Name>RefPath</Name>
<ExtendedDataType>ARBMenuItemReferencePath</ExtendedDataType>
</AxTableField>
<AxTableField xmlns=""
i:type="AxTableFieldString">
<Name>RefObjectLabel</Name>
<ExtendedDataType>Description</ExtendedDataType>
<Label>@AOTBrowser:RefObjectLabel</Label>
</AxTableField>
<AxTableField xmlns=""
i:type="AxTableFieldString">
<Name>MenuItemLabel</Name>
<ExtendedDataType>Description</ExtendedDataType>
<Label>@AOTBrowser:MenuItemLabel</Label>
</AxTableField>
</Fields>
<FullTextIndexes />
<Indexes>
Expand Down

0 comments on commit 06550fa

Please sign in to comment.