ICEfaces
  1. ICEfaces
  2. ICE-2124

PanelTabSet doesn't sync bound selectedIndex on tabChange events

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.2, 1.7DR#3, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      win xp

      Description

      The PanelTabSet doesn't synchronize tabChange events with the selectedIndex valueBinding if there is one.

      suggested fix:

      Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java
      ===================================================================
      --- D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java (revision 14824)
      +++ D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java (working copy)
      @@ -279,6 +279,10 @@
                   TabChangeEvent tabChangeEvent = (TabChangeEvent) event;
                   if (tabChangeEvent.getComponent() == this) {
                       setSelectedIndex(tabChangeEvent.getNewTabIndex());
      + if( getValueBinding("selectedIndex") != null ){
      + getValueBinding("selectedIndex").setValue(this.getFacesContext(), Integer.valueOf(tabChangeEvent.getNewTabIndex()));
      + }
      +
                       //getFacesContext().renderResponse();
                   }
               }

        Issue Links

          Activity

          Hide
          Judy Guglielmin added a comment -

          Seam has problem with component-binding unless the bean is session-scoped. (not practical). So to use value binding, the selectedIndex has to have value binding available to selectedIndex property.

          would be nice to have the option to use valueBinding for this property for ease of use with seam (as well as MVC)

          Mark's adhoc fixes worked great and simplified the Bean & xhtml page immensely when he modified the getters and setters of com.icesoft.faces.component.paneltabset as follows:-

          /**

          • @param selectedIndex
            */
            void setSelectedIndex(Integer selectedIndex) { System.out.println("PanelTabSet.setSelectedIndex(I="+selectedIndex+")"); if(selectedIndex == null) _selectedIndex = selectedIndex; else setSelectedIndex(selectedIndex.intValue()); }

          /**

          • @param selectedIndex
            */
            public void setSelectedIndex(int selectedIndex) {
            System.out.println("PanelTabSet.setSelectedIndex(i="selectedIndex")");
            ValueBinding vb = getValueBinding("selectedIndex");
            boolean worked = false;
            if(vb != null)
            Unknown macro: { try { vb.setValue(getFacesContext(), new Integer(selectedIndex)); System.out.println("PanelTabSet.setSelectedIndex() vb.setValue"); worked = true; } catch(Exception e) { worked = false; System.out.println("Problem: " + e); } }

            if(!worked)

            { _selectedIndex = new Integer(selectedIndex); System.out.println("PanelTabSet.setSelectedIndex() field set"); }

            }

          /**

          • @return the value of selectedIndex
            */
            public int getSelectedIndex()
            Unknown macro: { if (_selectedIndex != null) { System.out.println("PanelTabSet.getSelectedIndex() field get"); return _selectedIndex.intValue(); } ValueBinding vb = getValueBinding("selectedIndex"); System.out.println("PanelTabSet.getSelectedIndex() vb}
          Show
          Judy Guglielmin added a comment - Seam has problem with component-binding unless the bean is session-scoped. (not practical). So to use value binding, the selectedIndex has to have value binding available to selectedIndex property. would be nice to have the option to use valueBinding for this property for ease of use with seam (as well as MVC) Mark's adhoc fixes worked great and simplified the Bean & xhtml page immensely when he modified the getters and setters of com.icesoft.faces.component.paneltabset as follows:- /** @param selectedIndex */ void setSelectedIndex(Integer selectedIndex) { System.out.println("PanelTabSet.setSelectedIndex(I="+selectedIndex+")"); if(selectedIndex == null) _selectedIndex = selectedIndex; else setSelectedIndex(selectedIndex.intValue()); } /** @param selectedIndex */ public void setSelectedIndex(int selectedIndex) { System.out.println("PanelTabSet.setSelectedIndex(i=" selectedIndex ")"); ValueBinding vb = getValueBinding("selectedIndex"); boolean worked = false; if(vb != null) Unknown macro: { try { vb.setValue(getFacesContext(), new Integer(selectedIndex)); System.out.println("PanelTabSet.setSelectedIndex() vb.setValue"); worked = true; } catch(Exception e) { worked = false; System.out.println("Problem: " + e); } } if(!worked) { _selectedIndex = new Integer(selectedIndex); System.out.println("PanelTabSet.setSelectedIndex() field set"); } } /** @return the value of selectedIndex */ public int getSelectedIndex() Unknown macro: { if (_selectedIndex != null) { System.out.println("PanelTabSet.getSelectedIndex() field get"); return _selectedIndex.intValue(); } ValueBinding vb = getValueBinding("selectedIndex"); System.out.println("PanelTabSet.getSelectedIndex() vb}
          Hide
          Mark Collette added a comment -

          I moved the behaviour of the settable property out into its own class, called UpdatableProperty, which encalsulates the behaviour of getting the value locally and through a ValueBinding, as well as setting the value locally, and setting it on the ValueBinding in the UPDATE_MODEL phase.

          For ICEfaces 1.7 DR3 I've updated the component-showcase sample to use the simplified method without any listener glue code. We've left the ICEfaces 1.6.2 component-showcase alone, although you could do the exact same technique there as well. In fact, Judy is updating the Seam component-showcase application, that relies on ICEfaces 1.6.2, to use this technique, so we won't need any component bindings.

          ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events
          Subversion 15045
          icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java
          icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java
          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java
          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java
          icefaces\component\src\com\icesoft\faces\resources\messages.properties
          icefaces\component\src\com\icesoft\faces\resources\messages_fr.properties

          ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events (update component-showcase)
          Subversion 15046
          icefaces\samples\component-showcase\web\inc\layoutPanels\panelTabSet.jspx
          icefaces\samples\component-showcase\src\com\icesoft\icefaces\samples\showcase\layoutPanels\tabSetPanel\StaticTabSetBean.java
          icefaces\samples\component-showcase\src\com\icesoft\icefaces\samples\showcase\layoutPanels\tabSetPanel\DynamicTabSetBean.java

          Backport to 1.6.2 : ICE-2124
          svn merge -r 15044:15045 http://server.ice:8888/svn/ossrepo/icefaces/trunk/icefaces
          icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java
          icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java
          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java
          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java
          icefaces\component\src\com\icesoft\faces\resources\messages.properties
          icefaces\component\src\com\icesoft\faces\resources\messages_fr.properties
          Committed revision 15047

          Show
          Mark Collette added a comment - I moved the behaviour of the settable property out into its own class, called UpdatableProperty, which encalsulates the behaviour of getting the value locally and through a ValueBinding, as well as setting the value locally, and setting it on the ValueBinding in the UPDATE_MODEL phase. For ICEfaces 1.7 DR3 I've updated the component-showcase sample to use the simplified method without any listener glue code. We've left the ICEfaces 1.6.2 component-showcase alone, although you could do the exact same technique there as well. In fact, Judy is updating the Seam component-showcase application, that relies on ICEfaces 1.6.2, to use this technique, so we won't need any component bindings. ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events Subversion 15045 icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java icefaces\component\src\com\icesoft\faces\resources\messages.properties icefaces\component\src\com\icesoft\faces\resources\messages_fr.properties ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events (update component-showcase) Subversion 15046 icefaces\samples\component-showcase\web\inc\layoutPanels\panelTabSet.jspx icefaces\samples\component-showcase\src\com\icesoft\icefaces\samples\showcase\layoutPanels\tabSetPanel\StaticTabSetBean.java icefaces\samples\component-showcase\src\com\icesoft\icefaces\samples\showcase\layoutPanels\tabSetPanel\DynamicTabSetBean.java Backport to 1.6.2 : ICE-2124 svn merge -r 15044:15045 http://server.ice:8888/svn/ossrepo/icefaces/trunk/icefaces icefaces\component\src\com\icesoft\faces\utils\MessageUtils.java icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java icefaces\component\src\com\icesoft\faces\resources\messages.properties icefaces\component\src\com\icesoft\faces\resources\messages_fr.properties Committed revision 15047
          Hide
          Mark Collette added a comment -

          Found an issue where we need to keep the pre-decode selectedIndex available throughout all the pre-render phases, while the new selectedIndex is being properly updated, so that the phase notification forwarding, that's supposed to be recursed into the panelTabSet's children, will still go to the proper ones, in the pre-decode selectedIndex tab.

          ICEfaces 1.6.2 branch commit: Subversion 15085

          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java
          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java
          icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java

          Show
          Mark Collette added a comment - Found an issue where we need to keep the pre-decode selectedIndex available throughout all the pre-render phases, while the new selectedIndex is being properly updated, so that the phase notification forwarding, that's supposed to be recursed into the panelTabSet's children, will still go to the proper ones, in the pre-decode selectedIndex tab. ICEfaces 1.6.2 branch commit: Subversion 15085 icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java
          Hide
          Mark Collette added a comment -

          Trunk commit: Subversion 15090.

          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java
          icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java
          icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java

          Show
          Mark Collette added a comment - Trunk commit: Subversion 15090. icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSetRenderer.java icefaces\component\src\com\icesoft\faces\utils\UpdatableProperty.java
          Hide
          Mark Collette added a comment -

          I committed some more changes to this, in ICE-2187, to make it work in UISeries (panelSeries, dataTable) containers.

          Show
          Mark Collette added a comment - I committed some more changes to this, in ICE-2187 , to make it work in UISeries (panelSeries, dataTable) containers.

            People

            • Assignee:
              Unassigned
              Reporter:
              Philip Breau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: