You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sven Homburg <ho...@googlemail.com> on 2008/02/26 12:50:40 UTC

[T5] dont understand behaivior onActivate/onPrepareFromEditForm

senario:

a page contains al link like this

@Component(parameters = {"page=IssueEdit", "context=list:project.id, 0, 0"})
private PageLink _issueEditLink;

the IssueEdit page contains following methods

    public void onActivate(long ticketId)
    {
        if (getLogger().isInfoEnabled())
            getLogger().info("onActivate-ticketId");
    }

    public void onActivate(long projectId, long componentId, long ticketId)
    {
        if (getLogger().isInfoEnabled())
            getLogger().info("onActivate-ticketId-componentId-projectId");
    }

    @Override
    protected void onPrepareFromEditForm()
    {
        if (getLogger().isInfoEnabled())
            getLogger().info("onPrepareFromEditForm from page class");

        // call from super class AbstractBasePage
        super.onPrepareFromEditForm();
    }

and thats the logging output if i click the link described above;
2008-02-26 10:59:14,534 INFO  pages.IssueEdit -
onActivate-ticketId-componentId-projectId
2008-02-26 10:59:14,534 INFO  pages.IssueEdit - onActivate-ticketId
2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm from
page class
2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm
2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm from
page class
2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm

any suggestions?

-- 
with regards
Sven Homburg

Re: [T5] dont understand behaivior onActivate/onPrepareFromEditForm

Posted by Howard Lewis Ship <hl...@gmail.com>.
There are documented rules about order of method invocation with
respect to event handler methods.  Basically, don't call super();
Tapestry will be invoking super-class event handler methods for you.
I tend to make event handler methods on base classes final to remove
any ambiguity.

On Tue, Feb 26, 2008 at 9:16 AM, Josh Canfield <jo...@thedailytube.com> wrote:
> Hi Sven,
>
>  It's too much trouble to parse your message and try to figure out what your
>  question is. To get a helpful answer you should ask a clear and specific
>  question like "Why does X come after Y" or "Why is X called".
>
>  On a side note, the pattern of calling getLogger().isInfoEnabled() is
>  generally used to avoid the extra cost of building the message being logged
>  (concatenating many strings for instance). You aren't building a message so
>  you are essentially just adding noise to your source since the info method
>  only outputs your string if info is enabled.
>
>  Josh
>  On Tue, Feb 26, 2008 at 3:50 AM, Sven Homburg <ho...@googlemail.com>
>  wrote:
>
>
>
>  > senario:
>  >
>  > a page contains al link like this
>  >
>  > @Component(parameters = {"page=IssueEdit", "context=list:project.id, 0,
>  > 0"})
>  > private PageLink _issueEditLink;
>  >
>  > the IssueEdit page contains following methods
>  >
>  >    public void onActivate(long ticketId)
>  >    {
>  >        if (getLogger().isInfoEnabled())
>  >            getLogger().info("onActivate-ticketId");
>  >    }
>  >
>  >    public void onActivate(long projectId, long componentId, long ticketId)
>  >    {
>  >        if (getLogger().isInfoEnabled())
>  >            getLogger().info("onActivate-ticketId-componentId-projectId");
>  >    }
>  >
>  >    @Override
>  >    protected void onPrepareFromEditForm()
>  >    {
>  >        if (getLogger().isInfoEnabled())
>  >            getLogger().info("onPrepareFromEditForm from page class");
>  >
>  >        // call from super class AbstractBasePage
>  >        super.onPrepareFromEditForm();
>  >    }
>  >
>  > and thats the logging output if i click the link described above;
>  > 2008-02-26 10:59:14,534 INFO  pages.IssueEdit -
>  > onActivate-ticketId-componentId-projectId
>  > 2008-02-26 10:59:14,534 INFO  pages.IssueEdit - onActivate-ticketId
>  > 2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm from
>  > page class
>  > 2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm
>  > 2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm from
>  > page class
>  > 2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm
>  >
>  > any suggestions?
>  >
>  > --
>  > with regards
>  > Sven Homburg
>  >
>
>
>
>  --
>  --
>  TheDailyTube.com. Sign up and get the best new videos on the internet
>  delivered fresh to your inbox.
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: [T5] dont understand behaivior onActivate/onPrepareFromEditForm

Posted by Sven Homburg <ho...@googlemail.com>.
about side note:
good hint, thanx

2008/2/26, Josh Canfield <jo...@thedailytube.com>:
>
> Hi Sven,
>
> It's too much trouble to parse your message and try to figure out what
> your
> question is. To get a helpful answer you should ask a clear and specific
> question like "Why does X come after Y" or "Why is X called".
>
> On a side note, the pattern of calling getLogger().isInfoEnabled() is
> generally used to avoid the extra cost of building the message being
> logged
> (concatenating many strings for instance). You aren't building a message
> so
> you are essentially just adding noise to your source since the info method
> only outputs your string if info is enabled.
>
> Josh
> On Tue, Feb 26, 2008 at 3:50 AM, Sven Homburg <ho...@googlemail.com>
> wrote:
>
>
> > senario:
> >
> > a page contains al link like this
> >
> > @Component(parameters = {"page=IssueEdit", "context=list:project.id, 0,
> > 0"})
> > private PageLink _issueEditLink;
> >
> > the IssueEdit page contains following methods
> >
> >    public void onActivate(long ticketId)
> >    {
> >        if (getLogger().isInfoEnabled())
> >            getLogger().info("onActivate-ticketId");
> >    }
> >
> >    public void onActivate(long projectId, long componentId, long
> ticketId)
> >    {
> >        if (getLogger().isInfoEnabled())
>
> >            getLogger().info("onActivate-ticketId-componentId-projectId");
> >    }
> >
> >    @Override
> >    protected void onPrepareFromEditForm()
> >    {
> >        if (getLogger().isInfoEnabled())
> >            getLogger().info("onPrepareFromEditForm from page class");
> >
> >        // call from super class AbstractBasePage
> >        super.onPrepareFromEditForm();
> >    }
> >
> > and thats the logging output if i click the link described above;
> > 2008-02-26 10:59:14,534 INFO  pages.IssueEdit -
> > onActivate-ticketId-componentId-projectId
> > 2008-02-26 10:59:14,534 INFO  pages.IssueEdit - onActivate-ticketId
> > 2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm
> from
> > page class
> > 2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm
> > 2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm
> from
> > page class
> > 2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm
> >
> > any suggestions?
> >
> > --
> > with regards
> > Sven Homburg
> >
>
>
>
>
> --
>
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>



-- 
with regards
Sven Homburg

Re: [T5] dont understand behaivior onActivate/onPrepareFromEditForm

Posted by Josh Canfield <jo...@thedailytube.com>.
Hi Sven,

It's too much trouble to parse your message and try to figure out what your
question is. To get a helpful answer you should ask a clear and specific
question like "Why does X come after Y" or "Why is X called".

On a side note, the pattern of calling getLogger().isInfoEnabled() is
generally used to avoid the extra cost of building the message being logged
(concatenating many strings for instance). You aren't building a message so
you are essentially just adding noise to your source since the info method
only outputs your string if info is enabled.

Josh
On Tue, Feb 26, 2008 at 3:50 AM, Sven Homburg <ho...@googlemail.com>
wrote:

> senario:
>
> a page contains al link like this
>
> @Component(parameters = {"page=IssueEdit", "context=list:project.id, 0,
> 0"})
> private PageLink _issueEditLink;
>
> the IssueEdit page contains following methods
>
>    public void onActivate(long ticketId)
>    {
>        if (getLogger().isInfoEnabled())
>            getLogger().info("onActivate-ticketId");
>    }
>
>    public void onActivate(long projectId, long componentId, long ticketId)
>    {
>        if (getLogger().isInfoEnabled())
>            getLogger().info("onActivate-ticketId-componentId-projectId");
>    }
>
>    @Override
>    protected void onPrepareFromEditForm()
>    {
>        if (getLogger().isInfoEnabled())
>            getLogger().info("onPrepareFromEditForm from page class");
>
>        // call from super class AbstractBasePage
>        super.onPrepareFromEditForm();
>    }
>
> and thats the logging output if i click the link described above;
> 2008-02-26 10:59:14,534 INFO  pages.IssueEdit -
> onActivate-ticketId-componentId-projectId
> 2008-02-26 10:59:14,534 INFO  pages.IssueEdit - onActivate-ticketId
> 2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm from
> page class
> 2008-02-26 10:59:14,706 INFO  pages.IssueEdit - onPrepareFromEditForm
> 2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm from
> page class
> 2008-02-26 10:59:14,722 INFO  pages.IssueEdit - onPrepareFromEditForm
>
> any suggestions?
>
> --
> with regards
> Sven Homburg
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.