Questions Tagged With jsfhttps://answers.axonivy.com/tags/jsf/?type=rss&user=Cuong%20Lequestions tagged <span class="tag">jsf</span>enTue, 26 Jan 2016 08:29:00 -0500How to wrap ivy composite component by a outputPanel dynamicallyhttps://answers.axonivy.com/questions/1641/how-to-wrap-ivy-composite-component-by-a-outputpanel-dynamically<p>Hi ivy team,</p> <p>I need to wrap ivy composite component by a outputPanel. So in the event <a href="http://docs.oracle.com/javaee/6/api/javax/faces/event/PostAddToViewEvent.html">postAddToView</a>, i do some thing following:</p> <ol> <li>Scan UI: to get the list of components</li> <li>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.</li> </ol> <p>It goes wrong when i add event postAddToView to Address component</p> <p>Address xhtml</p> <pre><code>&lt; cc:interface componentType="IvyComponent"&gt; &lt; /cc:interface&gt; &lt; cc:implementation&gt; &lt; h:panelGroup layout="block" styleClass="component-wrapper" id="AddressPanel" &gt; &lt; f:event listener="#{logic.processView}" type="preValidate" &gt;&lt;/f:event&gt; &lt; f:event listener="#{logic.postValidate}" type="postValidate" &gt;&lt;/f:event&gt; &lt; f:event listener="#{logic.initializeView}" type="postAddToView"&gt;&lt;/f:event&gt; &lt; /h:panelGroup&gt; &lt; /cc:implementation&gt; </code></pre> <p>Demo xhtml</p> <pre><code>&lt; h:form id="form"&gt; &lt; f:event listener="#{logic.preValidate}" type="preValidate" &gt;&lt;/f:event&gt; &lt; f:event listener="#{logic.postValidate}" type="postValidate" &gt;&lt;/f:event&gt; &lt; f:event listener="#{logic.postAddToView}" type="postAddToView"&gt;&lt;/f:event&gt; &lt; p:outputLabel for="firstNameDemo" value="First name" title="Fist tooltip"/&gt; &lt; p:inputText id="firstNameDemo" value="#{data.firstNameDemo}"/&gt; &lt; ic:.DemoComponent data="#{data.person}" &gt;&lt;/ic:DemoComponent&gt; &lt; ic:ch.axonivy.fintech.basic.component.AddressComponent startMethod="start" id="abc" value="#{data.address}" &gt;&lt;/ic:.AddressComponent&gt; &lt; /h:form&gt; </code></pre> <p>wrap</p> <pre><code>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()); </code></pre> <p>Error</p> <pre><code>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: </code></pre> <p>Stack trace</p> <pre><code> 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) &lt;1524368C6B07FA9C-f8&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) </code></pre> <p>Please give me your feedback. Thanks for your support!</p>Cuong LeTue, 26 Jan 2016 08:29:00 -0500https://answers.axonivy.com/questions/1641/how-to-wrap-ivy-composite-component-by-a-outputpanel-dynamicallyjsfcomponentivyprimefaces