4 Replies Latest reply on Dec 1, 2009 12:44 AM by ramprasadhtv

    Rich Calendar Issue in 3.3.2.

      Hi Ilya

      We have encountered a strange but critical issue in calendar as part of migration of application from 3.2.1 to 3.3.2. This is related rich calendar.

      1 Problem description:
      -In richCalendar control, popup mode, days are not being rendered (they come blank). Clicking on them however, selects the date correctly. Months & weeknumbers in the same view are rendered correctly though.

      2/ Conditions under which the problem occur:
      -Calendar control is programmatically constructed -Calendar control component has at least one child component of whatever kind (converter, A4J support)

      Can you please help. We use the above in parametric search where on selection of date, we update the count thru A4j. Without this working will impact functionality.

      Please note that this works in 3.2.1

      Thanks a lot for the help in advance.

        • 1. Re: Rich Calendar Issue in 3.3.2.
          ilya_shaikovsky

          Please show concrete code. Calendar component uses nested children component as day markup. But that should not touch converters and a4j:support.

          • 2. Re: Rich Calendar Issue in 3.3.2.

            Hi Ilya

            As part of the xhtml, we have a isRendered boolean method where the parametric form is constructed programatically.

            When we also checked the styling aspect we observed that
            -- When it comes OK (e.g. in Manage Calendar page), the day number comes directly as text value in TD tag of calendar table
            -- When it is corrupted (empty cells), the TD tag contains only an empty DIV with style class "rich-calendar-cell-div"...


            Enclosing the method related to calendar
            protected UIComponent buildRangeControl(String attribute) {
            JsfPanelGridNoStyle minMaxPanelGrid = (JsfPanelGridNoStyle) FacesContext.getCurrentInstance().getApplication().createComponent(JsfPanelGridNoStyle.COMPONENT_TYPE);

            minMaxPanelGrid.setId("minMaxPanelGridId_" + attribute);
            // minMaxPanelGrid.setColumnClasses("jsfPanelGridColRange1, jsfPanelGridCol2NoStyle");

            minMaxPanelGrid.setColumnClasses("jsfPanelGridCol1NoStyle, jsfPanelGridCol2NoStyle");



            Converter conv = getConverters().get(attribute);

            JsfOutputLabel lbl = (JsfOutputLabel) FacesContext.getCurrentInstance().getApplication().createComponent(JsfOutputLabel.COMPONENT_TYPE);
            lbl.setId("label_" + attribute);


            if (getCaptions().get(attribute) != null) {
            lbl.setValue(getCaptions().get(attribute));
            }


            JsfPanelGroup minPanelGroup = (JsfPanelGroup) FacesContext.getCurrentInstance().getApplication().createComponent(JsfPanelGroup.COMPONENT_TYPE);
            JsfPanelGroup maxPanelGroup = (JsfPanelGroup) FacesContext.getCurrentInstance().getApplication().createComponent(JsfPanelGroup.COMPONENT_TYPE);
            minPanelGroup.setId("minPanel_" + attribute);
            maxPanelGroup.setId("maxPanel_" + attribute);

            UIComponent min = null;
            UIComponent max = null;

            if (attribute.equals("dateInStock") || !(getConverters().get(attribute) instanceof DateConverter) || (getDateFormats().get(attribute) != null && getDateFormats().get(attribute).contains("d") && !getDateFormats().get(attribute).contains("MM") && !getDateFormats().get(attribute).contains("yyyy"))) {
            min = (JsfInputText) FacesContext.getCurrentInstance().getApplication().createComponent(JsfInputText.COMPONENT_TYPE);
            max = (JsfInputText) FacesContext.getCurrentInstance().getApplication().createComponent(JsfInputText.COMPONENT_TYPE);
            min.setId("min_" + attribute);
            max.setId("max_" + attribute);

            ((JsfInputText) min).setStyleClass("jsfInputTextRange");
            ((JsfInputText) max).setStyleClass("jsfInputTextRange");

            ValueExpression expr = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{commonParametricPageBean.parametricBean.selectedValuesMap." + attribute + "_MIN}", Object.class);
            min.setValueExpression("value", expr);

            expr = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{commonParametricPageBean.parametricBean.selectedValuesMap." + attribute + "_MAX}", Object.class);
            max.setValueExpression("value", expr);
            if(isShowOnChange()){
            min.getChildren().add(refreshSupport("onblur", "suportmin_" + attribute));
            max.getChildren().add(refreshSupport("onblur", "suportmax_" + attribute));
            }

            ((JsfInputText) min).setConverter(conv);
            ((JsfInputText) max).setConverter(conv);



            } else {
            min = (RichCalendar) FacesContext.getCurrentInstance().getApplication().createComponent(RichCalendar.COMPONENT_TYPE);
            max = (RichCalendar) FacesContext.getCurrentInstance().getApplication().createComponent(RichCalendar.COMPONENT_TYPE);

            RichCalendar minCalendar = (RichCalendar) min;
            RichCalendar maxCalendar = (RichCalendar) max;

            minCalendar.setId("min_" + attribute);
            maxCalendar.setId("max_" + attribute);



            // ((RichCalendar)min).setStyleClass("richCalendarInputRange");
            // ((RichCalendar)max).setStyleClass("richCalendarInputRange");

            minCalendar.setShowInput(true);
            maxCalendar.setShowInput(true);

            minCalendar.setDatePattern(getDateFormats().get(attribute));
            maxCalendar.setDatePattern(getDateFormats().get(attribute));

            minCalendar.setConverter(conv);
            maxCalendar.setConverter(conv);

            ValueExpression expr = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{commonParametricPageBean.parametricBean.selectedValuesMap." + attribute + "_MIN}", Object.class);
            minCalendar.setValueExpression("value", expr);

            expr = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{commonParametricPageBean.parametricBean.selectedValuesMap." + attribute + "_MAX}", Object.class);
            maxCalendar.setValueExpression("value", expr);


            if(isShowOnChange()){
            min.getChildren().add(refreshSupport("onchanged", "suportmin_" + attribute));
            max.getChildren().add(refreshSupport("onchanged", "suportmax_" + attribute));
            }
            }
            UIParameter attributeParam = new UIParameter();
            attributeParam.setId("param_attribute_min_" + attribute);
            attributeParam.setName("attribute");
            attributeParam.setValue(attribute);
            UIParameter contextParam = new UIParameter();
            contextParam.setId("param_context_min_" + attribute);
            contextParam.setName("converterContext");
            contextParam.setValue("form");

            UIParameter formatParam = new UIParameter();
            formatParam.setName("DATE_FORMAT");
            if (getDateFormats().get(attribute) != null) {
            formatParam.setValue( getDateFormats().get(attribute));
            }


            min.getChildren().add(attributeParam);
            min.getChildren().add(contextParam);
            min.getChildren().add(formatParam);


            attributeParam = new UIParameter();
            attributeParam.setId("param_attribute_max_" + attribute);
            attributeParam.setName("attribute");
            attributeParam.setValue(attribute);
            contextParam = new UIParameter();
            contextParam.setId("param_context_max_" + attribute);
            contextParam.setName("converterContext");
            contextParam.setValue("form");



            max.getChildren().add(attributeParam);
            max.getChildren().add(contextParam);
            formatParam = new UIParameter();
            formatParam.setName("DATE_FORMAT");
            if (getDateFormats().get(attribute) != null) {
            formatParam.setValue( getDateFormats().get(attribute));
            }
            max.getChildren().add(formatParam);



            //min.setConverter(conv);
            //max.setConverter(conv);


            minPanelGroup.getChildren().add(min);
            maxPanelGroup.getChildren().add(max);
            if(isShowToolTip()){

            RichToolTip minToolTip = getRangeToolTipMin(min.getId(), attribute);
            minPanelGroup.getChildren().add(minToolTip);
            RichToolTip maxToolTip = getRangeToolTipMax(max.getId(), attribute);
            maxPanelGroup.getChildren().add(maxToolTip);
            }
            if (attribute.equals("dateInStock") || (getDateFormats().get(attribute) != null && getDateFormats().get(attribute).contains("d") && !getDateFormats().get(attribute).contains("MM") && !getDateFormats().get(attribute).contains("yyyy"))) {
            minMaxPanelGrid.getChildren().add(maxPanelGroup);
            minMaxPanelGrid.getChildren().add(minPanelGroup);
            } else {
            minMaxPanelGrid.getChildren().add(minPanelGroup);
            minMaxPanelGrid.getChildren().add(maxPanelGroup);
            }

            panelGrid.getChildren().add(lbl);
            panelGrid.getChildren().add(minMaxPanelGrid);

            getUIComponentMap().put(attribute + "_MIN", min);
            getUIComponentMap().put(attribute + "_MAX", max);



            return panelGrid;


            }

            • 3. Re: Rich Calendar Issue in 3.3.2.
              ilya_shaikovsky

              hmm.. it's looks weird but as I said

              Calendar component uses nested children component as day markup.


              and UIParam is a component - so calendar trying to build markup from nested components but actually there are no components which output any layout in your case.. add outputText with value {day} to the calendar children in order to output the cell day in your case.

              • 4. Re: Rich Calendar Issue in 3.3.2.

                Thank you very much Ilya. Works fine as per your suggestion. Appreciate your help.