You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org> on 2006/09/20 21:14:25 UTC
[jira] Resolved: (TOMAHAWK-582) Implementation of the
TabChangeListenerTag prevents the use of IOC
[ http://issues.apache.org/jira/browse/TOMAHAWK-582?page=all ]
Martin Marinschek resolved TOMAHAWK-582.
----------------------------------------
Fix Version/s: 1.1.4-SNAPSHOT
Resolution: Fixed
Assignee: Martin Marinschek
Thanks to Tomasz Stanczak for providing this patch.
regards,
Martin
> Implementation of the TabChangeListenerTag prevents the use of IOC
> ------------------------------------------------------------------
>
> Key: TOMAHAWK-582
> URL: http://issues.apache.org/jira/browse/TOMAHAWK-582
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Components: Tabbed Pane
> Affects Versions: 1.1.3
> Environment: Windows 2000 SP4, JBoss 4.0.3
> Reporter: Tomasz Stanczak
> Assigned To: Martin Marinschek
> Fix For: 1.1.4-SNAPSHOT
>
>
> The TabChangeListenerTag class in its current implementation creates always a new instance of the application's TabChangeListener implementation. Thus you cannot provide a preinitialized instance - for example a request configured in faces-config.xml or a Spring bean. Instance reuse is not possible.
> It wants a classname of the TabChangeListener implementation class and creates an instance. Even given a JSF expression it doesn't get the instance pointed to by the expression but interprets the expression result as a class name to be instantiated:
> String className;
> if (UIComponentTag.isValueReference(type))
> {
> FacesContext facesContext = FacesContext.getCurrentInstance();
> ValueBinding valueBinding = facesContext.getApplication().createValueBinding(type);
> className = (String) valueBinding.getValue(facesContext);
> } else
> {
> className = type;
> }
> TabChangeListener listener = (TabChangeListener) ClassUtils.newInstance(className);
> ((HtmlPanelTabbedPane) component).addTabChangeListener(listener);
> It could be made better by using something like that:
> Object refValue = valueBinding.getValue(facesContext);
> if (refValue instanceof TabChangeListener) {
> // use the instance found as listener
> } else {
> // use the instance found as a class name to be instantiated
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira