You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jun Tsai <ju...@gmail.com> on 2007/05/28 05:11:41 UTC

@OnEvent not inherited in T5?

my parent page class had a method with annotations '@OnEvent'.but the
method is never called by child page class.


-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

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


Re: @OnEvent not inherited in T5?

Posted by Jun Tsai <ju...@gmail.com>.
2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
> That's very odd; based on how Tapestry instruments the code, that should
> automatically happen, even if @OnEvent is not inherited (which it isn't,
> only type annotation, not method annotations, can be inherited).
>

ComponentInstantiatorSourceImpl.java

169:

CtClass ctClass = pool.get(classname);

the ctClass don't have parent class methods.

javassist's bug?



-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

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


Re: @OnEvent not inherited in T5?

Posted by Jun Tsai <ju...@gmail.com>.
2007/5/29, Howard Lewis Ship <hl...@gmail.com>:
>
> You need to define them as a library, by making a contribution to the
> ComponentClassResolver service configuration.  You can model your
> contribution on the one for the core library:
>
> public static void
> contributeComponentClassResolver(Configuration<LibraryMapping>
> configuration)
>     {
>         configuration.add(new LibraryMapping("core", "
> org.apache.tapestry.corelib"));
>     }
>
> It is acceptable for your library to contain only a .base sub-package if
> that fits your needs.




Thanks ,my app works fine.

Jun Tsai

-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: @OnEvent not inherited in T5?

Posted by Howard Lewis Ship <hl...@gmail.com>.
You need to define them as a library, by making a contribution to the
ComponentClassResolver service configuration.  You can model your
contribution on the one for the core library:

 public static void
contributeComponentClassResolver(Configuration<LibraryMapping>
configuration)
    {
        configuration.add(new LibraryMapping("core", "
org.apache.tapestry.corelib"));
    }

It is acceptable for your library to contain only a .base sub-package if
that fits your needs.


On 5/28/07, Jun Tsai <ju...@gmail.com> wrote:
>
> 2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
> >
> > Classes that will be transformed must be segregated by package,
> otherwise
> > the class loader will attempt to transform non-components, such as JDK
> > classes and such.  Tapestry is under some constraints to do the
> > transformation at runtime (so as not to complicate the build/deploy
> > process)
> > and to do it incrementally (so as to not affect application start up
> time
> > for very large applications).
>
>
>
> I had a base project includes some base page classes.I want to use those
> base page classes in project 1,project2 and so on?how to do it?
>
> thanks.
>
> Jun Tsai
>
>
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
>
>
>
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: @OnEvent not inherited in T5?

Posted by Jun Tsai <ju...@gmail.com>.
2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
>
> Classes that will be transformed must be segregated by package, otherwise
> the class loader will attempt to transform non-components, such as JDK
> classes and such.  Tapestry is under some constraints to do the
> transformation at runtime (so as not to complicate the build/deploy
> process)
> and to do it incrementally (so as to not affect application start up time
> for very large applications).



I had a base project includes some base page classes.I want to use those
base page classes in project 1,project2 and so on?how to do it?

thanks.

Jun Tsai


>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>



-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: @OnEvent not inherited in T5?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Classes that will be transformed must be segregated by package, otherwise
the class loader will attempt to transform non-components, such as JDK
classes and such.  Tapestry is under some constraints to do the
transformation at runtime (so as not to complicate the build/deploy process)
and to do it incrementally (so as to not affect application start up time
for very large applications).

On 5/28/07, Jun Tsai <ju...@gmail.com> wrote:
>
> 2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
> >
> > Very good.
> >
> > Also in terms of the choice of Javassist methods: super-class event
> > handler
> > methods are recognized when the super-class itself is enhanced.  That's
> > why
> > there's a "com.foo.example.app.base" package ... for base classes to
> pages
> > and components.
>
>
>
> I think  'com.foo.example.app.base"  base classes package is not a good
> idea,because some base page classes not in the base package.why not
> instruments the parent class directly?
>
>
>
> --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
>
>
>
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: @OnEvent not inherited in T5?

Posted by Jun Tsai <ju...@gmail.com>.
2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
>
> Very good.
>
> Also in terms of the choice of Javassist methods: super-class event
> handler
> methods are recognized when the super-class itself is enhanced.  That's
> why
> there's a "com.foo.example.app.base" package ... for base classes to pages
> and components.



I think  'com.foo.example.app.base"  base classes package is not a good
idea,because some base page classes not in the base package.why not
instruments the parent class directly?



--
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>



-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: @OnEvent not inherited in T5?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Very good.

Also in terms of the choice of Javassist methods: super-class event handler
methods are recognized when the super-class itself is enhanced.  That's why
there's a "com.foo.example.app.base" package ... for base classes to pages
and components.

On 5/28/07, Alexandru Dragomir <al...@gmail.com> wrote:
>
> You are using Any component.
>
> To trigger the event onActionFromDosmthng you should use the component
> ActionLink.
>
> <a t:type="actionlink" t:id="dosmthng" >Do something</a>
>
>
>
> On 5/28/07, Eugene Lozovan <eu...@gmail.com> wrote:
> >
> > Actually, I've got similar issue:
> > HTML- template contains
> >            <input type="button" t:type="Any" t:id="dosmthng"
> > value="DoSmthng"/>
> >
> > page-class contains:
> >   String onActionFromDosmthng(){
> >         return "Start";
> >     }
> >
> > Click on the button doesn't entail call of onActionFromDosmthng()
> >
> > Thanks,
> > E.L.
> >
> >
> > On 28/05/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > >
> > > That's very odd; based on how Tapestry instruments the code, that
> should
> > > automatically happen, even if @OnEvent is not inherited (which it
> isn't,
> > > only type annotation, not method annotations, can be inherited).
> > >
> > > On 5/27/07, Jun Tsai <ju...@gmail.com> wrote:
> > > >
> > > > my parent page class had a method with annotations '@OnEvent'.but
> the
> > > > method is never called by child page class.
> > > >
> > > >
> > > > --
> > > > Welcome to China Java Users Group(CNJUG).
> > > > http://cnjug.dev.java.net
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > > TWD Consulting, Inc.
> > > Independent J2EE / Open-Source Java Consultant
> > > Creator and PMC Chair, Apache Tapestry
> > > Creator, Apache HiveMind
> > >
> > > Professional Tapestry training, mentoring, support
> > > and project work.  http://howardlewisship.com
> > >
> >
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: @OnEvent not inherited in T5?

Posted by Alexandru Dragomir <al...@gmail.com>.
You are using Any component.

To trigger the event onActionFromDosmthng you should use the component
ActionLink.

<a t:type="actionlink" t:id="dosmthng" >Do something</a>



On 5/28/07, Eugene Lozovan <eu...@gmail.com> wrote:
>
> Actually, I've got similar issue:
> HTML- template contains
>            <input type="button" t:type="Any" t:id="dosmthng"
> value="DoSmthng"/>
>
> page-class contains:
>   String onActionFromDosmthng(){
>         return "Start";
>     }
>
> Click on the button doesn't entail call of onActionFromDosmthng()
>
> Thanks,
> E.L.
>
>
> On 28/05/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> >
> > That's very odd; based on how Tapestry instruments the code, that should
> > automatically happen, even if @OnEvent is not inherited (which it isn't,
> > only type annotation, not method annotations, can be inherited).
> >
> > On 5/27/07, Jun Tsai <ju...@gmail.com> wrote:
> > >
> > > my parent page class had a method with annotations '@OnEvent'.but the
> > > method is never called by child page class.
> > >
> > >
> > > --
> > > Welcome to China Java Users Group(CNJUG).
> > > http://cnjug.dev.java.net
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
>

Re: @OnEvent not inherited in T5?

Posted by Eugene Lozovan <eu...@gmail.com>.
Actually, I've got similar issue:
HTML- template contains
           <input type="button" t:type="Any" t:id="dosmthng"
value="DoSmthng"/>

page-class contains:
  String onActionFromDosmthng(){
        return "Start";
    }

Click on the button doesn't entail call of onActionFromDosmthng()

Thanks,
E.L.


On 28/05/07, Howard Lewis Ship <hl...@gmail.com> wrote:
>
> That's very odd; based on how Tapestry instruments the code, that should
> automatically happen, even if @OnEvent is not inherited (which it isn't,
> only type annotation, not method annotations, can be inherited).
>
> On 5/27/07, Jun Tsai <ju...@gmail.com> wrote:
> >
> > my parent page class had a method with annotations '@OnEvent'.but the
> > method is never called by child page class.
> >
> >
> > --
> > Welcome to China Java Users Group(CNJUG).
> > http://cnjug.dev.java.net
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>

Re: @OnEvent not inherited in T5?

Posted by Jun Tsai <ju...@gmail.com>.
2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
> That's very odd; based on how Tapestry instruments the code, that should
> automatically happen, even if @OnEvent is not inherited (which it isn't,
> only type annotation, not method annotations, can be inherited).
>



In javassist javadoc pages:



public CtMethod[] getDeclaredMethods()

    Gets all methods declared in the class. The inherited methods are not
included.

So In InternalClassTransformationImpl ,the method:
public List<MethodSignature> findMethods(MethodFilter filter){
 ....

for (CtMethod method : _ctClass.getDeclaredMethods())
}


had a wrong method collection.

I think it use CtClass.getMethods().

getMethods

public CtMethod
<http://www.csg.is.titech.ac.jp/%7Echiba/javassist/html/javassist/CtMethod.html>[]
*getMethods*()

Returns an array containing CtMethod objects representing all the
non-private methods of the class. That array includes pon-private methods
inherited from the superclasses.




Jun Tsai
-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: @OnEvent not inherited in T5?

Posted by Howard Lewis Ship <hl...@gmail.com>.
That's very odd; based on how Tapestry instruments the code, that should
automatically happen, even if @OnEvent is not inherited (which it isn't,
only type annotation, not method annotations, can be inherited).

On 5/27/07, Jun Tsai <ju...@gmail.com> wrote:
>
> my parent page class had a method with annotations '@OnEvent'.but the
> method is never called by child page class.
>
>
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com