Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XPages extlib oneui layout - How to add placebar actions dynamically

I want to add actions dynamically in PlaceBar (extlib oneui application layout).

We have couple of urls stored in some configuration documents. Based on these URLs I want to create Container node having Basic Child nodes in it. Every child node use one URL from list. How I can create container node and add child nodes to it dynamically? any sample SSJS/Java/CSJS code for this?

Thank you..

like image 983
Prashant Arkal Avatar asked Aug 13 '12 17:08

Prashant Arkal


2 Answers

Have a look at the Repeat Node (xe:repeatTreeNode) which is described in the XPages Extension Library book on page 245.

Here's a very simple example (taken directly from the book):

<xe:repeatTreeNode var="val">
   <xe:this.value>
      <![CDATA[#{javascript:return [
        ["Home","home"],
        ["Domino","domino"],
        ["OneUI","oneui"]
      ];}]]>
   </xe:this.value>
   <xe:this.children>
      <xe:basicLeafNode>
         <xe:this.submitValue><![CDATA[#{javascript:return val[1]}]]></xe:this.submitValue>
         <xe:this.label><![CDATA[#{javascript:return val[0]}]]></xe:this.label>
      </xe:basicLeafNode>
   </xe:this.children>
</xe:repeatTreeNode>
like image 63
Per Henrik Lausten Avatar answered Nov 18 '22 06:11

Per Henrik Lausten


Thank you for the quick reply. This is very useful information for me.

Another way I found out based on XSnippet code and some reverse engg. from java code in xpage as follow :

var oneui = getComponent("applicationLayout1");
var uiConfig = oneui.getConfiguration();
var containerNode:com.ibm.xsp.extlib.tree.complex.ComplexContainerTreeNode = new com.ibm.xsp.extlib.tree.complex.ComplexContainerTreeNode();
containerNode.setLabel("Cluster Applications");

var docAppProfile = docColl.getFirstDocument();
while(docAppProfile != null)
{
    var children:com.ibm.xsp.extlib.tree.complex.ComplexLeafTreeNode = new com.ibm.xsp.extlib.tree.complex.ComplexLeafTreeNode();
    children.setComponent(oneui);
    children.setLabel(docAppProfile.getItemValueString("appTitle"));
    children.setHref(docAppProfile.getItemValueString("appURL"));
    children.setImage(docAppProfile.getItemValueString("appLogoThumb"));
    containerNode.addChild(children);

    children = null;
    var tempDoc = docColl.getNextDocument(docAppProfile);
    docAppProfile = null;
    docAppProfile = tempDoc;
}
uiConfig.addPlaceBarAction(containerNode);

This is sample code only. Converted this is into java code and serialized to improve performance and load it only once in application.

Thank you again for help.

like image 37
Prashant Arkal Avatar answered Nov 18 '22 06:11

Prashant Arkal