RE: How to pass parameters between Page and component
Hi, It should be more like: component id=articleComp type=ArticleComp binding name=articleId value=ognl:articleId/ /component In your ArticleComp you access the 'articleId' parameter like this: IBinding iBinding = getBinding(articleId); String articleId = (String) iBinding.getObject(articleId); Regards, /Firas -Original Message- From: jake123 [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 10:19 PM To: users@tapestry.apache.org Subject: How to pass parameters between Page and component Hi, I have a (hopefully) easy question. I have My index.page where I use some components. One of them needs a parameter articleId passed to it from my index.java file where I have a getArticleId(). I thaugh that I declared a parameter in the .page file and then use the same parameter in my binding tag in the component like this: parameter name=articleId required=yes/ component id=articleComp type=ArticleComp binding name=value value=articleId/ /component but I get an error when I do this. Unexpected element parameter within page-specification. So my question is: How do I pass my articleId from my index.java to my custom component? Thanks Jacob -- View this message in context: http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf24 12533.html#a6724770 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to observe property binding events
OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:33 PM To: Tapestry users Subject: Re: How to observe property binding events There's also the org.apache.tapestry.event.ChangeObserver interface, though this is currently only used by the services in tapestry.persist to observe page property changes when they are being managed via a particular persistence strategy. (like session/client/etc..) ~Maybe~ it's an oversight, and maybe not..I guess that depends on what/why you are trying to do. You'll find that there is very little in the framework that wasn't put there for an actual need, so adding in support for things that no one has needed yet doesn't seem to fall in line with sound design. (imho of course..) If you can outline why you need this, and exactly what properties/conditions you'd want to observe we might be able to work something out...A general anything is harder to understand / design around. There is no such thing as a parameter property listener because parameters have no meaning in the context of something taking a parameter...There has to be a source for that parameter value (usually a page ) somewhere. On 10/9/06, Epstein, Ezra [EMAIL PROTECTED] wrote: Hi Jesse, Thanks for that reply. If I read it correctly, it sounds, simply, like the framework is missing this feature. It's a pretty common thing to ask for listener call-backs on framework events. (Listener here in the generic sense rather than the way tapestry uses the term for direct-link targets.) In short, this sounds like a design over-sight. It's common when beans are bound to be able to receive a call-back -- Hibernate, for example, offers this. So much of Tapestry seems automagic I'm surprised that there's no way to register to be informed of the events as they occur. If Howard's reading this perhaps he has a better perspective that he may offer. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Friday, October 06, 2006 7:22 PM To: Tapestry users Subject: Re: How to observe property binding events Yes, but the usefulness of my answer largely depends on how clever/efficient you are trying to be doing it. Now, there is IBinding. The one object to bind them all ;) If you work your way down the type hierarchy you'll find AbstractBinding, which holds the method you care about most - setObject. This will be called by tapestry when managing all of the page properties automagically for you. Some of the magic happens in (for your exact case at least) org.apache.tapestry.enhance.ParameterPropertyWorker. The other half of the work happens in each specific binding implementation that will handle these set/get object calls..(Like ognl bindings, etc..) I'm not sure where you are going with this but I guess you could use the hivemind chain of command service sort of configuration (like I did for org.apache.tapestry.services.ComponentRenderWorker ) to generically call a single interface method for a hivemind configuration point...Then you can contribute as many workers into the chain you like if you decide that you have more than one use for it. Again...Not knowing what you are doing - and taking the exact parameters given I'd probably extend and override the default ParameterPropertyWorker (a hivemind service, so replacing it inline with what Tapestry does already should be easy ) and just override whatever section of code I needed to in that implementation to inject + call my service reference. It may look a little complicated in there at first, but the whole org.apache.tapestry.enhance package is filled with lots of different enhancement works - and most of them inject a service into the object they work on...So finding an easier to follow
RE: How to observe property binding events
Also, that title should have been parameter binding events not (generic) property. The situation I have occurs when the framework sets the parameter on a Component. Thanks, Ezra Epstein -Original Message- From: Epstein, Ezra [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:00 PM To: Tapestry users Subject: RE: How to observe property binding events Hi Jesse, Thanks for that reply. If I read it correctly, it sounds, simply, like the framework is missing this feature. It's a pretty common thing to ask for listener call-backs on framework events. (Listener here in the generic sense rather than the way tapestry uses the term for direct-link targets.) In short, this sounds like a design over-sight. It's common when beans are bound to be able to receive a call-back -- Hibernate, for example, offers this. So much of Tapestry seems automagic I'm surprised that there's no way to register to be informed of the events as they occur. If Howard's reading this perhaps he has a better perspective that he may offer. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Friday, October 06, 2006 7:22 PM To: Tapestry users Subject: Re: How to observe property binding events Yes, but the usefulness of my answer largely depends on how clever/efficient you are trying to be doing it. Now, there is IBinding. The one object to bind them all ;) If you work your way down the type hierarchy you'll find AbstractBinding, which holds the method you care about most - setObject. This will be called by tapestry when managing all of the page properties automagically for you. Some of the magic happens in (for your exact case at least) org.apache.tapestry.enhance.ParameterPropertyWorker. The other half of the work happens in each specific binding implementation that will handle these set/get object calls..(Like ognl bindings, etc..) I'm not sure where you are going with this but I guess you could use the hivemind chain of command service sort of configuration (like I did for org.apache.tapestry.services.ComponentRenderWorker ) to generically call a single interface method for a hivemind configuration point...Then you can contribute as many workers into the chain you like if you decide that you have more than one use for it. Again...Not knowing what you are doing - and taking the exact parameters given I'd probably extend and override the default ParameterPropertyWorker (a hivemind service, so replacing it inline with what Tapestry does already should be easy ) and just override whatever section of code I needed to in that implementation to inject + call my service reference. It may look a little complicated in there at first, but the whole org.apache.tapestry.enhance package is filled with lots of different enhancement works - and most of them inject a service into the object they work on...So finding an easier to follow worker to reference before modifying ParameterPropertyWorker might be easier. Hope that helps. On 10/6/06, Epstein, Ezra [EMAIL PROTECTED] wrote: I've got a component which accepts a parameter. I want to listen (receive a callback) when the parameter is set (bound). Does Tapestry provide such a facility? Thanks, Ezra Epstein -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to observe property binding events
Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute(myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapestry/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:33 PM To: Tapestry users Subject: Re: How to observe property binding events There's also the org.apache.tapestry.event.ChangeObserver interface, though this is currently only used by the services in tapestry.persist to observe page property changes when they are being managed via a particular persistence strategy. (like session/client/etc..) ~Maybe~ it's an oversight, and maybe not..I guess that depends on what/why you are trying to do. You'll find that there is very little in the framework that wasn't put there for an actual need, so adding in support for things that no one has needed yet doesn't seem to fall in line with sound design. (imho of course..) If you can outline why you need this, and exactly what properties/conditions you'd want to observe we might be able to work something out...A general anything is harder to understand / design around. There is no such thing as a parameter property listener because parameters have no meaning in the context of something taking a parameter...There has to be a source for that parameter value (usually a page ) somewhere. On 10/9/06, Epstein, Ezra [EMAIL PROTECTED] wrote: Hi Jesse, Thanks for that reply. If I read it correctly, it sounds, simply, like the framework is missing this feature. It's a pretty common thing to ask for listener call-backs on framework events. (Listener here in the generic sense rather than the way tapestry uses the term for direct-link targets.) In short, this sounds like a design over-sight. It's common when beans are bound to be able to receive a call-back -- Hibernate, for example, offers this. So much of Tapestry seems automagic I'm surprised that there's no way to register to be informed of the events as they occur. If Howard's reading this perhaps he has a better perspective that he may offer. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Friday, October 06, 2006 7:22 PM To: Tapestry users Subject: Re: How to observe property binding events Yes, but the usefulness of my answer largely depends on how clever/efficient you are trying to be doing it. Now, there is IBinding. The one object to bind them all ;) If you work your way down the type hierarchy you'll find AbstractBinding, which holds the method you care about most - setObject. This will be called by tapestry when managing all of the page properties automagically for you. Some of the magic happens in (for your exact case at least) org.apache.tapestry.enhance.ParameterPropertyWorker. The other half of the work happens in each specific binding implementation that will handle these set/get object calls..(Like ognl bindings, etc..) I'm not sure where you are going with this but I guess you could use the hivemind chain of command service sort of configuration (like I did for org.apache.tapestry.services.ComponentRenderWorker ) to generically call a single interface method for a hivemind configuration point...Then you can contribute as many workers into the chain you like if you decide that you have more than one use for it. Again...Not knowing what you are doing - and taking the exact parameters given I'd probably extend and override the default ParameterPropertyWorker (a hivemind service, so replacing it inline with what Tapestry does already should
Re: Thoughts about performance monitoring in Tapestry
On 10/9/06, Mark Stang [EMAIL PROTECTED] wrote: Try JProfiler. It can track where you application is spending all of its time. One thing that came up earlier is that OGNL is a hog. However, we haven't found Tapestry to be the issue, but the rest of the app... For simple expressions, try tapestry-prop, which compiles into java bytecode instead of reflection that ognl relies on. http://howardlewisship.com/tapestry-javaforge/tapestry-prop/ -- regards, Robin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Accessing HiveMind Registry
Hi to all, I've got a small prioblem with HiveMind. I wrote a small Service but I must use from a class taht is outside a Tapestry component and can't be declared abstract. I need something like in the HiveMind manual: (from the HiveMind home page) . Registry registry = RegistryBuilder.constructDefaultRegistry(); MyService service = (MyService) registry.getService(com.mypackage.MyService, MyService.class); . The key is access the Registry but in this way it throws an exception. I' don't know how but I'm sure it is possible Edoardo
Re: checkboxes problem
Yes, I know why this happends: you have a bug, a mistake in your code. Cheers, Ron Andrés Nates wrote: Hello I have the following problem I have a list of checkboxes, when i select a checkbox the page recharges itself. But if i select the last of the checkboxes in the list, when the page recharges, all checkboxes appears selected. Anybody knows Why this happens?, and What can I do to solve this problem? Thanks Cordialmente, ~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~ ANDRÉS NATES M. Director de implantación e infraestructura. Nuevos Medios Calle 25 No. 127-220 Autopista Cali-Jamundí Km. 7 Tel: (572) - 524 07 77 Ext. 2173 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] Cali mailto:[EMAIL PROTECTED] - Colombia POLÍTICA DE CALIDAD Proveer soluciones tecnológicas de software para la gestión del conocimiento cumpliendo lo pactado con los clientes mediante el mejoramiento continuo y la innovación, apoyado en la sinergia corporativa de Parquesoft. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing HiveMind Registry
One way would be to create a factory for instances of this class in hivemind, and inject any services you need to it. Another way would be to get the registry instance tapestry uses, which is stored as a context attribute. see the ApplicationServlet code. Cheers, Ron Edoardo Campagnano wrote: Hi to all, I've got a small prioblem with HiveMind. I wrote a small Service but I must use from a class taht is outside a Tapestry component and can't be declared abstract. I need something like in the HiveMind manual: (from the HiveMind home page) . Registry registry = RegistryBuilder.constructDefaultRegistry(); MyService service = (MyService) registry.getService(com.mypackage.MyService, MyService.class); . The key is access the Registry but in this way it throws an exception. I' don't know how but I'm sure it is possible Edoardo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validation questions: components and messages
I have written a component that contains text fields that need to be validated when a page is submitted but I can't figure out how component validation hooks into Tapestry's validation framework. I can access my validation delegate in my page component but how can I get the validation delegate from my component? Also, is there an easy way to get the individual error messages from the validation delegate? I want to put individual validation errors messages next to each field rather than have a single message at the top of the page and then ** beside each of the errored field. Thanks, Dave.
Re: How do I create a link...
This is also how I do it but I thought I read in a previous post that this is not the best way of doing it. Is this correct? On 10/4/06, Jesse Kuhnert [EMAIL PROTECTED] wrote: That depends on what you want to happen when they click on that asset? I've found the ServiceLink component indispensable in this regard. You can create a simple little arbitrary engine service without the hassle of creating new link components to run it...So..In your case you could: Define a new engine service that serves files to people in such a way that it'll correctly invoke their browsers application content handling type - or download if none is found...(Ie setting response type , etc..) Then use a simple ServiceLink to pass in what you want to give the service, which is presumably a local asset you have defined. On 10/3/06, Mark Stang [EMAIL PROTECTED] wrote: I need to create a link to an asset in Tapestry 3. Basically, I have a .pdf which isn't in my context. Thoughts on how to link to it? thanks, mark Mark J. Stang Senior Engineer/Architect office: +1 303.468.2900 mobile: +1 303.507.2833 Ping Identity -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Re: Validation questions: components and messages
Dave Rathnow wrote: I have written a component that contains text fields that need to be validated when a page is submitted but I can't figure out how component validation hooks into Tapestry's validation framework. I can access my validation delegate in my page component but how can I get the validation delegate from my component? You use per Form one instance of validation delegate. It tracks the validation errors which the components report. This happends from itself, you just need to define the validators on the fields. Also, is there an easy way to get the individual error messages from the validation delegate? I want to put individual validation errors messages next to each field rather than have a single message at the top of the page and then ** beside each of the errored field. In such a case you need to create your own class, extending the standard validation delegate. There are methods which allow the delegate to hook up into the rendering of fields and their labels, so you can do just what you described. Thanks, Dave. Please, Ron - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation questions: components and messages
Hi, On 10/10/06, Ron Piterman [EMAIL PROTECTED] wrote: Dave Rathnow wrote: Also, is there an easy way to get the individual error messages from the validation delegate? In such a case you need to create your own class, extending the standard validation delegate. There are methods which allow the delegate to hook up into the rendering of fields and their labels, so you can do just what you described. We also wrote our own validation delegate with nice error-icons. Somehow like this: public class MyValidationDelegate extends ValidationDelegate { public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator) { if (isInError()) writer.attribute(class, validationerror); } public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator) { if (isInError()) { writer.print( ); writer.beginEmpty(img); writer.attribute(src, warning_small.gif); } } public void writeLabelPrefix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle) { if (isInError(component)) { writer.begin(span); writer.attribute(class, label-error); } } public void writeLabelSuffix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle) { if (isInError(component)) writer.end(); // span } } HTH Greetings Reto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problems with css tag in custom components
Hi, I have some problems with my custom components. Each of the components have their own CSS so I need to insert a tag like this for the component: link jwcid=cssLink href=/default/css/topbar.css rel=stylesheet type=text/css / this tag will not end up in the head tag but actually in the body of the html. The results come out like this (disregard the white spaces in the biginning and the end): l t ; link href=/default/css/topbar.css type=text/css rel=stylesheet / g t ; So, the problem is that tapestry converts the html symbols instead of serving html tags. It also does the same for a image tags. I have in my java code this method: public String getCssLink() { /* Get the link for the right css */ String templateName = getSessionUserInfo().getTemplateName(); return link href=\/ + templateName + /css/topbar.css\ type=\text/css\ rel=\stylesheet\ /; } Is this the wrong approach? If so, how should I do this instead? Thanks Jacob -- View this message in context: http://www.nabble.com/Problems-with-css-tag-in-custom-components-tf2417055.html#a6737676 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with css tag in custom components
For tap 3.0.x and 4.0.x assuming you use the Insert component, http://tapestry.apache.org/tapestry4/tapestry/ComponentReference/Insert.html set the raw attribute to true. For tap 4.1.x, there's already a component for correctly including a css http://tapestry.apache.org/tapestry4.1/components/Style.html jake123 wrote: Hi, I have some problems with my custom components. Each of the components have their own CSS so I need to insert a tag like this for the component: link jwcid=cssLink href=/default/css/topbar.css rel=stylesheet type=text/css / this tag will not end up in the head tag but actually in the body of the html. The results come out like this (disregard the white spaces in the biginning and the end): l t ; link href=/default/css/topbar.css type=text/css rel=stylesheet / g t ; So, the problem is that tapestry converts the html symbols instead of serving html tags. It also does the same for a image tags. I have in my java code this method: public String getCssLink() { /* Get the link for the right css */ String templateName = getSessionUserInfo().getTemplateName(); return link href=\/ + templateName + /css/topbar.css\ type=\text/css\ rel=\stylesheet\ /; } Is this the wrong approach? If so, how should I do this instead? Thanks Jacob -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to pass parameters between Page and component
thank you Dennis for your answer, it works perfectly fine :-) Cheers, Jacob -- View this message in context: http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf2412533.html#a6737930 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to pass parameters between Page and component
Thank you for your answer, I will try this solution too. Cheers, Jacob -- View this message in context: http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf2412533.html#a6737950 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Thoughts about performance monitoring in Tapestry
Robin, Great idea. If we migrate to 4.x, I will try it. I don't know what Howard is going to have available for 5.x, but I think it will support this. regards, Mark Mark J. Stang Senior Engineer/Architect office: +1 303.468.2900 mobile: +1 303.507.2833 Ping Identity -Original Message- From: Robin Ericsson [mailto:[EMAIL PROTECTED] Sent: Tue 10/10/2006 2:16 AM To: Tapestry users Subject: Re: Thoughts about performance monitoring in Tapestry On 10/9/06, Mark Stang [EMAIL PROTECTED] wrote: Try JProfiler. It can track where you application is spending all of its time. One thing that came up earlier is that OGNL is a hog. However, we haven't found Tapestry to be the issue, but the rest of the app... For simple expressions, try tapestry-prop, which compiles into java bytecode instead of reflection that ognl relies on. http://howardlewisship.com/tapestry-javaforge/tapestry-prop/ -- regards, Robin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation questions: components and messages
Yes - you can do much with the delegate :) BTW - consider using CSS for this instead of adding elements , it might be more elegant and easier to maintain... Cheers, Ron Reto Hotz wrote: Hi, On 10/10/06, Ron Piterman [EMAIL PROTECTED] wrote: Dave Rathnow wrote: Also, is there an easy way to get the individual error messages from the validation delegate? In such a case you need to create your own class, extending the standard validation delegate. There are methods which allow the delegate to hook up into the rendering of fields and their labels, so you can do just what you described. We also wrote our own validation delegate with nice error-icons. Somehow like this: public class MyValidationDelegate extends ValidationDelegate { public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator) { if (isInError()) writer.attribute(class, validationerror); } public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator) { if (isInError()) { writer.print( ); writer.beginEmpty(img); writer.attribute(src, warning_small.gif); } } public void writeLabelPrefix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle) { if (isInError(component)) { writer.begin(span); writer.attribute(class, label-error); } } public void writeLabelSuffix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle) { if (isInError(component)) writer.end(); // span } } HTH Greetings Reto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting locale in stateless app
I'm intressted in doing about the same. Can you explain in more detail how you solved it? Malin On 10/3/06, Hardi Rokk [EMAIL PROTECTED] wrote: Answering my own question: I resolved this problem by overriding tapestry.request.RequestLocaleManager service point in my hivemind conf and just added into extractLocaleForCurrentRequest() code to read language parameter from request and using this as user locale. Not sure if it is the best way, but it seems to work... hardi Hardi Rokk wrote: Hi everyone, I am trying to make stateless tapestry application where i give user preferred language as GET parameter (like: language=en). But i can't find the right place to set the tapestry locale - on the pages java file it is already too late since the page is loaded from pool in some specific (default?) locale. So setting locale should be done somewhere before getting page from the pool. Any ideas where and how should stateless applications locale be set? P.S. language as GET parameter is in requirements, so there's no changing that. Best Regards, hardi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setting locale based on querystring
I've seen this issue before on this list but not seen any satisfying solution. This is my problem: Based on the querystring to one of my tap pages (it is a link from outside) I derive the locale that I wan't to use to display the requested page. In other part of my app I use a DirectLink and a listener to switch locale: getPage().getEngine().setLocale(new Locale(language)); getPage().getRequestCycle().cleanup(); throw new PageRedirectException(this.getPage()); and that works fine! Though, if I put the same code in my page mentioned earlier, in the pageBeginRender listener method, I will get an exception page telling that a PageRedirectException has occurred. So, it doesn't work (why?) How should it be done? Any help highly appreciated.
RE: How to observe property binding events
That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute(myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapestry/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:33 PM To: Tapestry users Subject: Re: How to observe property binding events There's also the org.apache.tapestry.event.ChangeObserver interface, though this is currently only used by the services in tapestry.persist to observe page property changes when they are being managed via a particular persistence strategy. (like session/client/etc..) ~Maybe~ it's an oversight, and maybe not..I guess that depends on what/why you are trying to do. You'll find that there is very little in the framework that wasn't put there for an actual need, so adding in support for things that no one has needed yet doesn't seem to fall in line with sound design. (imho of course..) If you can outline why you need this, and exactly what properties/conditions you'd want to observe we might be able to work something out...A general anything is harder to understand / design around. There is no such thing as a parameter property listener because parameters have no meaning in the context of something taking a parameter...There has to be a source for that parameter value (usually a page ) somewhere. On 10/9/06, Epstein, Ezra [EMAIL PROTECTED] wrote: Hi Jesse, Thanks for that reply. If I read it correctly, it sounds, simply, like the framework is missing this feature. It's a pretty common thing to ask for listener call-backs on framework events. (Listener here in the generic sense rather than the way tapestry uses the term for direct-link targets.) In short, this sounds like a design over-sight. It's common when beans are bound to be able to receive a call-back -- Hibernate, for example, offers this. So much of Tapestry seems automagic I'm surprised that there's no way to register to be informed of the events as they occur. If Howard's reading this perhaps he has a better perspective that he may offer. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Friday, October 06, 2006 7:22 PM To: Tapestry users Subject: Re: How to observe property binding events Yes, but the usefulness of my answer largely depends on how clever/efficient you are trying to be doing it. Now, there is IBinding. The one object to bind them all ;) If you work your way down the type hierarchy you'll find AbstractBinding, which holds the method you care about most - setObject. This will be called by tapestry when managing all of the page properties automagically for you. Some of the magic happens in (for your exact case at least) org.apache.tapestry.enhance.ParameterPropertyWorker. The other half of the work happens in each specific binding implementation that will handle these set/get object calls..(Like ognl bindings, etc..) I'm not sure where you are
Re: DatePicker not working after upgrading from 4.0.2 to 4.1
Payne, Matthew wrote: Fyi: that dojo dropdownpicker has nice eye candy effects, but terrible for entering dates many years in the part. http://archive.dojotoolkit.org/nightly/tests/widget/test_DropdownDatePicker.html Though the standard tapestry date picker is not so good at that as well. I really hope that does not get used with tapestry. It needs autohide/collipse sider for the year and a hot key for making big year jumps. That tacos one is a little better, but after 12 years ahead/back it breaks down(click and hold on the year ). http://opencomponentry.com:8080/tacos/core/MasksExample.html http://www.dynarch.com/projects/calendar/ is what tacos uses... If you do find another nice js calendar, it's not that difficult to turn it into a Tapestry component. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DatePicker not working after upgrading from 4.0.2 to 4.1
Thanks for the input Matthew. I especially like enhancements that make components/widgets more usable. Since this is a dojo widget you might want to share some of your thoughts at trac.dojotoolkit.org . Or, if you had a suggestion for a DatePicker that you think works correctly I'm always open to suggestions. On 10/10/06, Payne, Matthew [EMAIL PROTECTED] wrote: Fyi: that dojo dropdownpicker has nice eye candy effects, but terrible for entering dates many years in the part. http://archive.dojotoolkit.org/nightly/tests/widget/test_DropdownDatePicker.html Though the standard tapestry date picker is not so good at that as well. I really hope that does not get used with tapestry. It needs autohide/collipse sider for the year and a hot key for making big year jumps. That tacos one is a little better, but after 12 years ahead/back it breaks down(click and hold on the year ). http://opencomponentry.com:8080/tacos/core/MasksExample.html After getting 12 years back it should start autoscrolling down(that would be cool). Matt -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Sunday, October 01, 2006 11:44 PM To: Tapestry users Subject:Re: DatePicker not working after upgrading from 4.0.2 to 4.1 Are you talking about the normal DatePicker or the DropdownDatePicker? If you can find an issue with anything here I can still do something about it before 0.4 comes out: http://archive.dojotoolkit.org/nightly/tests/widget/test_DropdownDatePicker.html On 10/1/06, Josh Long [EMAIL PROTECTED] wrote: Im not too sure what exactly triggers it, though off the top of my head when it happens to me happens when i get a midly complicated form going only.. which makes me wonder if th epositioning is being affedted by scrolling.. Peace, Josh On 10/1/06, Jesse Kuhnert [EMAIL PROTECTED] wrote: Does anyone have any more information on when this happens? Could it be in combination with another library perhaps ? (like tacos? ) . On 9/12/06, soir [EMAIL PROTECTED] wrote: Hello, I've found same problem recently. Try to use DropdownDatePicker component instead. Igor Anders Cessner wrote: Hi, I recently upgraded from 4.0.2 to 4.1 and noticed that the datepicker doesnt work anymore. when the page is loaded i get this error: Could not load ' tapestry.form '; last tried '__package__.js' and when i click the calendar image i get: calendar_dueDate has no properties it has probably something to do with this http://issues.apache.org/jira/browse/TAPESTRY-1020?page=all as i´m developing on windows, but that issue seems to be resolved 21/7 and the 4.1jars i´ve downloaded from http://tapestry.apache.org/download.html looks like to be dated after that. what should i do to fix this? -- View this message in context: http://www.nabble.com/DatePicker-not-working-after-upgrading-from-4.0.2-to-4.1-tf2231968.html#a6260496 Sent from the Tapestry - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com This message, including any attachments, is intended only for the recipient(s) named above. It may contain confidential and privileged information. If you have received this communication in error, please notify the sender immediately and destroy or delete the original message. Also, please be aware that if you are not the intended recipient, any review, disclosure, copying, distribution or any action or reliance based on this message is prohibited by law. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
DirectLink in Abstract Component
Hi, I have a menu component that extends AbstractComponent. It seems that my DirectLinks in the menu component does not work. I have 4 different Listener methods and I have injected the pages that they should go to. If I add sysout:s to se if I end upp in the listener methods nothing happens. I have done this: in MenuComp.java: public abstract class MenuSystem extends AbstractComponent { /* */ @InjectState(sessionuserinfo) public abstract SessionUserInfo getSessionUserInfo(); @InjectPage(HomeAction) public abstract HomeAction getHomePage(); @InjectPage(ContactUsPage) public abstract ContactUsPage getContactUsPage(); @InjectPage(ArticlePage) public abstract ArticlePage getArticlePage(); @InjectPage(ArticleListPage) public abstract ArticleListPage getArticleListPage(); @Override protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { . writer.begin(a); writer.attribute(jwcid, @DirectLink); writer.attribute(listener, listener:onClickDirectLinkHomePage ); writer.attribute(onmouseover, hideAllButThis('none', 'none');); writer.attribute(href, #); writer.begin(span); writer.print(menu.getName()); writer.end(); // end span writer.end(); // end a } public HomeAction onClickDirectLinkHomePage() { return getHomePage(); } public ContactUsPage onClickDirectLinkContactUsPage() { return getContactUsPage(); } public ArticleListPage onClickDirectLinkArticleListPage(Long menuId) { getArticleListPage().setMenuId(menuId); return getArticleListPage(); } public ArticlePage onClickDirectLinkArticlePage(Long articleId) { getArticlePage().setArticleId(articleId); return getArticlePage(); } } The menu component is rendering correctly, but nothing happens when I try to click on my DirectLinks. Hopefully I just missed something small, but I cant see it... Thanks Jacob -- View this message in context: http://www.nabble.com/DirectLink-in-Abstract-Component-tf2419541.html#a6745562 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A dynamic css emitter like the @Script component
http://www.madskristensen.dk/blog/CommentView,guid,9b4acb83-3ab4-45a0-be95-b4279f4da7d1.aspx The preceeding link is a an implementation (not my own, obviously) of a ASP.NET engine-service which renders your css based on scripted inputs. I know there's a lot to be said for x-platform CSS, but the truth is we don't really have that, and even where it's 99% there, I can think of a few cases where being able to determine a value on the server and have it consistantly used (say the width of an image and the width of its container, or an advert, or even storing preferences for font-sizes, etc.) would be invaluable. If, in a month, I were to try and cobble something like that together which allowed scripting of css files (of course, I'd do my best to adhere to the .script template mechanism and ognl instead of using Java (or C# heh) inline), would anybody be receptive to it? Any feedback that you might offer? Anything I might need to know? If I setup the same duo of CSS component and service as Script currently enjoys, would that work? In a related note, are there are engines in java which read CSS? Does the @Script component at point read/validate the JavaScript it's emitting using Rhino? The beauty of such a service for the .css woudl of course be the chance to cache/and compress the css while we're in there, in essence yeilding css files which are parameterized and compressed. I know white space can be an issue in CSS, though, so I was wondering how such transformatiosn might be accomplished? Thanks in advance for any feedback, Josh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Maven, Eclipse and Jetty setup problems.
Maven2 integration in Ivy is not ideal, we are supposed to have own Ivy repo ;) or use WOJ but you can simply use something like this, and do not mess with URL resolvers: dependency org=incubator-activemq name=activeio-core rev=3.0 artifact name=activeo-core type=jar url=http://people.apache.org/repo/m2-snapshot-repository/incubator-activemq/activeio-core/3.0-SNAPSHOT/activeio-core-3.0-20060324.230126-1.jar/ /dependency --- Leo Sakhvoruk [EMAIL PROTECTED] wrote: Hi Konstantin, I'm trying to get Ivy working as per your suggestion but I'm having trouble pulling dependencies via a url resolver (as that seems to be the only option from what I could gather) for the 4.1.1-SNAPSHOT. Since I'm trying to retrieve libraries from http://people.apache.org/repo/m2-snapshot-repository/ I've tried doing something like this: ivyconf conf defaultResolver=default/ resolvers chain name=default url name=public m2compatible=true ... /url filesystem /filesystem /chain /resolvers /conf /ivyconf That repository contains maven configuration files and so I'm getting errors as Ivy can't read the maven-metadata.xml. Is there a better way of doing this or am I missing something? Thanks, Leo Konstantin Ignatyev wrote: Just curious, why do you like the pain? What kind of rewards do you expects after going through the Maven pain? I mean Ant+IVY painlessly take care of dependency management (better than maven dep manager) and build related activities. Jetty is just Java process so debugger can be attached to that... --- Leo Sakhvoruk [EMAIL PROTECTED] wrote: Wow, What a serious pain in the butt! I've been trying to set up Eclipse to use Maven and Jetty for my project and it has turned out a horrendous affair and a time sink. I am yet to see Jetty run once and be able to debug my project. Right now I'm getting the following error: [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-jetty6-plugin' does not exist or no valid version could be found This is insane from what I can see since I don't even have maven-jetty6-plugin declared in my pom file!!! I'm trying to use maven-jetty-plugin 6.1-SNAPSHOT. Does anyone have a clue why it's trying to use maven-jetty6-plugin? Please help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Konstantin Ignatyev PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000 Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Maven, Eclipse and Jetty setup problems.
Oh I see, Thats kinda along the lines what I was attempting with the url resolver but it looked like I would have to match the version numbers exactly in order to pull the latest library builds. Thanks for your suggestion, I'll try it out. Leo Konstantin Ignatyev wrote: Maven2 integration in Ivy is not ideal, we are supposed to have own Ivy repo ;) or use WOJ but you can simply use something like this, and do not mess with URL resolvers: dependency org=incubator-activemq name=activeio-core rev=3.0 artifact name=activeo-core type=jar url=http://people.apache.org/repo/m2-snapshot-repository/incubator-activemq/activeio-core/3.0-SNAPSHOT/activeio-core-3.0-20060324.230126-1.jar/ /dependency --- Leo Sakhvoruk [EMAIL PROTECTED] wrote: Hi Konstantin, I'm trying to get Ivy working as per your suggestion but I'm having trouble pulling dependencies via a url resolver (as that seems to be the only option from what I could gather) for the 4.1.1-SNAPSHOT. Since I'm trying to retrieve libraries from http://people.apache.org/repo/m2-snapshot-repository/ I've tried doing something like this: ivyconf conf defaultResolver=default/ resolvers chain name=default url name=public m2compatible=true ... /url filesystem /filesystem /chain /resolvers /conf /ivyconf That repository contains maven configuration files and so I'm getting errors as Ivy can't read the maven-metadata.xml. Is there a better way of doing this or am I missing something? Thanks, Leo Konstantin Ignatyev wrote: Just curious, why do you like the pain? What kind of rewards do you expects after going through the Maven pain? I mean Ant+IVY painlessly take care of dependency management (better than maven dep manager) and build related activities. Jetty is just Java process so debugger can be attached to that... --- Leo Sakhvoruk [EMAIL PROTECTED] wrote: Wow, What a serious pain in the butt! I've been trying to set up Eclipse to use Maven and Jetty for my project and it has turned out a horrendous affair and a time sink. I am yet to see Jetty run once and be able to debug my project. Right now I'm getting the following error: [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-jetty6-plugin' does not exist or no valid version could be found This is insane from what I can see since I don't even have maven-jetty6-plugin declared in my pom file!!! I'm trying to use maven-jetty-plugin 6.1-SNAPSHOT. Does anyone have a clue why it's trying to use maven-jetty6-plugin? Please help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Konstantin Ignatyev PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000 Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tapestry page (and other) event listeners
The common idiom for listener registration (Swing, Java Beans, etc.) is that the remove() method returns the listener and the add() method only adds a listener if it's not already listening. Tapestry's impl follows neither of these approaches. Is there a reason for the naïve implementation of the methods like void addPageBeginRenderListener(PageBeginRenderListener listener) ? A LinkedHashSet() would give the ordering of the current ArrayList implementation plus the uniquing properties of a set... Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 1:09 PM To: Tapestry users Subject: Re: How to observe property binding events I'm not sure what the requirements are wrt properties and specific users. I've done similar things on a per request basis via doing something like: public abstract int getProp(); public abstract void setProp(int value); public int getComplicatedValue() { if(getProp() == -1) { // do something complicated setProp(newVal); } return getProp(); } The idea being that the heavy operation will only happen once for that request/response cycle. This all changes if you want it to be done for all users ? You can do that as well I suppose but I think I probably need more clarification on who the properties are supposed to be exposed to/etc.. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute (myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapes try/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:33 PM To: Tapestry users Subject: Re: How to observe property binding events There's also the org.apache.tapestry.event.ChangeObserver interface, though this is currently only used by the services in tapestry.persist to observe page property changes when they are being managed via a particular persistence strategy. (like session/client/etc..) ~Maybe~ it's an oversight, and maybe not..I guess that depends on what/why you are trying to do. You'll find that there is very little in the framework that wasn't put there for an actual need, so adding in support for things that no one has needed yet doesn't seem to fall in line with sound design. (imho of course..) If you can outline why you need this, and exactly what properties/conditions you'd want to observe we might be able to work something out...A general anything is harder to understand / design around. There is no such thing as a parameter property listener because parameters have no meaning in the context of something taking a parameter...There has to be a source for that parameter value (usually a page ) somewhere. On 10/9/06, Epstein, Ezra [EMAIL PROTECTED] wrote: Hi Jesse, Thanks for that reply. If I read it correctly, it sounds, simply, like the framework is
Re: Tapestry page (and other) event listeners
I'd have to dig into the code to be sure I understood all points but I don't think addPageBeginRenderListener is called by user code most of the time. .. If you page implements one of the various Listener classes (like umm... PageBeginRenderListener) - the framework will detect it and perform the necessary registrations for you automatically when it enhances the page class the first time. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: The common idiom for listener registration (Swing, Java Beans, etc.) is that the remove() method returns the listener and the add() method only adds a listener if it's not already listening. Tapestry's impl follows neither of these approaches. Is there a reason for the naïve implementation of the methods like void addPageBeginRenderListener(PageBeginRenderListener listener) ? A LinkedHashSet() would give the ordering of the current ArrayList implementation plus the uniquing properties of a set... Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 1:09 PM To: Tapestry users Subject: Re: How to observe property binding events I'm not sure what the requirements are wrt properties and specific users. I've done similar things on a per request basis via doing something like: public abstract int getProp(); public abstract void setProp(int value); public int getComplicatedValue() { if(getProp() == -1) { // do something complicated setProp(newVal); } return getProp(); } The idea being that the heavy operation will only happen once for that request/response cycle. This all changes if you want it to be done for all users ? You can do that as well I suppose but I think I probably need more clarification on who the properties are supposed to be exposed to/etc.. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute (myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapes try/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:33 PM To: Tapestry users Subject: Re: How to observe property binding events There's also the org.apache.tapestry.event.ChangeObserver interface, though this is currently only used by the services in tapestry.persist to observe page property changes when they are being managed via a particular persistence strategy. (like session/client/etc..) ~Maybe~ it's an oversight, and maybe not..I guess that depends on what/why you are trying to do. You'll find that there is very little in the framework that wasn't put there for an actual need, so adding in support for things that no one has needed yet doesn't seem to fall in line with sound design. (imho of course..) If you can outline why you need this, and exactly what properties/conditions you'd want to observe we might be able to work something out...A general anything is harder to understand / design
RE: Tapestry page (and other) event listeners
A-ha! So if I have a component that implements this that component will auto-magically be registered and receive the call-back? Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 4:32 PM To: Tapestry users Subject: Re: Tapestry page (and other) event listeners I'd have to dig into the code to be sure I understood all points but I don't think addPageBeginRenderListener is called by user code most of the time. .. If you page implements one of the various Listener classes (like umm... PageBeginRenderListener) - the framework will detect it and perform the necessary registrations for you automatically when it enhances the page class the first time. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: The common idiom for listener registration (Swing, Java Beans, etc.) is that the remove() method returns the listener and the add() method only adds a listener if it's not already listening. Tapestry's impl follows neither of these approaches. Is there a reason for the naïve implementation of the methods like void addPageBeginRenderListener(PageBeginRenderListener listener) ? A LinkedHashSet() would give the ordering of the current ArrayList implementation plus the uniquing properties of a set... Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 1:09 PM To: Tapestry users Subject: Re: How to observe property binding events I'm not sure what the requirements are wrt properties and specific users. I've done similar things on a per request basis via doing something like: public abstract int getProp(); public abstract void setProp(int value); public int getComplicatedValue() { if(getProp() == -1) { // do something complicated setProp(newVal); } return getProp(); } The idea being that the heavy operation will only happen once for that request/response cycle. This all changes if you want it to be done for all users ? You can do that as well I suppose but I think I probably need more clarification on who the properties are supposed to be exposed to/etc.. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute (myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tap es try/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 3:33 PM To: Tapestry users Subject: Re: How to observe property binding events There's also the org.apache.tapestry.event.ChangeObserver interface, though this is currently only used by the services in tapestry.persist to observe page property changes when they are being managed via a particular persistence strategy. (like
Re: Tapestry page (and other) event listeners
I don't remember whether or not Page listeners get attached to components or not. It doesn't sound like something that would make sense, but who knows.. For components specifically, you also have the other options involved, like: (from http://tapestry.apache.org/tapestry4.1/target/site/tapestry-framework/apidocs/org/apache/tapestry/AbstractComponent.html) finishLoad prepareForRender renderComponent On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: A-ha! So if I have a component that implements this that component will auto-magically be registered and receive the call-back? Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 4:32 PM To: Tapestry users Subject: Re: Tapestry page (and other) event listeners I'd have to dig into the code to be sure I understood all points but I don't think addPageBeginRenderListener is called by user code most of the time. .. If you page implements one of the various Listener classes (like umm... PageBeginRenderListener) - the framework will detect it and perform the necessary registrations for you automatically when it enhances the page class the first time. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: The common idiom for listener registration (Swing, Java Beans, etc.) is that the remove() method returns the listener and the add() method only adds a listener if it's not already listening. Tapestry's impl follows neither of these approaches. Is there a reason for the naïve implementation of the methods like void addPageBeginRenderListener(PageBeginRenderListener listener) ? A LinkedHashSet() would give the ordering of the current ArrayList implementation plus the uniquing properties of a set... Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 1:09 PM To: Tapestry users Subject: Re: How to observe property binding events I'm not sure what the requirements are wrt properties and specific users. I've done similar things on a per request basis via doing something like: public abstract int getProp(); public abstract void setProp(int value); public int getComplicatedValue() { if(getProp() == -1) { // do something complicated setProp(newVal); } return getProp(); } The idea being that the heavy operation will only happen once for that request/response cycle. This all changes if you want it to be done for all users ? You can do that as well I suppose but I think I probably need more clarification on who the properties are supposed to be exposed to/etc.. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute (myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tap es try/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value when the derived ivar is computed and if the original and current property values don't match I reset the derived ivar. It works, but it a total hack. The common way I'd imagine doing it is to listen to when the property (parameter) is set by Tapestry. But now that I've lain out the use case maybe some knows the right way to do this in Tapestry. Thanks, Ezra Epstein -Original Message- From: Jesse Kuhnert
Re: Tapestry page (and other) event listeners
Jesse Kuhnert wrote: I don't remember whether or not Page listeners get attached to components or not. It doesn't sound like something that would make sense, but who knows.. They do get attached to components... but i'm under the impression that your page also has to implement PageBeginRenderListener for this to work... Additionally,if you use Blocks from other pages, take a look at this entry: http://jroller.com/page/genjitsuteki?entry=tapestry_avoid_pagerenderlistener For components specifically, you also have the other options involved, like: (from http://tapestry.apache.org/tapestry4.1/target/site/tapestry-framework/apidocs/org/apache/tapestry/AbstractComponent.html) finishLoad prepareForRender renderComponent On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: A-ha! So if I have a component that implements this that component will auto-magically be registered and receive the call-back? Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 4:32 PM To: Tapestry users Subject: Re: Tapestry page (and other) event listeners I'd have to dig into the code to be sure I understood all points but I don't think addPageBeginRenderListener is called by user code most of the time. .. If you page implements one of the various Listener classes (like umm... PageBeginRenderListener) - the framework will detect it and perform the necessary registrations for you automatically when it enhances the page class the first time. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: The common idiom for listener registration (Swing, Java Beans, etc.) is that the remove() method returns the listener and the add() method only adds a listener if it's not already listening. Tapestry's impl follows neither of these approaches. Is there a reason for the naïve implementation of the methods like void addPageBeginRenderListener(PageBeginRenderListener listener) ? A LinkedHashSet() would give the ordering of the current ArrayList implementation plus the uniquing properties of a set... Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 1:09 PM To: Tapestry users Subject: Re: How to observe property binding events I'm not sure what the requirements are wrt properties and specific users. I've done similar things on a per request basis via doing something like: public abstract int getProp(); public abstract void setProp(int value); public int getComplicatedValue() { if(getProp() == -1) { // do something complicated setProp(newVal); } return getProp(); } The idea being that the heavy operation will only happen once for that request/response cycle. This all changes if you want it to be done for all users ? You can do that as well I suppose but I think I probably need more clarification on who the properties are supposed to be exposed to/etc.. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute (myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tap es try/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear multiple times on a page. By default the first time I use the component I compute the value and then display from that computed value... The 2nd, 3rd, etc instance of those component on the page is actually the exact same Java instance and so the computed/derived ivar is still set. I've added a hack that records an original property value
RE: Tapestry page (and other) event listeners
I declared the proper interface as being implemented and that was all that was needed. Works on components. Thanks, Ezra Epstein -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 5:08 PM To: Tapestry users Subject: Re: Tapestry page (and other) event listeners Jesse Kuhnert wrote: I don't remember whether or not Page listeners get attached to components or not. It doesn't sound like something that would make sense, but who knows.. They do get attached to components... but i'm under the impression that your page also has to implement PageBeginRenderListener for this to work... Additionally,if you use Blocks from other pages, take a look at this entry: http://jroller.com/page/genjitsuteki?entry=tapestry_avoid_pagerenderlistener For components specifically, you also have the other options involved, like: (from http://tapestry.apache.org/tapestry4.1/target/site/tapestry-framework/ apidocs/org/apache/tapestry/AbstractComponent.html) finishLoad prepareForRender renderComponent On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: A-ha! So if I have a component that implements this that component will auto-magically be registered and receive the call-back? Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 4:32 PM To: Tapestry users Subject: Re: Tapestry page (and other) event listeners I'd have to dig into the code to be sure I understood all points but I don't think addPageBeginRenderListener is called by user code most of the time. .. If you page implements one of the various Listener classes (like umm... PageBeginRenderListener) - the framework will detect it and perform the necessary registrations for you automatically when it enhances the page class the first time. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: The common idiom for listener registration (Swing, Java Beans, etc.) is that the remove() method returns the listener and the add() method only adds a listener if it's not already listening. Tapestry's impl follows neither of these approaches. Is there a reason for the naïve implementation of the methods like void addPageBeginRenderListener(PageBeginRenderListener listener) ? A LinkedHashSet() would give the ordering of the current ArrayList implementation plus the uniquing properties of a set... Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 1:09 PM To: Tapestry users Subject: Re: How to observe property binding events I'm not sure what the requirements are wrt properties and specific users. I've done similar things on a per request basis via doing something like: public abstract int getProp(); public abstract void setProp(int value); public int getComplicatedValue() { if(getProp() == -1) { // do something complicated setProp(newVal); } return getProp(); } The idea being that the heavy operation will only happen once for that request/response cycle. This all changes if you want it to be done for all users ? You can do that as well I suppose but I think I probably need more clarification on who the properties are supposed to be exposed to/etc.. On 10/10/06, Epstein, Ezra [EMAIL PROTECTED] wrote: That's the opposite of the functionality I want. These are not PER request. They are per instance of a component. Thus true instance variables are the way to go. Tapestry recycles Components and it seems that within a request the same component is re-used but not cleared (ivars reset) even though it is re-parametrized. So, I don't think request vars would work. Thanks, Ezra Epstein Amazon.com - Developer Tools 206-266-2259 -Original Message- From: andyhot [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:35 AM To: Tapestry users Subject: Re: How to observe property binding events Why store them in local variables? Store it in the current request cycle... First do a cycle.getAttribute(myexpensivevar) if that returns null, do the computations and store the result back cycle.setAttribute (myexpensivevar,obj); See http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/ tap es try/IRequestCycle.html Epstein, Ezra wrote: OK, let's get to brass tacks. I have some derived values that are somewhat expensive to compute so I compute them once per request/response cycle and then they're in local instance variables (non-persisted). The particular component in question (with the semi-expensive derived values) is used inside a loop and so may appear
Instructions for building 4.1
Hello, Just curious if there are instructions for building Tapestry 4.1 from source/version control? I did find http://tapestry.apache.org/tapestry4.1/download.html but I am not quiet sure what I need setup. I have begun looking into maven but it is a bit tangential to tapestry 4.1. Thanks, -Ryan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Instructions for building 4.1
I believe all you need to do is this after installing maven: mvn in the main tapestry directory. ;) On 10/10/06, Ryan Cuprak [EMAIL PROTECTED] wrote: Hello, Just curious if there are instructions for building Tapestry 4.1 from source/version control? I did find http://tapestry.apache.org/tapestry4.1/download.html but I am not quiet sure what I need setup. I have begun looking into maven but it is a bit tangential to tapestry 4.1. Thanks, -Ryan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com