nesting subwidgets in layouts
Subject: nesting subwidgets in layouts
Newsgroups: gmane.comp.cms.nuxeo.general
Date: 2008-05-02 06:40:21 GMT
Hy all,
Sorry for the preceding post with bad attachment.
Here's my problem.
I wanted to use nested subwidgets in a layout : I have a field which type is a complexType composed itself of a field which is a complexType. I've defined a widget that has a subwidget holding a subwidget (the definition follows).
But I get a NullPointer exception in an EL parsing.
Debugging, I found out that in the WidgetTagHandler, the nested subwidgets don't get assigned ids, so I modified the code in the WidgetTagHandler so that the entire subwidget tree get assigned unique ids. But then, I get a StackOverFlow error. Debugging again, it seems that the sub widgets of the first level widget are append to the subwidgets of the second level widget, and so it enters in an infinite loop.
Is subwidget nesting supposed to work ? Am I doing something wrong ? If this is a bug, any cues to correct it ? (as I really need this stuff I'm willing to correct it but I run out of idea to do so)
Here are some of the files I'm using (template definition, xhtml template for the subwidget inclusion, schema).
Thanks in advance.
Nel
____________________
templates-contrib.xml
-----------------------------------
<?xml version="1.0"?>
<component name="com.example.layouts">
<extension
target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
point="layouts">
<layout name="structured2Layout">
<templates>
<template mode="any">
/layouts/layout_default_template.xhtml
</template>
</templates>
<rows>
<row>
<widget>nestedStruct</widget>
</row>
</rows>
<widget name="nestedStruct" type="template">
<properties mode="any">
<property name="template">
/widgets/complextype_template.xhtml
</property>
</properties>
<labels>
<label mode="any">nestedStruct</label>
</labels>
<fields>
<field>str2:nestedStruct</field>
</fields>
<subWidgets>
<widget name="struct" type="template">
<properties mode="any">
<property name="template">
/widgets/complextype_template.xhtml
</property>
</properties>
<labels>
<label mode="any">struct</label>
</labels>
<fields>
<field>struct</field>
</fields>
<subWidgets>
<widget name="structField1" type="text">
<labels>
<label mode="any">structField1</label>
</labels>
<fields>
<field>structField1</field>
</fields>
</widget>
<widget name="structField2" type="text">
<labels>
<label mode="any">structField2</label>
</labels>
<fields>
<field>structField2</field>
</fields>
</widget>
</subWidgets>
</widget>
&
nbsp;
</subWidgets>
</widget>
</layout>
</extension>
</component>
__________________________
complextype_template.xhtml
----------------------------------------------
<f:subview xmlns:c="http://java.sun.com/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:nxl="http://nuxeo.org/nxforms/layout"
xmlns:nxu="http://nuxeo.org/nxweb/util"
xmlns:nxd="http://nuxeo.org/nxweb/document" id="#{widget.id}">
<table class="dataInput">
<tbody>
<nxl:subWidget>
<tr>
<td class="labelColumn">
<h:outputText value="#{subWidget.label}" styleClass="labelColumn" />
</td>
<td class="fieldColumn">
<nxl:widget widget="#{subWidget}" mode="#{subWidget.mode}" value="#{field_0}" />
</td>
</tr>
</nxl:subWidget>
</tbody>
</table>
</f:subview>
______________
structured2.xsd
-------------------------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/schemas/structured2/"
xmlns:nxs="http://example.com/schemas/structured2/"
>
<xs:complexType name="structType">
<xs:sequence>
<xs:element name="structField1" type="xs:string" />
<xs:element name="structField2" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="nestedStructType">
<xs:sequence>
<xs:element name="struct" type="nxs:structType" />
</xs:sequence>
</xs:complexType>
<xs:element name="nestedStruct" type="nxs:nestedStructType" />
</xs:schema>
_______________________________________________ ECM mailing list ECM@... http://lists.nuxeo.com/mailman/listinfo/ecm
RSS Feed