@doc>
A general tree provider class for the dynamic expression editor
creates the tree by using different providers, which are determined by rule:
general DE functions provider
general recently used functions provider
general data of current infoshapes (for gml) provider
general data of current infoshapes (for gml2) provider
any custom provider (rule extensions)
(c) SAP AG 2003-2006. All rights reserved.
#INCLUDE[lib:defs.inc]
#INCLUDE[gml:defs.inc]
class DETreeProvider inherit gml:Object;
<@doc>list of providers for the tree, each provides some levels in the tree
readonly property treeProvidersList = [];
<@doc>get list of providers for the tree
constructor ()
var i, len, providers=[];
//get list of providers
RULE('defineDETreeProviders', $ENV.contextUnit, providers);
//for empty priority give large no. (to be last)
len = providers.length;
for(i=0; i
Gets the root tree node
The root node
method getRoot()
return this.getNode('$');
end
<@doc>
Gets a specified tree node
The Id of the tree node to get
The requested tree node
method getNode(id)
if (id == '$') {
return {id:'$', name:'#TEXT[XTND_FUNCTIONS]', size:1, icon:'#URL[~skin:icons.dynexp.expr.gif]'};
} else {
return null;
}
end
<@doc>
create the sub tree under the selected level in tree
id of parent level
list of the sub tree items
method getChildNodes(id)
var i=0, len=0, index=0, tmpList, listLen=0, item;
var list = [];
var providers = this.treeProvidersList;
if(providers.length == 0)
return null;
//first levels
if(id == '$') //root
{
id = null;
i = 0;
len = providers.length;
}
//sub tree
else
{
//get the right provider (the name prefix is the list index)
/*var index = SPLIT(id, ".");
if(index.length < 2) //'.' not found or there's no prefix or sufix
return null;
i = parseInt(index[0]);
id = index[1];
len = i+1;
*/
var position = id.indexOf(".");
if(position < 1) //must have some prefix before '.'
return null;
i = parseInt(id.substr(0, position)); //already know i.length>0
id = id.substr(position+1);
len = i+1;
//if index = number
}
//concat the items recieved by each provider, when open sub tree there's only 1 povider (the chosen node provider)
for( ;i
Sets the var to hold the DEInfoshapeProvider from the DE treeProvidersList
name of the provider
The provider params - the object and its number in the treeProvidersList
method getProviderByName(name) {
var provider;
var providerNumber;
for (var prov in this.treeProvidersList) {
if (this.treeProvidersList[prov].Class.name == name) {
provider = this.treeProvidersList[prov];
providerNumber = prov;
break;
}
}
var provParams = {provider:provider, providerNumber:providerNumber};
return provParams;
}