cancel
Showing results for 
Search instead for 
Did you mean: 

Simple custom widget causes an error.

karl_harris_
Star Collaborator
Star Collaborator

I have a simple widget:

<div xmlns:c="http://java.sun.com/jstl/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:nxu="http://nuxeo.org/nxweb/util" xmlns:nxd="http://nuxeo.org/nxweb/document"> < h:outputText style = "color: red; background: yellow; font-size: 40px;" value = "A string"/>< /div>

I've built a layout with Studio which uses this widget to display the result: A static constant string in the value clause of the outputText tag.

The correct string is returned the first few (it varies)times; however after several successive calls to this widget I get the following error in the log:

java.lang.IllegalStateException: duplicate Id for a component document_edit:nxl_layout_BESMoldPeelTape-edit:nxw_template _1 at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:68) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92) at org.ajax4jsf.application.AjaxStateManager.getTreeStructureToSave(AjaxStateManager.java:187) at org.ajax4jsf.application.AjaxStateManager.buildViewState(AjaxStateManager.java:498) at org.ajax4jsf.application.AjaxStateManager$SeamStateManagerWrapper.saveView(AjaxStateManager.java:105) at org.jboss.seam.jsf.SeamStateManager.saveView(SeamStateManager.java:89) at org.ajax4jsf.application.AjaxStateManager.saveSerializedView(AjaxStateManager.java:454) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:615) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) : The successive calls to this are after the document has transitioned to a different life cycle state or a new document is opened in some arbitrary life cycle state. If I uses a standard widget, to display some data about the document and cycle through the life cycle states and/or documents everything seems to work fine.

I believe there is something wrong with this widget.

Any suggestions?

6 REPLIES 6

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Hi,

Can't see what's wrong with this widget, what Nuxeo version are you using?

The error you see is a JSF error stating that two components with the same id are used in the page, but i'm not sure how it's related to your template, as it does not use the widget name or id and as you do not set any id attribute neither.

Are you using a custom layout template maybe?

And i don't understand if you're using this in a table layout or in a result layout. When you say "the first few times", can you describe what you're referring to?

Custom Layout

I forgot using V5.5 DM

karl_harris_
Star Collaborator
Star Collaborator

I found the problem and a work around for my application. I do believe however there is more work that needs to be done defining exactly whether the operations which build the JSF id are a bug or a feature 😉

It appears I had a JSF id collision between my custom widget and header widgets which were in some of the child documents mentioned in my comment above.

Bottom line is the custom widget ID's (JSF component ID's) in the Listings & Views -> Forms Layout used as a global header in each of the edit views of the child documents collided with the ID's generated by Nuxeo Header widgets I was using in each document. The collisions only occurred when I used a custom widget to display the "dynamic" string I mentioned above.

The workaround was to use a generic template/text widget with a value = #{my EL call}. It seems the generic template/text widget generates an ID for the Listing & Views -> Forms Layout "global header" that does not collide with the individual headers generated in the edit views of some of my child documents. The culprit seemed to be the word "template" that was used as a base for the ID with a suffix of one. Both the Listing & View and the individual edit-view software seemed to use the same algorithm to generate the ID's and they are unaware of each others existence hence the collision.

To see this problem create an edit view with a header widget and some text. Then create a Listing View-> Form Layout with a custom widget which just puts a static string into the value property. Try to display the edit-view and you should get the duplicate Id error seen above.

Hi Karl,

tracked by https

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.