You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/08/09 17:28:36 UTC

[jira] Closed: (TAPESTRY-539) Abstract properties (without a element) do not clear out their values

     [ http://issues.apache.org/jira/browse/TAPESTRY-539?page=all ]
     
Howard M. Lewis Ship closed TAPESTRY-539:
-----------------------------------------

    Fix Version: 4.0
     Resolution: Fixed
      Assign To: Howard M. Lewis Ship

> Abstract properties (without a <property> element) do not clear out their values
> --------------------------------------------------------------------------------
>
>          Key: TAPESTRY-539
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-539
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>     Assignee: Howard M. Lewis Ship
>     Priority: Blocker
>      Fix For: 4.0

>
> When a property is created by the AbstractPropertyWorker, it fails to add the code to register the instance as a PageDetachListener.
> Discussions on the tapestry-user mailing list indicate that when there are <property> elements in the XML, things work properly.
> ComponentConstructorFactory [DEBUG] Creating class:
> ClassFab[
> public class $Data_4 extends pages.Data
>   implements org.apache.tapestry.event.PageDetachListener
> private org.apache.tapestry.services.ComponentMessagesSource _$componentMessagesSource;
> private org.apache.hivemind.Messages _$messages;
> private org.apache.tapestry.spec.IComponentSpecification _$specification;
> private java.lang.String _$userId;
> private java.lang.String _$userId$defaultValue;
> public $Data_4(org.apache.tapestry.services.ComponentMessagesSource $1, org.apache.tapestry.spec.IComponentSpecification $2)
> {
>   _$componentMessagesSource = $1;
>   _$specification = $2;
> }
> public java.lang.String getUserId()
> return _$userId;
> public org.apache.tapestry.spec.IComponentSpecification getSpecification()
> return _$specification;
> public void finishLoad(org.apache.tapestry.IRequestCycle $1, org.apache.tapestry.engine.IPageLoader $2, org.apache.tapestry.spec.IComponentSpecification $3)
> {
>   super.finishLoad($$);
>   getPage().addPageAttachListener(this);
>   _$userId$defaultValue = _$userId;
> }
> public void setUserId(java.lang.String $1)
> _$userId = $1;
> public org.apache.hivemind.Messages getMessages()
> {
>   if (_$messages == null)
>     _$messages = _$componentMessagesSource.getMessages(this);
>   return _$messages;
> }
> public void pageDetached(org.apache.tapestry.event.PageEvent $1)
> {
>   _$userId = _$userId$defaultValue;
> }
> ]
> This code was generated form the following class:
> package pages;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.tapestry.event.PageAttachListener;
> import org.apache.tapestry.event.PageEvent;
> import org.apache.tapestry.html.BasePage;
> public abstract class Data extends BasePage implements PageAttachListener
> {
>     private static final Log LOG = LogFactory.getLog(Data.class);
>     public abstract String getUserId();
>     public abstract void setUserId(String userId);
>     public void doSetValues()
>     {
>         LOG.info("doSetValues()");
>         setUserId("Howard");
>     }
>     public void pageAttached(PageEvent event)
>     {
>         LOG.info("pageAttached(): userId=" + getUserId());
>     }
> }
> Note:  there should be code inside the finishLoad() implementation to register the page (with itself) as a pageDetachListener.
> I think I know the reason for this!
> The AbstractPropertyWorker is run LAST.  So although it adds the PageDetachListener interface to the class, but executes AFTER the code that "sniffs" for interfaces and adds associated event registration code.  The worker for <property> elements works earlier than the InjectPageDetachListener worker.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org