<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to wrap ivy composite component by a outputPanel dynamically</title><link>https://answers.axonivy.com/questions/1641/how-to-wrap-ivy-composite-component-by-a-outputpanel-dynamically</link><description>&lt;p&gt;Hi ivy team,&lt;/p&gt;
&lt;p&gt;I need to wrap ivy composite component by a outputPanel. So in the event &lt;a href="http://docs.oracle.com/javaee/6/api/javax/faces/event/PostAddToViewEvent.html"&gt;postAddToView&lt;/a&gt;, i do some thing following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Scan UI: to get the list of components&lt;/li&gt;
&lt;li&gt;Update UI: i loop on that list. Then i get the parent of ivy component, replace ivy component by the new outputLabel and assign ivy component to outLabel's children.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It goes wrong when i add event postAddToView to Address component&lt;/p&gt;
&lt;p&gt;Address xhtml&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt; cc:interface componentType="IvyComponent"&amp;gt;
&amp;lt; /cc:interface&amp;gt;
&amp;lt; cc:implementation&amp;gt;
    &amp;lt; h:panelGroup layout="block" styleClass="component-wrapper" id="AddressPanel" &amp;gt;
        &amp;lt; f:event listener="#{logic.processView}" type="preValidate" &amp;gt;&amp;lt;/f:event&amp;gt; 
        &amp;lt; f:event listener="#{logic.postValidate}" type="postValidate" &amp;gt;&amp;lt;/f:event&amp;gt; 
        &amp;lt; f:event listener="#{logic.initializeView}" type="postAddToView"&amp;gt;&amp;lt;/f:event&amp;gt;
    &amp;lt; /h:panelGroup&amp;gt;
&amp;lt; /cc:implementation&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Demo xhtml&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt; h:form id="form"&amp;gt;
 &amp;lt; f:event listener="#{logic.preValidate}" type="preValidate" &amp;gt;&amp;lt;/f:event&amp;gt;
    &amp;lt; f:event listener="#{logic.postValidate}" type="postValidate" &amp;gt;&amp;lt;/f:event&amp;gt;  
    &amp;lt; f:event listener="#{logic.postAddToView}" type="postAddToView"&amp;gt;&amp;lt;/f:event&amp;gt;
    &amp;lt; p:outputLabel for="firstNameDemo" value="First name" title="Fist tooltip"/&amp;gt;
    &amp;lt; p:inputText id="firstNameDemo" value="#{data.firstNameDemo}"/&amp;gt;
    &amp;lt; ic:.DemoComponent data="#{data.person}" &amp;gt;&amp;lt;/ic:DemoComponent&amp;gt;
    &amp;lt; ic:ch.axonivy.fintech.basic.component.AddressComponent
                    startMethod="start" id="abc" value="#{data.address}" &amp;gt;&amp;lt;/ic:.AddressComponent&amp;gt;
&amp;lt; /h:form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;wrap&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;OutputPanel outputPanel = UIComponentUtil.createOutputPanel(param.getFacesContext());
outputPanel.setId(ivyComponent.getId() + UIComponentUtil.PARENT_SUFFIX);
ivyComponent.getParent().getParent().getChildren().set(ivyComponent.getParent().getParent().getChildren().indexOf(ivyComponent.getParent()), outputPanel);
outputPanel.getChildren().add(ivyComponent.getParent());
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Error&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;PermissionDeniedException: Session 1 (Developer) is not allowed to call method public ch.ivyteam.ivy.cm.IContentManagementSystem ch.ivyteam.ivy.cm.internal.ContentManagement.findCms(ch.ivyteam.ivy.application.IProcessModelVersion).
    The session does not fulfill the permission rule SESSION IS SYSTEM
    ProvisionException: Unable to provision, see the following errors:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Stack trace&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    org.apache.myfaces.view.facelets.el.ContextAwareELException: javax.el.ELException: ch.ivyteam.ivy.bpm.engine.restricted.error.BpmErrorHandler$UnhandledException: BpmError ivy:error:system
 Unique ID: 1528153199ECF258
 Process Element: postAddToView(PostAddToViewEvent) &amp;lt;1524368C6B07FA9C-f8&amp;gt;
    at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:108)
    at org.apache.myfaces.view.facelets.tag.jsf.core.EventHandler$Listener.processEvent(EventHandler.java:273)
    at javax.faces.component.UIComponent$EventListenerWrapper.processEvent(UIComponent.java:1624)
    at javax.faces.event.SystemEvent.processListener(SystemEvent.java:40)
    at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:51)
    at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2595)
    at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:595)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:328)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:328)
    at javax.faces.component.UIComponentBase._publishPostAddToViewEvent(UIComponentBase.java:243)
    at javax.faces.component.UIComponentBase._publishPostAddToViewEvent(UIComponentBase.java:262)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Please give me your feedback.
Thanks for your support!&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1641/how-to-wrap-ivy-composite-component-by-a-outputpanel-dynamically" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 05 Feb 2016 15:14:09 -0500</lastBuildDate><item><title>Answer by Flavio Sadeghi</title><link>https://answers.axonivy.com/questions/1641/how-to-wrap-ivy-composite-component-by-a-outputpanel-dynamically/1651</link><description>&lt;p&gt;Try to execute the code as System, as described  here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://answers.axonivy.com/questions/744/how-can-i-disable-xpert-ivy-security-permission-checks"&gt;http://answers.axonivy.com/questions/744/how-can-i-disable-xpert-ivy-security-permission-checks&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Fri, 05 Feb 2016 15:14:09 -0500</pubDate><guid>https://answers.axonivy.com/questions/1641/how-to-wrap-ivy-composite-component-by-a-outputpanel-dynamically/1651</guid></item></channel></rss>