[ 
https://issues.jboss.org/browse/RF-11054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669525#comment-12669525
 ] 

Jean ANDRE edited comment on RF-11054 at 2/24/12 12:43 PM:
-----------------------------------------------------------

Finally we get success in using the following code.

{code}
<h:graphicImage value="/images/closeButton.png"
           styleClass="closeButton"
              onclick="closeTab('#{tab.id}');event.stopPropagation();"
            immediate="true" />
{code}

{code}
<!--               -->
<!-- CLOSE TAB     -->
<!--               -->
<a4j:jsFunction id="closeTab" name="closeTab"
            action="#{desktopTabController.doCloseTab}"
            render="menu-opened-tabs,desktopTabPanel">
   <a4j:param name="tabId" assignTo="#{desktopTabController.closeTabId}" />
</a4j:jsFunction>
{code}

The function event.stopPropagation() instead of Event.stop(event).

The NPE is a contextual bug : it may depend on :
 - Having or not having set the activeItem
 - We have also return an Collections.unmodifiableCollection(xxx) of our 
dynamic tabs.
 - Race condition : because at the begin of the project, the same code trigger 
an NPE and now, it does not. So, is there an impact about having an empty 
dynamic tabs versus tabs with some content ? Deletion also triggers NPE in some 
circumstance (not all the time).

RichFaces should guide the users on how build robust dynamic tabs that supports 
also dynamic close/deletion. What are the best practices and what are the buggy 
scenarios. There is different ways to build dynamic tabs, some are better than 
other, some are better suitable for a specific situation than other and etc.

It would be good that richfaces give us the closeTab as a built-in feature and 
allow us to decide to close or not closing the tab based on the user context (I 
mean, user is editing some field, do we need to cancel the modification...)

 
                
      was (Author: jorelia64):
    Finally we get success in using the following code.

{code}
<h:graphicImage value="/images/closeButton.png"
           styleClass="closeButton"
              onclick="closeTab('#{tab.id}');event.stopPropagation();"
            immediate="true" />
{code}

{code}
<!--               -->
<!-- CLOSE TAB     -->
<!--               -->
<a4j:jsFunction id="closeTab" name="closeTab"
            action="#{desktopTabController.doCloseTab}"
            render="menu-opened-tabs,desktopTabPanel">
   <a4j:param name="tabId" assignTo="#{desktopTabController.closeTabId}" />
</a4j:jsFunction>
{code}

The function event.stopPropagation() instead of Event.stop(event).

The NPE is a contextual bug : it may depend on :
 - Having or not having set the activeItem
 - We have also return an Collections.unmodifiableCollection(xxx) of our 
dynamic tabs.
 - Race condition : because at the begin of the project, the same code trigger 
an NPE and now, it does not. So, is there an impact about having an empty 
dynamic tabs versus tabs with some content ?

RichFaces should guide the users on how build robust dynamic tabs that supports 
also dynamic close/deletion. What are the best practices and what are the buggy 
scenarios. There is different ways to build dynamic tabs, some are better than 
other, some are better suitable for a specific situation than other and etc.

It would be good that richfaces give us the closeTab as a built-in feature and 
allow us to decide to close or not closing the tab based on the user context (I 
mean, user is editing some field, do we need to cancel the modification...)

 
                  
> Dynamically created tabs within tabPanel causes NPE in getActiveItem()
> ----------------------------------------------------------------------
>
>                 Key: RF-11054
>                 URL: https://issues.jboss.org/browse/RF-11054
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: base functionality , component-panels-layout-themes
>    Affects Versions: 4.0.0.Final
>         Environment: RichFaces 4.1.0-SNAPSHOT r.22526
> Metamer r.22526
> Mojarra 2.0.4-b09
> Apache Tomcat 7.0.12
> Java(TM) SE Runtime Environment 1.6.0_19-b04 @ Linux
> Chrome 12.0.718.0 @ Linux i686
>            Reporter: Ján Jamrich
>             Fix For: 4.Future
>
>         Attachments: exception-on-tab-switch
>
>
> When set switchType on TabPanel to "server" (notice that with "client" 
> everything works correctly, with "ajax" tab switch not work as well as with 
> "null"), all dynamically created tabs causes NPE on tab switch.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to