Hello.
I have lots pages in my application and most of them require some extra manipulations before usage. The simplest example is message page, which has setMessage( String ) method. Every time to display message I need to get that page object and in a second step to set message of this page. Instead of this, I made base page for all pages in my application and declare methods for all my pages such like IPage getMessagePage( String ) which gets Message page and sets it message. Many of such methods analizes they parameters and decide which page to return. For example, IPage getUserInfoPage( int userId ) will read user data and set it into user page and return this page, or will return allready defined message page with "user not found" message ( as example ). So, having such base page I don't even need to declare any methods in Page class, because they allready defined in it. But there is some problems with such organization. First of all, those methods are not accesible from custom Components becase they can't use my page base class as their base class because it must be AbstractComponent but not AbstractPage. This means that I must COPY-PASTE my code to some analogic class but from component hierarcy, and it is not very good I think. I allready heard some critics that Tapestry Page ans Component must be pure Beans constructed by hivemind or any other way, however I have no idea is it possible at all, but I am sure that it is quite complex task. So, currently I decided to solve this problem in a different way. The idea is to copy all those flow cotrolling methods to hivemind service, wire this service with current IRequestCycle and inject into each page which is interested in it ( into all pages in my case ). As I understand such service must be threaded and I must inject current thread IRequestCycle in it. In general, I need to know how to inject current request cycle into any service. The trick here is that in page must be injected service which allready has injected THAT page IRequestCycle :) Is it possible? I think that it is, but not sure about
realization. Something like this or maybe other way?
hivemodule.xml
   <implementation service-id="navigator">
       <invoke-factory model="threaded">
           <construct class="service.NavigatorImpl">
               <set-object property="requestCycle" object="???" />
            </construct>
       </invoke-factory>
   </implementation>

*.page
<inject property="navigator" object="service:navigator" />

Also, what do you thing about app flow organization?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to