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 <[EMAIL PROTECTED]>:
> 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 <[EMAIL PROTECTED]>:
> > 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, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > >> 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

Reply via email to