[ 
https://issues.apache.org/jira/browse/TOMAHAWK-717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608597#action_12608597
 ] 

Leonardo Uribe commented on TOMAHAWK-717:
-----------------------------------------

This issue is the same of TOMAHAWK-153, so that issue was closed as duplicated.

The problem can be seen more cleary when you compare TabChangeListener and 
TabChangeEvent with ActionListener and ActionEvent. In the bottom the main 
difference is that TabChange trigger an action inside the current page (change 
tab), Action could trigger an action to the same page or others (handle 
navigation).

For each Tab in the TabbedPane, a button is rendered on top that submit the 
form (like h:commandButton). Suppose a user click on that button wanting to 
change the tab. When decode method is called for TabbedPane, a TabChangeEvent 
if queued, indicating the relative data. Then on broadcast method if a 
TabChangeEvent is detected, it is delivered to the registered 
TabChangeListeners and go to render response phase.

By default ALL TabChangeEvents are set activate on apply request values phase, 
in this way:

    public TabChangeEvent(UIComponent component, int oldTabIndex, int 
newTabIndex)
    {
        super(component);
        _oldTabIndex = oldTabIndex;
        _newTabIndex = newTabIndex;
        setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
    }

This is equivalent to a component like h:commandButton with immediate="true". 
The code is done on UICommand like this:

    public void queueEvent(FacesEvent event)
    {
        if (event != null && event instanceof ActionEvent)
        {
            if (isImmediate())
            {
                event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
            }
            else
            {
                event.setPhaseId(PhaseId.INVOKE_APPLICATION);
            }
        }
        super.queueEvent(event);
    }

Instead of write the phaseId inside the constructor, it should be better doing 
the same as UICommand, creating a property like immediateTabChange by default 
"true" to not break the old behavior.

I think that the change presented here (option 2 of Zdenek proposal, but 
written in more precise words) is the correct approach for handle this issue. 
So I'll apply it and close this issue.



> Tabbed Pane: dataModel inside tabs is not updated when switching between tabs 
> and coming back
> ---------------------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-717
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-717
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Tabbed Pane
>    Affects Versions: 1.1.3, 1.1.6
>            Reporter: Gerald Müllan
>
> I have worked several times with the tabbed pane component, but never got 
> aware of this bug. 
> There is a dataTable inside one tab and some new values were put in some 
> input components. After switching to another tab and coming back, the values 
> are gone and only the "old" ones are rendered out. This bug seems to be 
> actual since 1.1.3 and before.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to