On 3/26/06, Adam Zimowski <[EMAIL PROTECTED]> wrote: > Well, maybe I'm wrong on this because this is only my first Tapestry > app (although large one), but from what I'm noticing is a common > generic patten. > > Most page methods are really specific to a given page. Seldom when you > inject one page to another will you need to see every single method of > that page. To me it's actually dangerious and "ugly" to expose all > methods by default. At best, when you derive one page from another > you'd want to inherit protected/public methods, but why make all > methods public by default?
Agreed. But you don't have to inject the implementation page. If you really want to expose only those methods you feel are necessary from page to page, you can create an interface for the methods you wish to expose and the getter for the injected page can return the interface. I admit that that requires coding by convention and is un-enforceable, but it's a start... > I think only public page methods should be those that would be exposed > to another page via injection. All other methods should be protected. > > Why would that be a bad design? To me it looks like a natural thing? Agreed. I think I understand your question a bit better and it makes more sense to me. If I understand correctly, you want to make a method in the page class protected and still be able to access it from the template, correct? It seems that that absolutely should work. For protected methods, tap should really create a public method of the same signature that calls super.methodName so that when it passes the 'this' reference into ognl it works. If it doesn't do that now it seems like a bug/sug. The problem would be concrete classes. There would need to be a way to tell tapestry that even though a particular class is concrete, it should be enhanced to allow this sort of thing. It probably should happen by default if there are protected members, but only if the user has not specified otherwise via a meta tag or annotation. Ideally, all pieces of the page (class,template,spec) should be (semantically at least) part of the same whole so that even private members could be accessible from the template/spec, though I'm not sure how that would be done. I'm with you now... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
