0 Replies Latest reply on Jun 29, 2011 1:29 AM by imcharsi

    hi. about <rich:collapsiblePanel>  and related another panel...

    imcharsi

      hi.

      af first, i'm not native english speaker.

      i tested with richfaces-4.0.1-snapshot and mojarra-2.1.1-b04 and tomcat7.0.14.

       

      while i study richfaces, i found something strange.

       

      in <rich:collapsiblePanel>,

      when use "expanded" attribute with el,

      target property value is not changed.

       

      of course, it's possible that the function is not implemented intentionally.

       

      i thought that if i use el at "expanded" attribute, target property value should be updated and it's more naturally.

       

      in current richfaces implementation,

      we can get expanded flag info with PanelToggleEvent.

      so someone will think that this is not important problem.

       

      however, i try to solve this.

       

      key point is override AbstractCollapsiblePanel's updateModel method and look for "expanded" named value expression and if exist, call setValue method.

       

      something like this:

       

      void updateModel(...) {

          ...

          ValueExpression ve = getValueExpression("expanded");

          if (ve==null) {

              return;

          }

          ...

          try {

              ve.setValue(context.getELContext(), getExpanded());

              ...

          }

          ...

      }

       

      of course, we can use getSubmittedActiveItem() value which is updated in TogglePanelRenderer's decode method and actually has either true or false value, instead of getExpanded().

       

      another strange is that calling setExpanded method is in broadcast method. i think this calling should be in another place.

       

      i tested these update model function and it's work correctly.

       

      and renderer should use el result if expanded attribute is set with el. currently, renderer use component's local value instead of el result.

      so whether el target property value is constantly true or false, panel expand on one click and collapse on another click.

       

      in other words, assume that some panel is expanded(currently, flag is true), some command does flipflop panel's expand target property.

      if i click that command and refresh panel(<a4j:command... actionListener="#{...flip}"><a4j:ajax ... render="colPanel"/></...>), flag will be flipflop(now false). but panel's visual is not changed(expanded).

       

      of course this use is unusual and maybe this is not dev team's intention. and in currently implementation, if we want to this function, we can use component binding and directly calling component setExpanded method.

       

      but i think that when use ajax or server mode, these functions should be able.

       

      of course, i didnt test with renderer. but i think that replace point is calling isExpand method.

       

      how do you think about?