4 Replies Latest reply on Dec 23, 2010 9:30 AM by zaquas

    rich:calendar programmatically problem

    zaquas

      Hello to all, and excuse for my English...

      If I try create a rich:calendar component programmatically the numbers of the days are hidden.

      I doing this:

       

       

       

      HelloHello to all, and excuse for my English...

      public class FieldPlusHandler extends TagHandler {      private final TagAttribute backingBeanTag;      private final TagAttribute fieldTag;      private final TagAttribute valueTag;      public FieldPlusHandler(TagConfig config) {           super(config);           this.backingBeanTag = this.getRequiredAttribute("backingBean");           this.fieldTag = this.getRequiredAttribute("field");           this.valueTag = this.getRequiredAttribute("value");      }      public void apply(FaceletContext faceletsContext, UIComponent aParent) throws IOException, FacesException, FaceletException, ELException {           if (!faceletsContext.getFacesContext().getRenderKit().getResponseStateManager().isPostback(faceletsContext.getFacesContext())) {                ValueExpression valueExpression = valueTag.getValueExpression(faceletsContext, Object.class);                //final HtmlCalendar calendar = (HtmlCalendar) FacesContext.getCurrentInstance().getApplication().createComponent(HtmlCalendar.COMPONENT_TYPE);                                HtmlCalendar calendar = new HtmlCalendar();                calendar.setValueExpression("value", valueExpression);                calendar.setPopup(true);                calendar.setShowApplyButton(false);                calendar.setCellWidth("24px");                calendar.setCellHeight("22px");                calendar.setDatePattern("d MMM yyyy");                calendar.setStyle("width:200px;");                                     aParent.getChildren().add(calendar);                                final HtmlAjaxSupport htmlAjaxSupport = (HtmlAjaxSupport) FacesContext.getCurrentInstance().getApplication().createComponent(HtmlAjaxSupport.COMPONENT_TYPE);                htmlAjaxSupport.setEvent("onchanged");                calendar.getChildren().add(htmlAjaxSupport);                                                }      } }

      If I try create a rich:calendar component programmatically the numbers of the days are hidden.
      I doing this: to all, and excuse for my English...
      If I try create a rich:calendar component programmatically the numbers of the days are hidden.
      I doing this:

       

      And when try to use the calendar....

      calendar.png

      Somebody have a idea?

      Thanks in advance

       

      Stefano Zaccaria.

        • 1. Re: rich:calendar programmatically problem
          zaquas
          • 2. Re: rich:calendar programmatically problem
            ilya_shaikovsky

            add support not as child component but put to facets map.

            • 3. Re: rich:calendar programmatically problem
              zaquas

              Thanks Ilya for suggest.
              But, apologise me, how can put the support to facets map and bind to the calendar component?
              I try but I don't find nothing method to do this on the support component. Have some suggest to give me?

              Thanks Ilya for suggest.

              But, apologise me, how can put the support to facets map and bind to the calendar component?

              I try, but I don't find nothing method to do this on the support component. Have some suggest to give me?

              Thanks in advance.

              Stefano Zaccaria

              • 4. Re: rich:calendar programmatically problem
                zaquas
                Hi Ilya, after had read this post http://community.jboss.org/message/540674, I've tried to set the support in the manner that you suggested me.
                And it work! Thanks.

                Hi Ilya, after had read this post http://community.jboss.org/message/540674, I've tried to set the support in the manner that you suggested me.

                 

                 

                HtmlCalendar calendar = new HtmlCalendar();                           calendar.setValueExpression("value", valueExpression);                     calendar.setPopup(true);                     calendar.setShowApplyButton(false);                     calendar.setCellWidth("24px");                     calendar.setCellHeight("22px");                     calendar.setDatePattern("d MMM yyyy");                     calendar.setStyle("width:200px;");                                           final HtmlAjaxSupport htmlAjaxSupport = (HtmlAjaxSupport) FacesContext.getCurrentInstance().getApplication().createComponent(HtmlAjaxSupport.COMPONENT_TYPE);                     htmlAjaxSupport.setEvent("onchanged");                     calendar.getFacets().put("a4jsupport",htmlAjaxSupport);                                                                 aParent.getChildren().add(calendar);                 

                 

                And it work! Thanks.