XPages extlib oneui layout - How to add notes style actions dynamically

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

We have several URLs stored in some configuration documents. Based on these URLs, I want to create a Container node with basic child nodes. Each child node uses one URL from the list. How can I create a container node and add child nodes to it dynamically? any sample SSJS / Java / CSJS code for this?

Thank..

+5
source share
4 answers

Thanks for the quick response. This is very useful information for me.

In another way, I found out based on the XSnippet code and some reverse engg. from java code to xpage as below:

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);

. Java .

.

+1

Node (xe:repeatTreeNode), XPages . 245.

( ):

<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>
+4

, , Java. faces-config.xml

<lifecycle>
    <phase-listener>com.company.app.phaselisteners.PlaceBarInjector</phase-listener>
</lifecycle>

package com.company.app.phaselisteners;





public class PlaceBarInjector implements PhaseListener {

      private static final long serialVersionUID = 1L;

      public PhaseId getPhaseId() {
        return PhaseId.RENDER_RESPONSE;
    }

    public void beforePhase(PhaseEvent event) {
        UIComponent oneui = JSFUtil.findComponent("applicationLayout1");
    Configruation uiconfig = oneui.getConfiguration();
    ComplexContainerTreeNode containerNode = new ComplexContainerTreeNode();
    containerNode.setLabel("Cluster Applications");

    Document docAppProfile = docColl.getFirstDocument();
    while(docAppProfile != null)
    {
            ComplexLeafTreeNode children = new ComplexLeafTreeNode();
            children.setComponent(oneui);
            children.setLabel(docAppProfile.getItemValueString("appTitle"));
        children.setHref(docAppProfile.getItemValueString("appURL"));
            children.setImage(docAppProfile.getItemValueString("appLogoThumb"));
            containerNode.addChild(children);

            Document tempDoc = docColl.getNextDocument(docAppProfile);
            docAppProfile = tempDoc;
    }
    uiConfig.addPlaceBarAction(containerNode);
    }

    public void afterPhase(PhaseEvent event) {
        System.out.println("END PHASE " + event.getPhaseId());
    }

}
+1

, , - PhaseListener Node . .

0

All Articles