1. Create new class.
// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
public class ImageListAppl_Unit extends ImageListAppl
{
void build()
{
super();
this.add(#ImageItem);
this.add(#ImageBOM);
}
}
{
FormTreeItem formTreeStructure;
imageListAppl = new ImageListAppl_Unit();
structure.setImagelist(imageListAppl.imageList());
select assetTable where assetTable.ProjId == UnitTable.ProjId;
assetIdTop = assetTable.topMainAsset();
// This is not a threat because it is only adding additional asset numbers to the tree.
// BP Deviation Documented
formTreeStructure = new FormTreeItem(assetIdTop, imageListAppl.image(AssetTable::treeImage(assetIdTop)),-1,assetIdTop);
structure.delete(structure.getRoot());
this.buildComposedOf(assetIdTop,structure.addItem(0,FormTreeAdd::Sort,formTreeStructure));
buildStructure = false;
}
void buildComposedOf(AssetId _assetId,
int _treeHeader,
NoYes _list = NoYes::No)
{
FormTreeItem formTreeItem;
container childList;
AssetId childAssetId;
Counter childListLength;
Counter childIdx;
int node;
imageListAppl = new ImageListAppl_Unit();
structure.setImagelist(imageListAppl.imageList());
if (!_assetId)
{
return;
}
childList = AssetTable::childList(_assetId);
childListLength = conLen(childList);
for (childIdx = 1; childIdx <= childListLength; childIdx++)
{
childAssetId = conPeek(childList,childIdx);
//BP Deviation Documented
formTreeItem = new FormTreeItem(childAssetId,imageListAppl.image(AssetTable::treeImage(childAssetId)),-1,childAssetId);
node = structure.addItem(_treeHeader,FormTreeAdd::Sort,formTreeItem);
this.buildComposedOf(childAssetId,node,_list || (_assetId == childAssetId));
if (childAssetId == assetTable.AssetId) // current item
{
structure.select(node);
}
}
structure.expand(_treeHeader,FormTreeExpand::Expand);
}
void setImageList()
{
imageListAppl = new ImageListAppl_Unit();
structure.setImagelist(imageListAppl.imageList());
}
Output on form: