You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Robert J. Walker" <rw...@mshare.net> on 2007/06/06 19:30:06 UTC
T4 overriding properties unnecessarily?
I have an application that allows users to sign up for our service. One thing the application needs to do is determine whether it needs to continue to the next page or if it has enough information already. For example, some of our clients pay for some or all of the service at the corporate level. If a franchisee signs up for service that is completely paid by corporate, we can stop before asking for their payment info.
So there's an abstract base class for all the pages called SignupPage which has an abstract method called isFinished(). This method should return true if the "FINISH" button should be shown on this page instead of the "Next" button. The individual page classes implement the isFinished() method with whatever logic is needed to determine whether or not the user is finished on that page.
So here's the problem: In the case above, if I put a breakpoint in my page's implementation of the isFinished() method, it never gets hit. A little reflection reveals that Tapestry is overriding the page class's implementation of the isFinished() method with one of its own which is always returning false, resulting in the application asking for payment information from users who don't owe anything.
Making my implementation of isFinished() final results in a VerifyError when I hit the page. If I instead make my implementation class non-abstract, my IDE complains that I haven't implemented the clientId property, which to my understanding is supposed to be provided by Tapestry. The Locations.page file does not declare finished as a property or even mention it.
So the questions are: 1) Why is Tapestry creating an implementation of this method when one already exists, and 2) how do I make it stop? Relevant bits of code follow.
Thanks,
Robert J. Walker
SignupPage.java
public abstract class SignupPage extends BasePage {
...
public abstract boolean isFinished();
...
}
_____
Locations.java (one of several pages which extend SignupPage)
public abstract class Locations extends SignupPage {
...
public boolean isFinished() {
// My logic goes here; this never gets executed
}
...
}
_____
Locations.html
...
<div jwcid="@If" condition="ognl:finished">
<!-- Finish button -->
</div>
<div jwcid="@Else">
<!-- Next button -->
</div>
...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: T4 overriding properties unnecessarily?
Posted by "Robert J. Walker" <rw...@mshare.net>.
Done. Here's the link to the JIRA issue.
https://issues.apache.org/jira/browse/TAPESTRY-1545
Robert J. Walker
-----Original Message-----
From: Jesse Kuhnert [mailto:jkuhnert@gmail.com]
Sent: Wednesday, June 06, 2007 4:38 PM
To: Tapestry users
Subject: Re: T4 overriding properties unnecessarily?
I think there is no explanation other than it being a bug. None that come
to mind at least.
If you log a jira issue it can be addressed.
On 6/6/07, Robert J. Walker <rw...@mshare.net> wrote:
>
> That did the trick. Thanks you, Christian.
>
> So that answers the question of how to get around the problem, but I still
> want to understand why this happens. Is this a bug or desired behavior? If
> the latter, why is it desired?
>
> Robert J. Walker
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4 overriding properties unnecessarily?
Posted by Jesse Kuhnert <jk...@gmail.com>.
I think there is no explanation other than it being a bug. None that come
to mind at least.
If you log a jira issue it can be addressed.
On 6/6/07, Robert J. Walker <rw...@mshare.net> wrote:
>
> That did the trick. Thanks you, Christian.
>
> So that answers the question of how to get around the problem, but I still
> want to understand why this happens. Is this a bug or desired behavior? If
> the latter, why is it desired?
>
> Robert J. Walker
>
> -----Original Message-----
> From: Christian Dutaret [mailto:cdtapestry@gmail.com]
> Sent: Wednesday, June 06, 2007 12:48 PM
> To: Tapestry users
> Subject: Re: T4 overriding properties unnecessarily?
>
>
> i'd try to make isFinished() non-abstract in the SignupPage, and have it
> throw a runtime exception to make sure the base class implementation is
> never called
>
> 2007/6/6, Robert J. Walker <rw...@mshare.net>:
> >
> > I have an application that allows users to sign up for our service. One
> > thing the application needs to do is determine whether it needs to
> continue
> > to the next page or if it has enough information already. For example,
> some
> > of our clients pay for some or all of the service at the corporate
> level. If
> > a franchisee signs up for service that is completely paid by corporate,
> we
> > can stop before asking for their payment info.
> >
> > So there's an abstract base class for all the pages called SignupPage
> > which has an abstract method called isFinished(). This method should
> return
> > true if the "FINISH" button should be shown on this page instead of the
> > "Next" button. The individual page classes implement the isFinished()
> method
> > with whatever logic is needed to determine whether or not the user is
> > finished on that page.
> >
> > So here's the problem: In the case above, if I put a breakpoint in my
> > page's implementation of the isFinished() method, it never gets hit. A
> > little reflection reveals that Tapestry is overriding the page class's
> > implementation of the isFinished() method with one of its own which is
> > always returning false, resulting in the application asking for payment
> > information from users who don't owe anything.
> >
> > Making my implementation of isFinished() final results in a VerifyError
> > when I hit the page. If I instead make my implementation class
> non-abstract,
> > my IDE complains that I haven't implemented the clientId property, which
> to
> > my understanding is supposed to be provided by Tapestry. The
> > Locations.page file does not declare finished as a property or even
> > mention it.
> >
> > So the questions are: 1) Why is Tapestry creating an implementation of
> > this method when one already exists, and 2) how do I make it stop?
> Relevant
> > bits of code follow.
> >
> > Thanks,
> >
> > Robert J. Walker
> >
> >
> > SignupPage.java
> > public abstract class SignupPage extends BasePage {
> > ...
> > public abstract boolean isFinished();
> > ...
> > }
> > _____
> >
> > Locations.java (one of several pages which extend SignupPage)
> > public abstract class Locations extends SignupPage {
> > ...
> > public boolean isFinished() {
> > // My logic goes here; this never gets executed
> > }
> > ...
> > }
> > _____
> >
> > Locations.html
> > ...
> > <div jwcid="@If" condition="ognl:finished">
> > <!-- Finish button -->
> > </div>
> > <div jwcid="@Else">
> > <!-- Next button -->
> > </div>
> > ...
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
RE: T4 overriding properties unnecessarily?
Posted by "Robert J. Walker" <rw...@mshare.net>.
That did the trick. Thanks you, Christian.
So that answers the question of how to get around the problem, but I still want to understand why this happens. Is this a bug or desired behavior? If the latter, why is it desired?
Robert J. Walker
-----Original Message-----
From: Christian Dutaret [mailto:cdtapestry@gmail.com]
Sent: Wednesday, June 06, 2007 12:48 PM
To: Tapestry users
Subject: Re: T4 overriding properties unnecessarily?
i'd try to make isFinished() non-abstract in the SignupPage, and have it
throw a runtime exception to make sure the base class implementation is
never called
2007/6/6, Robert J. Walker <rw...@mshare.net>:
>
> I have an application that allows users to sign up for our service. One
> thing the application needs to do is determine whether it needs to continue
> to the next page or if it has enough information already. For example, some
> of our clients pay for some or all of the service at the corporate level. If
> a franchisee signs up for service that is completely paid by corporate, we
> can stop before asking for their payment info.
>
> So there's an abstract base class for all the pages called SignupPage
> which has an abstract method called isFinished(). This method should return
> true if the "FINISH" button should be shown on this page instead of the
> "Next" button. The individual page classes implement the isFinished() method
> with whatever logic is needed to determine whether or not the user is
> finished on that page.
>
> So here's the problem: In the case above, if I put a breakpoint in my
> page's implementation of the isFinished() method, it never gets hit. A
> little reflection reveals that Tapestry is overriding the page class's
> implementation of the isFinished() method with one of its own which is
> always returning false, resulting in the application asking for payment
> information from users who don't owe anything.
>
> Making my implementation of isFinished() final results in a VerifyError
> when I hit the page. If I instead make my implementation class non-abstract,
> my IDE complains that I haven't implemented the clientId property, which to
> my understanding is supposed to be provided by Tapestry. The
> Locations.page file does not declare finished as a property or even
> mention it.
>
> So the questions are: 1) Why is Tapestry creating an implementation of
> this method when one already exists, and 2) how do I make it stop? Relevant
> bits of code follow.
>
> Thanks,
>
> Robert J. Walker
>
>
> SignupPage.java
> public abstract class SignupPage extends BasePage {
> ...
> public abstract boolean isFinished();
> ...
> }
> _____
>
> Locations.java (one of several pages which extend SignupPage)
> public abstract class Locations extends SignupPage {
> ...
> public boolean isFinished() {
> // My logic goes here; this never gets executed
> }
> ...
> }
> _____
>
> Locations.html
> ...
> <div jwcid="@If" condition="ognl:finished">
> <!-- Finish button -->
> </div>
> <div jwcid="@Else">
> <!-- Next button -->
> </div>
> ...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4 overriding properties unnecessarily?
Posted by Christian Dutaret <cd...@gmail.com>.
i'd try to make isFinished() non-abstract in the SignupPage, and have it
throw a runtime exception to make sure the base class implementation is
never called
2007/6/6, Robert J. Walker <rw...@mshare.net>:
>
> I have an application that allows users to sign up for our service. One
> thing the application needs to do is determine whether it needs to continue
> to the next page or if it has enough information already. For example, some
> of our clients pay for some or all of the service at the corporate level. If
> a franchisee signs up for service that is completely paid by corporate, we
> can stop before asking for their payment info.
>
> So there's an abstract base class for all the pages called SignupPage
> which has an abstract method called isFinished(). This method should return
> true if the "FINISH" button should be shown on this page instead of the
> "Next" button. The individual page classes implement the isFinished() method
> with whatever logic is needed to determine whether or not the user is
> finished on that page.
>
> So here's the problem: In the case above, if I put a breakpoint in my
> page's implementation of the isFinished() method, it never gets hit. A
> little reflection reveals that Tapestry is overriding the page class's
> implementation of the isFinished() method with one of its own which is
> always returning false, resulting in the application asking for payment
> information from users who don't owe anything.
>
> Making my implementation of isFinished() final results in a VerifyError
> when I hit the page. If I instead make my implementation class non-abstract,
> my IDE complains that I haven't implemented the clientId property, which to
> my understanding is supposed to be provided by Tapestry. The
> Locations.page file does not declare finished as a property or even
> mention it.
>
> So the questions are: 1) Why is Tapestry creating an implementation of
> this method when one already exists, and 2) how do I make it stop? Relevant
> bits of code follow.
>
> Thanks,
>
> Robert J. Walker
>
>
> SignupPage.java
> public abstract class SignupPage extends BasePage {
> ...
> public abstract boolean isFinished();
> ...
> }
> _____
>
> Locations.java (one of several pages which extend SignupPage)
> public abstract class Locations extends SignupPage {
> ...
> public boolean isFinished() {
> // My logic goes here; this never gets executed
> }
> ...
> }
> _____
>
> Locations.html
> ...
> <div jwcid="@If" condition="ognl:finished">
> <!-- Finish button -->
> </div>
> <div jwcid="@Else">
> <!-- Next button -->
> </div>
> ...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>