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

          Philip Breau created issue -
          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}
          Ken Fyten made changes -
          Field Original Value New Value
          Fix Version/s 1.6.2 [ 10111 ]
          Assignee Priority P3
          Assignee Mark Collette [ mark.collette ]
          Michael Thiem made changes -
          Mark Collette made changes -
          Fix Version/s 1.7DR#3 [ 10112 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15045 Mon Oct 29 19:39:12 MDT 2007 mark.collette ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSetRenderer.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/resources/messages.properties
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/resources/messages_fr.properties
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/utils/MessageUtils.java
          Commit graph ADD /icefaces/trunk/icefaces/component/src/com/icesoft/faces/utils/UpdatableProperty.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15046 Mon Oct 29 19:52:07 MDT 2007 mark.collette ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events (update component-showcase)
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/web/inc/layoutPanels/panelTabSet.jspx
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/src/com/icesoft/icefaces/samples/showcase/layoutPanels/tabSetPanel/StaticTabSetBean.java
          Commit graph MODIFY /icefaces/trunk/icefaces/samples/component-showcase/src/com/icesoft/icefaces/samples/showcase/layoutPanels/tabSetPanel/DynamicTabSetBean.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15047 Mon Oct 29 20:08:25 MDT 2007 mark.collette Backport to 1.6.2 : ICE-2124
          Files Changed
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSetRenderer.java
          Commit graph ADD /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/utils/UpdatableProperty.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/utils/MessageUtils.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/resources/messages.properties
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/resources/messages_fr.properties
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java
          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
          Mark Collette made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Mark Collette made changes -
          Link This issue is duplicated by ICE-2187 [ ICE-2187 ]
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Priority P3 P1
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15085 Fri Nov 02 11:51:47 MDT 2007 mark.collette ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events
          Files Changed
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSetRenderer.java
          Commit graph REPLACE /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/utils/UpdatableProperty.java
          Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java
          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
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #15090 Fri Nov 02 17:41:20 MDT 2007 mark.collette ICE-2124 : PanelTabSet doesn't sync bound selectedIndex on tabChange events
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSetRenderer.java
          Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/paneltabset/PanelTabSet.java
          Commit graph MODIFY /icefaces/trunk/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
          Mark Collette made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          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.
          Ken Fyten made changes -
          Fix Version/s 1.7 [ 10080 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P1
          Assignee Mark Collette [ mark.collette ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: