You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/01/15 23:21:35 UTC

svn commit: r612250 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Author: bommel
Date: Tue Jan 15 14:21:33 2008
New Revision: 612250

URL: http://svn.apache.org/viewvc?rev=612250&view=rev
Log:
(TOBAGO-596) Duplicate component Id exception with tc:date and tx:date with facelets

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=612250&r1=612249&r2=612250&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Tue Jan 15 14:21:33 2008
@@ -135,13 +135,15 @@
     UIHiddenInput hidden =
         (UIHiddenInput) ComponentUtil.createComponent(facesContext,
             UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
+    hidden.setId(facesContext.getViewRoot().createUniqueId());
     link.getChildren().add(hidden);
 
     // create popup
     final UIPopup popup =
         (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
             RENDERER_TYPE_POPUP);
-    //popup.setId(link.getId() + "popup");
+
+    popup.setId(facesContext.getViewRoot().createUniqueId());
     link.getFacets().put(FACET_PICKER_POPUP, popup);
 
     popup.setRendered(false);
@@ -234,6 +236,7 @@
     UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
         facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
     image.setRendered(true);
+    image.setId(facesContext.getViewRoot().createUniqueId());
     image.setValue("image/date.gif");
     image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
     StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=612250&r1=612249&r2=612250&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Tue Jan 15 14:21:33 2008
@@ -70,20 +70,18 @@
         link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
       }
     }
-    String idPrefix = dateInput.getId() + "_picker";
     Map<String, Object>  attributes = link.getAttributes();
     link.setActionListener(datePickerController);
     attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
     UIComponent hidden = (UIComponent) link.getChildren().get(0);
-    hidden.setId(idPrefix + "Dimension");
+    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
+
     attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
         + link.getClientId(facesContext) + "', '"
-        + hidden.getClientId(facesContext) + "')");
-
-    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
+        + hidden.getClientId(facesContext) + "', '"
+        + popup.getClientId(facesContext) +"')");
 
     attributes = popup.getAttributes();
-    popup.setId(idPrefix + "popup");
 
     attributes.put(ATTR_WIDTH, String.valueOf(
            ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
@@ -113,8 +111,6 @@
 
     applyConverterPattern(popup, converterPattern);
 
-    UIComponent image = (UIComponent) link.getChildren().get(1);
-    image.setId(idPrefix + "image");
     if (popup != null) {
       UIPage page = ComponentUtil.findPage(facesContext, link);
       page.getPopups().add(popup);



Re: svn commit: r612250 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Posted by Martin Marinschek <ma...@gmail.com>.
not in MyFaces with JSP. In MyFaces, the uniqueId counter for dynamic
component generation is stored in between requests, and the ids for
components stem from a different counter. I wonder if Facelets uses
the same approach.

regards,

Martin

On 1/16/08, Volker Weber <v....@inexso.de> wrote:
> Bernd,
>
> i don't know how facelets component creation, rerendering works, but
> to my experience the assigning of viewRoot.createUniqueId() ids to
> componets created by application wil result in dublicateIdException on
> rerendering.
>
>
> Regards,
>     Volker
>
> 2008/1/15, bommel@apache.org <bo...@apache.org>:
> > Author: bommel
> > Date: Tue Jan 15 14:21:33 2008
> > New Revision: 612250
> >
> > URL: http://svn.apache.org/viewvc?rev=612250&view=rev
> > Log:
> > (TOBAGO-596) Duplicate component Id exception with tc:date and tx:date
> with facelets
> >
> > Modified:
> >
> myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> >
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> >
> > Modified:
> myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> > URL:
> http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=612250&r1=612249&r2=612250&view=diff
> >
> ==============================================================================
> > ---
> myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> (original)
> > +++
> myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> Tue Jan 15 14:21:33 2008
> > @@ -135,13 +135,15 @@
> >      UIHiddenInput hidden =
> >          (UIHiddenInput) ComponentUtil.createComponent(facesContext,
> >              UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
> > +    hidden.setId(facesContext.getViewRoot().createUniqueId());
> >      link.getChildren().add(hidden);
> >
> >      // create popup
> >      final UIPopup popup =
> >          (UIPopup) ComponentUtil.createComponent(facesContext,
> UIPopup.COMPONENT_TYPE,
> >              RENDERER_TYPE_POPUP);
> > -    //popup.setId(link.getId() + "popup");
> > +
> > +    popup.setId(facesContext.getViewRoot().createUniqueId());
> >      link.getFacets().put(FACET_PICKER_POPUP, popup);
> >
> >      popup.setRendered(false);
> > @@ -234,6 +236,7 @@
> >      UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
> >          facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
> >      image.setRendered(true);
> > +    image.setId(facesContext.getViewRoot().createUniqueId());
> >      image.setValue("image/date.gif");
> >      image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
> >
> StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker");
> // XXX not a standard name
> >
> > Modified:
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> > URL:
> http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=612250&r1=612249&r2=612250&view=diff
> >
> ==============================================================================
> > ---
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> (original)
> > +++
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> Tue Jan 15 14:21:33 2008
> > @@ -70,20 +70,18 @@
> >          link.setDisabled(dateInput.isReadonly() ||
> dateInput.isDisabled());
> >        }
> >      }
> > -    String idPrefix = dateInput.getId() + "_picker";
> >      Map<String, Object>  attributes = link.getAttributes();
> >      link.setActionListener(datePickerController);
> >      attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext,
> component, "pickerWidth"));
> >      UIComponent hidden = (UIComponent) link.getChildren().get(0);
> > -    hidden.setId(idPrefix + "Dimension");
> > +    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> > +
> >      attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
> >          + link.getClientId(facesContext) + "', '"
> > -        + hidden.getClientId(facesContext) + "')");
> > -
> > -    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> > +        + hidden.getClientId(facesContext) + "', '"
> > +        + popup.getClientId(facesContext) +"')");
> >
> >      attributes = popup.getAttributes();
> > -    popup.setId(idPrefix + "popup");
> >
> >      attributes.put(ATTR_WIDTH, String.valueOf(
> >             ThemeConfig.getValue(facesContext, link,
> "CalendarPopupWidth")));
> > @@ -113,8 +111,6 @@
> >
> >      applyConverterPattern(popup, converterPattern);
> >
> > -    UIComponent image = (UIComponent) link.getChildren().get(1);
> > -    image.setId(idPrefix + "image");
> >      if (popup != null) {
> >        UIPage page = ComponentUtil.findPage(facesContext, link);
> >        page.getPopups().add(popup);
> >
> >
> >
>
>
> --
> inexso - information exchange solutions GmbH
> Bismarckstraße 13      | 26122 Oldenburg
> Tel.: +49 441 4082 356 |
> FAX:  +49 441 4082 355 | www.inexso.de
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: svn commit: r612250 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Posted by Volker Weber <v....@inexso.de>.
To clear up some things:

In RI viewRoot.createUniqueId() is unique per request, not per view as
it suggests.


Regards,
    Volker

2008/1/16, Volker Weber <v....@inexso.de>:
> The id counter in viewRoot.createUniqueId() are resetted (at least in
> RI) on every request.
> If on rerendering a new  id is requested you get a already, on first
> rendering created, existent id.
>
> This is the case e.g. on tab switch, change of rendered attribute, ...
>
>
> Regards,
>     Volker
>
>
>
> 2008/1/16, Bernd Bohmann <be...@atanion.com>:
> > Hello Volker,
> >
> > my experience is you should assign uniqueIds to components.
> > What is the diffence between components created by application from a
> > tag and inside a component?
> >
> > If not you get maybe some errors like this:
> >
> > If this component was created dynamically (i.e. not by a JSP tag) you
> > should assign it an explicit static id or assign it the id you get from
> > the createUniqueId from the current UIViewRoot component right after
> > creation!
> >
> > If I have time i will checkin the files to reproduce the error.
> >
> > Regards
> >
> > Bernd
> >
> > Volker Weber schrieb:
> > > Bernd,
> > >
> > > i don't know how facelets component creation, rerendering works, but
> > > to my experience the assigning of viewRoot.createUniqueId() ids to
> > > componets created by application wil result in dublicateIdException on
> > > rerendering.
> > >
> > >
> > > Regards,
> > >     Volker
> > >
> > > 2008/1/15, bommel@apache.org <bo...@apache.org>:
> > >> Author: bommel
> > >> Date: Tue Jan 15 14:21:33 2008
> > >> New Revision: 612250
> > >>
> > >> URL: http://svn.apache.org/viewvc?rev=612250&view=rev
> > >> Log:
> > >> (TOBAGO-596) Duplicate component Id exception with tc:date and tx:date with facelets
> > >>
> > >> Modified:
> > >>     myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> > >>     myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> > >>
> > >> Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> > >> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=612250&r1=612249&r2=612250&view=diff
> > >> ==============================================================================
> > >> --- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
> > >> +++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Tue Jan 15 14:21:33 2008
> > >> @@ -135,13 +135,15 @@
> > >>      UIHiddenInput hidden =
> > >>          (UIHiddenInput) ComponentUtil.createComponent(facesContext,
> > >>              UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
> > >> +    hidden.setId(facesContext.getViewRoot().createUniqueId());
> > >>      link.getChildren().add(hidden);
> > >>
> > >>      // create popup
> > >>      final UIPopup popup =
> > >>          (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
> > >>              RENDERER_TYPE_POPUP);
> > >> -    //popup.setId(link.getId() + "popup");
> > >> +
> > >> +    popup.setId(facesContext.getViewRoot().createUniqueId());
> > >>      link.getFacets().put(FACET_PICKER_POPUP, popup);
> > >>
> > >>      popup.setRendered(false);
> > >> @@ -234,6 +236,7 @@
> > >>      UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
> > >>          facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
> > >>      image.setRendered(true);
> > >> +    image.setId(facesContext.getViewRoot().createUniqueId());
> > >>      image.setValue("image/date.gif");
> > >>      image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
> > >>      StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
> > >>
> > >> Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> > >> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=612250&r1=612249&r2=612250&view=diff
> > >> ==============================================================================
> > >> --- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
> > >> +++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Tue Jan 15 14:21:33 2008
> > >> @@ -70,20 +70,18 @@
> > >>          link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
> > >>        }
> > >>      }
> > >> -    String idPrefix = dateInput.getId() + "_picker";
> > >>      Map<String, Object>  attributes = link.getAttributes();
> > >>      link.setActionListener(datePickerController);
> > >>      attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
> > >>      UIComponent hidden = (UIComponent) link.getChildren().get(0);
> > >> -    hidden.setId(idPrefix + "Dimension");
> > >> +    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> > >> +
> > >>      attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
> > >>          + link.getClientId(facesContext) + "', '"
> > >> -        + hidden.getClientId(facesContext) + "')");
> > >> -
> > >> -    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> > >> +        + hidden.getClientId(facesContext) + "', '"
> > >> +        + popup.getClientId(facesContext) +"')");
> > >>
> > >>      attributes = popup.getAttributes();
> > >> -    popup.setId(idPrefix + "popup");
> > >>
> > >>      attributes.put(ATTR_WIDTH, String.valueOf(
> > >>             ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
> > >> @@ -113,8 +111,6 @@
> > >>
> > >>      applyConverterPattern(popup, converterPattern);
> > >>
> > >> -    UIComponent image = (UIComponent) link.getChildren().get(1);
> > >> -    image.setId(idPrefix + "image");
> > >>      if (popup != null) {
> > >>        UIPage page = ComponentUtil.findPage(facesContext, link);
> > >>        page.getPopups().add(popup);
> > >>
> > >>
> > >>
> > >
> > >
> >
>
>
> --
> inexso - information exchange solutions GmbH
> Bismarckstraße 13      | 26122 Oldenburg
> Tel.: +49 441 4082 356 |
> FAX:  +49 441 4082 355 | www.inexso.de
>


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de

Re: svn commit: r612250 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Posted by Volker Weber <v....@inexso.de>.
The id counter in viewRoot.createUniqueId() are resetted (at least in
RI) on every request.
If on rerendering a new  id is requested you get a already, on first
rendering created, existent id.

This is the case e.g. on tab switch, change of rendered attribute, ...


Regards,
    Volker



2008/1/16, Bernd Bohmann <be...@atanion.com>:
> Hello Volker,
>
> my experience is you should assign uniqueIds to components.
> What is the diffence between components created by application from a
> tag and inside a component?
>
> If not you get maybe some errors like this:
>
> If this component was created dynamically (i.e. not by a JSP tag) you
> should assign it an explicit static id or assign it the id you get from
> the createUniqueId from the current UIViewRoot component right after
> creation!
>
> If I have time i will checkin the files to reproduce the error.
>
> Regards
>
> Bernd
>
> Volker Weber schrieb:
> > Bernd,
> >
> > i don't know how facelets component creation, rerendering works, but
> > to my experience the assigning of viewRoot.createUniqueId() ids to
> > componets created by application wil result in dublicateIdException on
> > rerendering.
> >
> >
> > Regards,
> >     Volker
> >
> > 2008/1/15, bommel@apache.org <bo...@apache.org>:
> >> Author: bommel
> >> Date: Tue Jan 15 14:21:33 2008
> >> New Revision: 612250
> >>
> >> URL: http://svn.apache.org/viewvc?rev=612250&view=rev
> >> Log:
> >> (TOBAGO-596) Duplicate component Id exception with tc:date and tx:date with facelets
> >>
> >> Modified:
> >>     myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> >>     myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> >>
> >> Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> >> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=612250&r1=612249&r2=612250&view=diff
> >> ==============================================================================
> >> --- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
> >> +++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Tue Jan 15 14:21:33 2008
> >> @@ -135,13 +135,15 @@
> >>      UIHiddenInput hidden =
> >>          (UIHiddenInput) ComponentUtil.createComponent(facesContext,
> >>              UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
> >> +    hidden.setId(facesContext.getViewRoot().createUniqueId());
> >>      link.getChildren().add(hidden);
> >>
> >>      // create popup
> >>      final UIPopup popup =
> >>          (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
> >>              RENDERER_TYPE_POPUP);
> >> -    //popup.setId(link.getId() + "popup");
> >> +
> >> +    popup.setId(facesContext.getViewRoot().createUniqueId());
> >>      link.getFacets().put(FACET_PICKER_POPUP, popup);
> >>
> >>      popup.setRendered(false);
> >> @@ -234,6 +236,7 @@
> >>      UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
> >>          facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
> >>      image.setRendered(true);
> >> +    image.setId(facesContext.getViewRoot().createUniqueId());
> >>      image.setValue("image/date.gif");
> >>      image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
> >>      StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
> >>
> >> Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> >> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=612250&r1=612249&r2=612250&view=diff
> >> ==============================================================================
> >> --- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
> >> +++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Tue Jan 15 14:21:33 2008
> >> @@ -70,20 +70,18 @@
> >>          link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
> >>        }
> >>      }
> >> -    String idPrefix = dateInput.getId() + "_picker";
> >>      Map<String, Object>  attributes = link.getAttributes();
> >>      link.setActionListener(datePickerController);
> >>      attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
> >>      UIComponent hidden = (UIComponent) link.getChildren().get(0);
> >> -    hidden.setId(idPrefix + "Dimension");
> >> +    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> >> +
> >>      attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
> >>          + link.getClientId(facesContext) + "', '"
> >> -        + hidden.getClientId(facesContext) + "')");
> >> -
> >> -    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> >> +        + hidden.getClientId(facesContext) + "', '"
> >> +        + popup.getClientId(facesContext) +"')");
> >>
> >>      attributes = popup.getAttributes();
> >> -    popup.setId(idPrefix + "popup");
> >>
> >>      attributes.put(ATTR_WIDTH, String.valueOf(
> >>             ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
> >> @@ -113,8 +111,6 @@
> >>
> >>      applyConverterPattern(popup, converterPattern);
> >>
> >> -    UIComponent image = (UIComponent) link.getChildren().get(1);
> >> -    image.setId(idPrefix + "image");
> >>      if (popup != null) {
> >>        UIPage page = ComponentUtil.findPage(facesContext, link);
> >>        page.getPopups().add(popup);
> >>
> >>
> >>
> >
> >
>


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de

Re: svn commit: r612250 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Posted by Bernd Bohmann <be...@atanion.com>.
Hello Volker,

my experience is you should assign uniqueIds to components.
What is the diffence between components created by application from a
tag and inside a component?

If not you get maybe some errors like this:

If this component was created dynamically (i.e. not by a JSP tag) you
should assign it an explicit static id or assign it the id you get from
the createUniqueId from the current UIViewRoot component right after
creation!

If I have time i will checkin the files to reproduce the error.

Regards

Bernd

Volker Weber schrieb:
> Bernd,
> 
> i don't know how facelets component creation, rerendering works, but
> to my experience the assigning of viewRoot.createUniqueId() ids to
> componets created by application wil result in dublicateIdException on
> rerendering.
> 
> 
> Regards,
>     Volker
> 
> 2008/1/15, bommel@apache.org <bo...@apache.org>:
>> Author: bommel
>> Date: Tue Jan 15 14:21:33 2008
>> New Revision: 612250
>>
>> URL: http://svn.apache.org/viewvc?rev=612250&view=rev
>> Log:
>> (TOBAGO-596) Duplicate component Id exception with tc:date and tx:date with facelets
>>
>> Modified:
>>     myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
>>     myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
>>
>> Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
>> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=612250&r1=612249&r2=612250&view=diff
>> ==============================================================================
>> --- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
>> +++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Tue Jan 15 14:21:33 2008
>> @@ -135,13 +135,15 @@
>>      UIHiddenInput hidden =
>>          (UIHiddenInput) ComponentUtil.createComponent(facesContext,
>>              UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
>> +    hidden.setId(facesContext.getViewRoot().createUniqueId());
>>      link.getChildren().add(hidden);
>>
>>      // create popup
>>      final UIPopup popup =
>>          (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
>>              RENDERER_TYPE_POPUP);
>> -    //popup.setId(link.getId() + "popup");
>> +
>> +    popup.setId(facesContext.getViewRoot().createUniqueId());
>>      link.getFacets().put(FACET_PICKER_POPUP, popup);
>>
>>      popup.setRendered(false);
>> @@ -234,6 +236,7 @@
>>      UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
>>          facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
>>      image.setRendered(true);
>> +    image.setId(facesContext.getViewRoot().createUniqueId());
>>      image.setValue("image/date.gif");
>>      image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
>>      StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
>>
>> Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
>> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=612250&r1=612249&r2=612250&view=diff
>> ==============================================================================
>> --- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
>> +++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Tue Jan 15 14:21:33 2008
>> @@ -70,20 +70,18 @@
>>          link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
>>        }
>>      }
>> -    String idPrefix = dateInput.getId() + "_picker";
>>      Map<String, Object>  attributes = link.getAttributes();
>>      link.setActionListener(datePickerController);
>>      attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
>>      UIComponent hidden = (UIComponent) link.getChildren().get(0);
>> -    hidden.setId(idPrefix + "Dimension");
>> +    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
>> +
>>      attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
>>          + link.getClientId(facesContext) + "', '"
>> -        + hidden.getClientId(facesContext) + "')");
>> -
>> -    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
>> +        + hidden.getClientId(facesContext) + "', '"
>> +        + popup.getClientId(facesContext) +"')");
>>
>>      attributes = popup.getAttributes();
>> -    popup.setId(idPrefix + "popup");
>>
>>      attributes.put(ATTR_WIDTH, String.valueOf(
>>             ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
>> @@ -113,8 +111,6 @@
>>
>>      applyConverterPattern(popup, converterPattern);
>>
>> -    UIComponent image = (UIComponent) link.getChildren().get(1);
>> -    image.setId(idPrefix + "image");
>>      if (popup != null) {
>>        UIPage page = ComponentUtil.findPage(facesContext, link);
>>        page.getPopups().add(popup);
>>
>>
>>
> 
> 

Re: svn commit: r612250 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java

Posted by Volker Weber <v....@inexso.de>.
Bernd,

i don't know how facelets component creation, rerendering works, but
to my experience the assigning of viewRoot.createUniqueId() ids to
componets created by application wil result in dublicateIdException on
rerendering.


Regards,
    Volker

2008/1/15, bommel@apache.org <bo...@apache.org>:
> Author: bommel
> Date: Tue Jan 15 14:21:33 2008
> New Revision: 612250
>
> URL: http://svn.apache.org/viewvc?rev=612250&view=rev
> Log:
> (TOBAGO-596) Duplicate component Id exception with tc:date and tx:date with facelets
>
> Modified:
>     myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
>     myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
>
> Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=612250&r1=612249&r2=612250&view=diff
> ==============================================================================
> --- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
> +++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Tue Jan 15 14:21:33 2008
> @@ -135,13 +135,15 @@
>      UIHiddenInput hidden =
>          (UIHiddenInput) ComponentUtil.createComponent(facesContext,
>              UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
> +    hidden.setId(facesContext.getViewRoot().createUniqueId());
>      link.getChildren().add(hidden);
>
>      // create popup
>      final UIPopup popup =
>          (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
>              RENDERER_TYPE_POPUP);
> -    //popup.setId(link.getId() + "popup");
> +
> +    popup.setId(facesContext.getViewRoot().createUniqueId());
>      link.getFacets().put(FACET_PICKER_POPUP, popup);
>
>      popup.setRendered(false);
> @@ -234,6 +236,7 @@
>      UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
>          facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
>      image.setRendered(true);
> +    image.setId(facesContext.getViewRoot().createUniqueId());
>      image.setValue("image/date.gif");
>      image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
>      StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
>
> Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=612250&r1=612249&r2=612250&view=diff
> ==============================================================================
> --- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
> +++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Tue Jan 15 14:21:33 2008
> @@ -70,20 +70,18 @@
>          link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
>        }
>      }
> -    String idPrefix = dateInput.getId() + "_picker";
>      Map<String, Object>  attributes = link.getAttributes();
>      link.setActionListener(datePickerController);
>      attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
>      UIComponent hidden = (UIComponent) link.getChildren().get(0);
> -    hidden.setId(idPrefix + "Dimension");
> +    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> +
>      attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
>          + link.getClientId(facesContext) + "', '"
> -        + hidden.getClientId(facesContext) + "')");
> -
> -    UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
> +        + hidden.getClientId(facesContext) + "', '"
> +        + popup.getClientId(facesContext) +"')");
>
>      attributes = popup.getAttributes();
> -    popup.setId(idPrefix + "popup");
>
>      attributes.put(ATTR_WIDTH, String.valueOf(
>             ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
> @@ -113,8 +111,6 @@
>
>      applyConverterPattern(popup, converterPattern);
>
> -    UIComponent image = (UIComponent) link.getChildren().get(1);
> -    image.setId(idPrefix + "image");
>      if (popup != null) {
>        UIPage page = ComponentUtil.findPage(facesContext, link);
>        page.getPopups().add(popup);
>
>
>


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de