Hi,

In fact, I've found out that I have two different problems dealing with
dates and lists.

1) The first one  (the one I reported before) appears with a list of
elements that are of a complex type that contains a date element . In this
case, the date get setted ok but I have an execption when going on the
modify tab.

-------------------------
Extract from the schema :

  <xs:complexType name="complexWithDateType">
    <xs:sequence>
      <xs:element name="aString" type="xs:string"/>
      <xs:element name="aDate" type="xs:date"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="complexWithDateList">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="item"
type="skdocEmfFt:complexWithDateType"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="complexWithDate" type="skdocEmfFt:complexWithDateList"/>

-------------------------
Extract from the layout :

      <widget name="complexWithDate" type="list">
        <translated>true</translated>
        <labels>
          <label
mode="any">org.skinsoft.skdoc.ft.label.SkdocEmfFt.multipleDate.complexWithDate</label>
        </labels>
        <fields>
          <field>skdocEmfFt:complexWithDate</field>
        </fields>
        <subWidgets>
          <widget name="aString" type="text">
            <translated>true</translated>
            <labels>
              <label
mode="any">org.skinsoft.skdoc.ft.label.SkdocEmfFt.multipleDate.complexWithDate.aString</label>
            </labels>
            <fields>
              <field>aString</field>
            </fields>
          </widget>
          <widget name="aDate" type="datetime">
            <translated>true</translated>
            <labels>
              <label
mode="any">org.skinsoft.skdoc.ft.label.SkdocEmfFt.multipleDate.complexWithDate.aDate</label>
            </labels>
            <fields>
              <field>aDate</field>
            </fields>
            <properties widgetMode="any">
              <property
name="pattern">#{nxu:basicDateAndTimeFormater()}</property>
            </properties>
          </widget>
        </subWidgets>
      </widget>

---------------
The exception :

java.lang.IllegalArgumentException: Cannot format given Object as a Date
        at java.text.DateFormat.format(DateFormat.java:281)
        at java.text.Format.format(Format.java:140)
        at
javax.faces.convert.DateTimeConverter.getAsString(DateTimeConverter.java:448)
        at
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:469)
        at
org.nuxeo.ecm.platform.ui.web.component.date.InputDateTimeRenderer.encodeBegin(InputDateTimeRenderer.java:79)




2) The second one appears with a list of dates. But maybe the schema
declaration is not supported (it works with xs:string so I thought it would
with xs:date). The exception occurs when I hit the save button and the value
is not stored in the document.

-------------------------
Extract from the schema :
  <xs:simpleType name="dateListList">
    <xs:list itemType="xs:date"/>
  </xs:simpleType>
  <xs:element name="dateList" type="skdocEmfFt:dateListList"/>

-------------------------
Extract from the layout :
      <widget name="dateList" type="list">
        <translated>true</translated>
        <labels>
          <label
mode="any">org.skinsoft.skdoc.ft.label.SkdocEmfFt.multipleDate.dateList</label>
        </labels>
        <fields>
          <field>skdocEmfFt:dateList</field>
        </fields>
        <subWidgets>
          <widget name="dateList_item" type="datetime">
            <translated>true</translated>
            <labels>
              <label mode="any"></label>
            </labels>
            <fields>
              <field></field>
            </fields>
            <properties widgetMode="any">
              <property
name="pattern">#{nxu:basicDateAndTimeFormater()}</property>
            </properties>
          </widget>
        </subWidgets>
      </widget>

---------------
The exception :

16:28:46,163 ERROR [STDERR] java.lang.ArrayStoreException
16:28:46,164 ERROR [STDERR]     at java.lang.System.arraycopy(Native Method)
16:28:46,164 ERROR [STDERR]     at
java.util.ArrayList.toArray(ArrayList.java:306)
16:28:46,164 ERROR [STDERR]     at
org.nuxeo.ecm.core.api.model.impl.ArrayProperty.normalize(ArrayProperty.java:71)
16:28:46,164 ERROR [STDERR]     at
org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(AbstractProperty.java:309)
16:28:46,164 ERROR [STDERR]     at
org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(AbstractProperty.java:325)
16:28:46,164 ERROR [STDERR]     at
org.nuxeo.ecm.core.api.impl.DataModelImpl.setData(DataModelImpl.java:103)
16:28:46,164 ERROR [STDERR]     at
org.nuxeo.ecm.core.api.impl.DocumentModelImpl.setProperty(DocumentModelImpl.java:689)
16:28:46,164 ERROR [STDERR]     at
org.nuxeo.ecm.platform.ui.web.resolver.DocumentModelResolver.setValue(DocumentModelResolver.java:200)


Thanks.

Nel


2008/5/15 Anahide Tchertchian <[EMAIL PROTECTED]>:

> Hi,
>
> I suspect you're dealing with a Calendar instance instead of a Date.
> It may be a bug, how far is your date in your hierarchy of fields? How do
> your access it?
>
> Thanks,
> anahide.
>
> Nel Taurisson a écrit :
>
>> Hi,
>>
>> I have a problem when nesting a date widget within a list widget.
>>
>> As long as the field is empty, all is correct. I can enter a date, it gets
>> save ok. I can see it in view mode, but when I try to switch in edit mode
>> then I get the following error :
>>
>> 17:36:36,179 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces
>> Servlet threw exception
>> java.lang.IllegalArgumentException: Cannot format given Object as a Date
>>        at java.text.DateFormat.format(DateFormat.java:281)
>>        at java.text.Format.format(Format.java:140)
>>        at
>> javax.faces.convert.DateTimeConverter.getAsString(DateTimeConverter.java:448)
>>        at
>> com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:469)
>>        at
>> org.nuxeo.ecm.platform.ui.web.component.date.InputDateTimeRenderer.encodeBegin(InputDateTimeRenderer.java:79)
>>        at
>> javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:785)
>>        ...
>>
>>
>> If someone any cues...
>>
>> Thanks
>>
>> Nel
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ECM mailing list
>> [email protected]
>> http://lists.nuxeo.com/mailman/listinfo/ecm
>>
>
>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to