Dynamic mixins
Hi all, have a problem that seems easy to resolve but I'm making hard work of it, was hoping someone here can help me out. I have a simple component I want to use on different pages in my application, and there's a mixin associated with the select component in this simple component, but I want to use a different mixin depending on which type of page the component is located. so I have in my component.tml and in my component.java public String getMixin() { if (getContainer() instanceof SendMoneyTransfer) { return "feefromresidentupdater"; } return "singlesourceformfieldupdater"; } getting "Unable to resolve 'mixin' to a mixin class name". Have tried prop:mixin, ${mixin}, ${prop:mixin} etc. to no avail, would like to avoid having multiple select components with different mixins and an if else(s) if possible? Thanks for listening! Brian. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Exception handling in Tomcat 6.0.33
Hi Kalle, yes I managed finally track down the answer after searching through pages of search results, unfortunately my original search query included the terms "tomcat", "tapestry" and "error" which produces reams of result (most of them irrelevant)! Like you mentioned in your reply I needed to add an error dispatcher (like example here: http://tapestry.apache.org/error-page-recipe.html) app /* FORWARD REQUEST ERROR I then mapped error codes to tapestry URLs 500 /ExceptionReport 404 /ExceptionReport Tomcat then started to redirect these error types to my Exception Report page like Jetty already does. Hopefully this answer will be found by the next person looking into this issue. Thanks for the link explaining why the tapestry exception report filter works in Jetty but not in Tomcat . . . Regards, Brian. On 31 January 2012 16:18, Kalle Korhonen wrote: > Are you setting an error code to your response? You haven't configured > the filter to handle error dispatches: > > app > /* > REQUEST > ERROR > > > Error handling in Jetty and Tomcat differ, see > http://www.cacoethes.co.uk/blog/software/a-tomcat-gotcha for more > info. > > Kalle > > > On Tue, Jan 31, 2012 at 2:50 AM, Brian Long wrote: >> Hi all, >> >> I'm sure I'm not the first person to experience this issue but can't >> seem to find any answers in the mail archive or on the web. I have an >> ExceptionReport page implementing ExceptionReporter so any nasty >> surprises like NPE's result in a nice and friendly "We experiencing >> technical difficulties" page being presented to the user, this works >> fine in jetty but when I deploy my war file to tomcat 6, the >> exceptions are not caught by the ExceptionReporter and the stacktrace >> is shown to the user? >> >> If anyone know what setting in tomcat needs to change so I can get >> this to work as it does in jetty I appreciate it. >> >> Regards, Brian. >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Exception handling in Tomcat 6.0.33
Hi all, I'm sure I'm not the first person to experience this issue but can't seem to find any answers in the mail archive or on the web. I have an ExceptionReport page implementing ExceptionReporter so any nasty surprises like NPE's result in a nice and friendly "We experiencing technical difficulties" page being presented to the user, this works fine in jetty but when I deploy my war file to tomcat 6, the exceptions are not caught by the ExceptionReporter and the stacktrace is shown to the user? If anyone know what setting in tomcat needs to change so I can get this to work as it does in jetty I appreciate it. Regards, Brian. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: property expressions
Hi Thiago, thanks for the quick reply, I'd already seen the official tapestry property expressions page but as there's no examples given there I was hoping there was something else buried in one of the wiki pages? I'll take your advise and move this logic to the java class, I'm going to have a lot of helper methods for the logic that was attached to the various fields on my form, but I guess I can't be avoided. Regards, Brian. On 25 October 2011 14:46, Thiago H. de Paula Figueiredo wrote: > On Tue, 25 Oct 2011 12:14:47 -0200, Brian Long > wrote: > >> Hi all, > > Hi! > >> was hoping someone could point me in the direction on a good tutorial > > on the new property expressions in tapestry 5.2.6? > > http://tapestry.apache.org/property-expressions.html > >> I was using OGNL >> previously and would like to update these expression to work with >> ANTLR instead. > > What do you mean by "to update these expression to work with ANTLR"? I'm not > following you. And don't forget that you can add your own binding > implementations in Tapestry. prop (property expressions) is just one of > them. > >> >> > > Easy: > > > > public String getSurnameCssClass() { > return surname == > null ? 'touch-and-type' : ''; > } > > Logic should be on Java classes, not templates. That's the Tapestry 5 > philosophy (MVC's too). > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and > instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
property expressions
Hi all, was hoping someone could point me in the direction on a good tutorial on the new property expressions in tapestry 5.2.6? I was using OGNL previously and would like to update these expression to work with ANTLR instead. The ognl expression i had was to decorate text field with different classnames depending on whether the field was null Regards, Brian. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
pageRenderLinkSource.toAbsoluteURI() returns relative URL
Hi all, I want determine the URL of my tapestry page, and rather that build the path from the request, I thought I'd use the PageRenderLinkSource service similar to the example posted here http://blog.markwshead.com/825/get-the-url-of-page-in-tapestry-5/, however when I call the method toAbsoluteURI() I get a relative path /myserver/en/receipts/kioskreceipt instead of http://localhost:8080/myserver/en/receipts/kioskreceipt? I'm using Tapestry 5.1.0.5. Regards, Brian. @Inject private PageRenderLinkSource linkSource; logger.info(linkSource.createPageRenderLink(kioskReceipt.getClass()).toAbsoluteURI()); - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: StackMapTable format error: bad class index
Oops! I'm currently using tapetry version 5.2.5 java 1.6.0.24 jetty 6.1.21 javassist 3.7 GA I might try changing the javaassist to an older revision to see it that fixes the problem . . . /Brian. On 2 June 2011 16:27, Taha Hafeez wrote: > Hi > > You have not mentioned which tapestry version you are using ? May be this > will help > > http://tapestry.1045711.n5.nabble.com/T5-StackMapTable-format-error-td2408450.html > > regards > Taha > > On Thu, Jun 2, 2011 at 9:44 PM, Brian Long wrote: > >> Hi all, >> >> getting this error message sporadically when running my tapestry >> application in jetty, was hoping that someone might have encountered >> this before and would be able to point me in the general direction of >> a solution? >> >> Thanks, Brian. >> >> 2011-06-02 16:08:05,109 {33144006@qtp-18954926-4} [T(W9EM) U(USAGENT)] >> [ERROR] >> org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException >> - Processing of request failed with uncaught exception: StackMapTable >> format error: bad class index >> java.lang.ClassFormatError: StackMapTable format error: bad class index >> at >> $Instantiator_130510e808d.newInstance($Instantiator_130510e808d.java) >> at >> org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.(InternalComponentResourcesImpl.java:146) >> at >> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.(ComponentPageElementImpl.java:593) >> at >> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.(ComponentPageElementImpl.java:609) >> at >> org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.performAssembleRootComponent(ComponentAssemblerImpl.java:93) >> at >> org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.access$000(ComponentAssemblerImpl.java:38) >> at >> org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl$1.invoke(ComponentAssemblerImpl.java:82) >> at >> org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl$1.invoke(ComponentAssemblerImpl.java:79) >> at >> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) >> at >> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) >> at >> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063) >> at >> org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.assembleRootComponent(ComponentAssemblerImpl.java:77) >> at >> org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:182) >> at >> org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174) >> at >> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) >> at >> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) >> at >> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063) >> at >> org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173) >> at $PageLoader_130510e7e23.loadPage($PageLoader_130510e7e23.java) >> at >> org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81) >> at $PageSource_130510e7e22.getPage($PageSource_130510e7e22.java) >> at >> org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74) >> at >> $RequestPageCache_130510e7e21.get($RequestPageCache_130510e7e21.java) >> at >> $RequestPageCache_130510e7e1b.get($RequestPageCache_130510e7e1b.java) >> at >> org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:66) >> at >> org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42) >> at >> $ComponentEventRequestHandler_130510e7fb6.handle($ComponentEventRequestHandler_130510e7fb6.java) >> at >> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) >> at >> $ComponentEventRequestHandler_130510e7fb6.handle($ComponentEventRequestHandler_130510e7fb6.java) >> at >> org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75) >> at >> $ComponentEventRequestHandler_130510e7
StackMapTable format error: bad class index
Hi all, getting this error message sporadically when running my tapestry application in jetty, was hoping that someone might have encountered this before and would be able to point me in the general direction of a solution? Thanks, Brian. 2011-06-02 16:08:05,109 {33144006@qtp-18954926-4} [T(W9EM) U(USAGENT)] [ERROR] org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException - Processing of request failed with uncaught exception: StackMapTable format error: bad class index java.lang.ClassFormatError: StackMapTable format error: bad class index at $Instantiator_130510e808d.newInstance($Instantiator_130510e808d.java) at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.(InternalComponentResourcesImpl.java:146) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.(ComponentPageElementImpl.java:593) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.(ComponentPageElementImpl.java:609) at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.performAssembleRootComponent(ComponentAssemblerImpl.java:93) at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.access$000(ComponentAssemblerImpl.java:38) at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl$1.invoke(ComponentAssemblerImpl.java:82) at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl$1.invoke(ComponentAssemblerImpl.java:79) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063) at org.apache.tapestry5.internal.pageload.ComponentAssemblerImpl.assembleRootComponent(ComponentAssemblerImpl.java:77) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:182) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173) at $PageLoader_130510e7e23.loadPage($PageLoader_130510e7e23.java) at org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81) at $PageSource_130510e7e22.getPage($PageSource_130510e7e22.java) at org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74) at $RequestPageCache_130510e7e21.get($RequestPageCache_130510e7e21.java) at $RequestPageCache_130510e7e1b.get($RequestPageCache_130510e7e1b.java) at org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:66) at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42) at $ComponentEventRequestHandler_130510e7fb6.handle($ComponentEventRequestHandler_130510e7fb6.java) at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) at $ComponentEventRequestHandler_130510e7fb6.handle($ComponentEventRequestHandler_130510e7fb6.java) at org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75) at $ComponentEventRequestHandler_130510e7fb6.handle($ComponentEventRequestHandler_130510e7fb6.java) at org.apache.tapestry5.services.TapestryModule$39.handle(TapestryModule.java:2583) at $ComponentEventRequestHandler_130510e7fb6.handle($ComponentEventRequestHandler_130510e7fb6.java) at $ComponentEventRequestHandler_130510e7e18.handle($ComponentEventRequestHandler_130510e7e18.java) at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43) at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39) at $ComponentRequestHandler_130510e7e1a.handleComponentEvent($ComponentRequestHandler_130510e7e1a.java) at com.annadaletech.productlink.agent.services.AppModule$6.handleComponentEvent(AppModule.java:555) at $ComponentRequestFilter_130510e7e17.handleComponentEvent($ComponentRequestFilter_130510e7e17.java) at $ComponentRequestHandler_130510e7e1a.handleComponentEvent($ComponentRequestHandler_130510e7e1a.java) at $ComponentRequestHandler_130510e7dfe.handleComponentEvent($ComponentRequest
Re: Property expressions
Thanks for the quick replay, my updated 'ognless' if condition now reads . . . ${message:EXPORT} /Brian. :-) Howard Lewis Ship wrote: > The not operator (!) coerces the value to a boolean; nil is false, as > is any kind of empty collection. Thus > ... should work. > > On Mon, Oct 5, 2009 at 8:39 AM, Brian Long wrote: > >> Hi all, >> >> just a quick question, looking at the property expressions guide @ >> http://tapestry.apache.org/tapestry5/guide/propexp.html it looks like I >> should be able to evaluate whether a property has a null value (handy >> for if conditions) without having to use ognl, >> >> e.g. instead of >> >> >>> t:id="exportButton">${message:EXPORT} >> >> >> I should be able to use the property expression directly, there's a null >> keyword and an notOpt !, but what is the proper synthax? >> >> Regards, Brian. >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >> > > > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Property expressions
Hi all, just a quick question, looking at the property expressions guide @ http://tapestry.apache.org/tapestry5/guide/propexp.html it looks like I should be able to evaluate whether a property has a null value (handy for if conditions) without having to use ognl, e.g. instead of ${message:EXPORT} I should be able to use the property expression directly, there's a null keyword and an notOpt !, but what is the proper synthax? Regards, Brian. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
using prop: binding to evaluate an expression?
Hi, in tapestry 4 you could use ognl to check a page property in a expression like disabled="ognl:!nextAvailable" or ognl:(nextAvailable == false)", I'm wondering is we can do something similar in T5 without using ognl, just using the prop: binding prefix alone, for example public final boolean isNextPageAvailable() { return true; } the above example doesn't work of course, as there's no property named "!(nextPageAvailable)" just nextPageAvailable . . . Regards, Brian. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Regexp validation
Sura, take a look at this example here http://tapestry.formos.com/nightly/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/TextField.html you'll have to put your regular expression in your classes properties file for it to work . . . /Brian. Sura, Bhupesh wrote: I am using tapestry 5.0.10 and I have a code in a .tml file which looks like this. No matter what input string I give, the regex validation is failing. The regex is valid and works fine with my java code. Any help would be greatly appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
localization of keys returned as properties in T5
Sorry about the ambiguous title, but I'll try to explain what it is I'm trying to achieve . . . in T4 it's possible to have properties/keys in an object that can be localized in the html file using the following expression AddressLine1 tapestry will resolve what the contents of "sender.address.addressLine1Label" are before trying to find a match for that key in the appropriate .properties file. however in T5 we no longer have ognl: prefix (I'm guessing it's replaced by prop:?), so I tried (unsuccessfully) using certain combinations of the prop: and message: prefix to first extract the key from the required object before trying to localize it. The only solution I could come up with was to inject the messages bean into my class and add a method that can pass the key into my messages bean and return the localized text. This method is then called from the .tml. Ideally however I would like to find a way to do all of this work in my .tml file, so if anyone has any ideas, comments or criticism, please let me know. Regards, Brian. @Inject private Messages messages; public final String getSenderAddressLine1Label() { return messages.get(moneyTransfer.getSender ().getAddress().getAddressLine1Label()); }
Form names in T4.1
Hi all, this is just a quick question, in previous versions of tapestry a Form was assigned a name using the convention jwcid="[EMAIL PROTECTED]", however in T4.1this no longer sets the name but assigns an id="someName". Question is, how do I assign a name to my Form component in 4.1, as informal parameters are allowed but name is reserved? Regards, Brian.
Re: Re: dynamic image assets?
Guys, I'm ashamed to admit that my problem was a classic case of RTFM, as there was an example on the tapestry web site that fixed my dynamic Image asset problem with just a few lines of code. I placed my subscriberImage component on my page, and then added the relevant method to my class: public IAsset getSubscriberAsset() { String pathToImage = getSubscriber().getPathToImage(); return new ExternalAsset(pathToImage,null); } Problem solved! Thanks again for all your helpful suggestions, Regards, Brian.
Re: dynamic image assets?
Gareth, while storing the images in the databases is a possible(?) solution, it's one I'd like to avoid for the time being as I want to keep my database size as small as I can, therefore I just want to store the paths to the files for now. Christian, the "pathToImage" returned by my subscriber dataobject is exactly that, a path to the image. I'd like to use this in the asset component instead of the path: but the asset doesn't evaluate ognl expression, it's looking for a string full stop. I've tried to move the Asset from the .page into the class itself but I still get the same problem, the string for path has to be a constant, variables are not allowed. Brian. On 11/29/06, Gareth <[EMAIL PROTECTED]> wrote: why not store the assets in a database, and write the image direct as raw? - Original Message From: Brian Long <[EMAIL PROTECTED]> To: Tapestry users Sent: Wednesday, 29 November, 2006 10:51:01 AM Subject: dynamic image assets? Hi, I'm sure there's a simple solution to this problem, but I've yet to figure out just what it is! I have an image associated with each subscriber that registers with my application, and on login I'd like to show them their picture along with their subscriber details. I know I can add an asset to the .page and have the Image component pick this up and display it The problem with this is that if I have 1000 subscribers, I need 1000 assets in my .page. I would like to store the image location as a property of my subscriber data object and retrieve the asset like this: Unfortunately, tapestry won't evaluate the ognl expression in the getAsset method call, and I get an error "value for parameter image in component is null and a non-null value is required". If someone has a solution to this, I'd be interested the hear about it. Regards, Brian. ___ The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamic image assets?
Hi, I'm sure there's a simple solution to this problem, but I've yet to figure out just what it is! I have an image associated with each subscriber that registers with my application, and on login I'd like to show them their picture along with their subscriber details. I know I can add an asset to the .page and have the Image component pick this up and display it The problem with this is that if I have 1000 subscribers, I need 1000 assets in my .page. I would like to store the image location as a property of my subscriber data object and retrieve the asset like this: Unfortunately, tapestry won't evaluate the ognl expression in the getAsset method call, and I get an error "value for parameter image in component is null and a non-null value is required". If someone has a solution to this, I'd be interested the hear about it. Regards, Brian.
Re: DirectArea component in Tapestry 4
From the tapestry users mailing list, where else . . . ! /Brian. On 9/1/06, Hajaansh <[EMAIL PROTECTED]> wrote: Perfect. Where did you find that the name for the engine service was engine-service:direct ? On 9/1/06, Brian Long <[EMAIL PROTECTED]> wrote: > > Hajaansh, > > had the same problem myself when moving from 3 to 4, so here are the > updated > AreaLink.jwc and AreaLink.java that I use. The main difference in the use > of > property injection for the engine service. > > AreaLink.jwc > > >"-//Apache Software Foundation//Tapestry Specification 4.0//EN" > "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";> > > class="com.yourProject.web.page.AreaLink" > allow-body="no" > allow-informal-parameters="yes"> > > > > > Creates a non-contextual link. Non-persistent state can be stored within > the link > using the context. > > > > > > > An object, or list of objects, encoded into the URL > as service parameters. > > > > > > > > AreaLink.java > > package com.annadaletech.yourProject.web.jwc; > > import org.apache.tapestry.AbstractComponent; > import org.apache.tapestry.IActionListener; > import org.apache.tapestry.IDirect; > import org.apache.tapestry.IMarkupWriter; > import org.apache.tapestry.IRequestCycle; > import org.apache.tapestry.Tapestry; > import org.apache.tapestry.annotations.InjectObject; > import org.apache.tapestry.engine.DirectServiceParameter; > import org.apache.tapestry.engine.IEngineService; > import org.apache.tapestry.engine.ILink; > import org.apache.tapestry.link.DirectLink; > > public abstract class AreaLink extends AbstractComponent implements > IDirect > { > > public abstract Object getParameters(); > public abstract IActionListener getListener(); > > @InjectObject("engine-service:direct") > public abstract IEngineService getDirectService(); > > public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) > { > if (cycle.isRewinding()) >return; > > Object[] parameters = DirectLink.constructServiceParameters > (getParameters()); > > //IEngineService service = getDirectService(); > DirectServiceParameter dsParam = new > DirectServiceParameter(this,parameters); > ILink link = getDirectService().getLink(false,dsParam); > > writer.beginEmpty("area"); > writer.attribute("href",link.getURL()); > > renderInformalParameters(writer,cycle); > } > > public void trigger(IRequestCycle cycle) > { > IActionListener listener = getListener(); > > if (listener == null) > throw Tapestry.createRequiredParameterException(this, > "listener"); > > listener.actionTriggered(this, cycle); > } > > public boolean isStateful() > { > return false; > } > > } > > hivemodule.xml > > > stateful-extension="sdirect"/> > > > yourProject.application > > > > I hope this helps . . . > > /Brian. > > On 9/1/06, Hajaansh <[EMAIL PROTECTED]> wrote: > > I was wondering how to make a DirectArea component (getting callbacks on > > Image Maps) for Tapestry 4 as the implementation for Tapestry 3 does not > > work in Tapestry 4. > > > > And clues? I was looking at using the ILinkRenderer but to be honest I > am > > just getting in a muddle. > > > > Cheers, > > > > Hajaash > > > > > >
Re: DirectArea component in Tapestry 4
Hajaansh, had the same problem myself when moving from 3 to 4, so here are the updated AreaLink.jwc and AreaLink.java that I use. The main difference in the use of property injection for the engine service. AreaLink.jwc http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";> Creates a non-contextual link. Non-persistent state can be stored within the link using the context. An object, or list of objects, encoded into the URL as service parameters. AreaLink.java package com.annadaletech.yourProject.web.jwc; import org.apache.tapestry.AbstractComponent; import org.apache.tapestry.IActionListener; import org.apache.tapestry.IDirect; import org.apache.tapestry.IMarkupWriter; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.Tapestry; import org.apache.tapestry.annotations.InjectObject; import org.apache.tapestry.engine.DirectServiceParameter; import org.apache.tapestry.engine.IEngineService; import org.apache.tapestry.engine.ILink; import org.apache.tapestry.link.DirectLink; public abstract class AreaLink extends AbstractComponent implements IDirect { public abstract Object getParameters(); public abstract IActionListener getListener(); @InjectObject("engine-service:direct") public abstract IEngineService getDirectService(); public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { if (cycle.isRewinding()) return; Object[] parameters = DirectLink.constructServiceParameters (getParameters()); //IEngineService service = getDirectService(); DirectServiceParameter dsParam = new DirectServiceParameter(this,parameters); ILink link = getDirectService().getLink(false,dsParam); writer.beginEmpty("area"); writer.attribute("href",link.getURL()); renderInformalParameters(writer,cycle); } public void trigger(IRequestCycle cycle) { IActionListener listener = getListener(); if (listener == null) throw Tapestry.createRequiredParameterException(this, "listener"); listener.actionTriggered(this, cycle); } public boolean isStateful() { return false; } } hivemodule.xml yourProject.application I hope this helps . . . /Brian. On 9/1/06, Hajaansh <[EMAIL PROTECTED]> wrote: I was wondering how to make a DirectArea component (getting callbacks on Image Maps) for Tapestry 4 as the implementation for Tapestry 3 does not work in Tapestry 4. And clues? I was looking at using the ILinkRenderer but to be honest I am just getting in a muddle. Cheers, Hajaash
Re: multiple stylesheets
Nick, that worked perfectly, thanks! I just had to change a few things for it to comply with T4, but unfortunately now I'm faced with another problem, there's no titles on my stylesheets. Border.html Border.jwc gives me: but I'd like: So as I can select them on the fly from my browser's view->use style setting. If you or anyone else has already figured out how to do this I'd like to hear how it's done. Thanks again, Brian. On 9/1/06, Nick Westgate <[EMAIL PROTECTED]> wrote: Hi Brian. Hopefully someone using T4 can offer you more help, but in my current T3 project I do this via ... Border.jwc - which has a stylesheets parameter: ... direction="in"/> 'html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"' ... SomePage.html - which passes the array of stylesheet assets: ... SomePage.page - which defines the css assets: Cheers, Nick. Brian Long wrote: > Hi all, > > I'm afraid I might have dug myself into a hole (again!), but I hope someone > my have already encountered this problem and is willing to let me know of a > possible solution. > > I'm trying to add multiple stylesheets to my web project, I'm currently > using a @Shell component to enclose my web pages, this has a single > stylesheet as per the example on the tapestry website. > > Customer > Login"> > > I want to add some more, and according to the component description there's > a parameter "stylesheets" that will take an array of IAssets, this is want > I'd like to do, the only problem is that my shell in inside a custom > @Border > component. > > Soo, I have a Border.html and Border.jwc and I have to try and create > an array of IAssets (my list of stylesheets). How do I do this, create a > Border.java? > > Any suggestions would be much appreciated . . . > > /Brian. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multiple stylesheets
Hi all, I'm afraid I might have dug myself into a hole (again!), but I hope someone my have already encountered this problem and is willing to let me know of a possible solution. I'm trying to add multiple stylesheets to my web project, I'm currently using a @Shell component to enclose my web pages, this has a single stylesheet as per the example on the tapestry website. I want to add some more, and according to the component description there's a parameter "stylesheets" that will take an array of IAssets, this is want I'd like to do, the only problem is that my shell in inside a custom @Border component. Soo, I have a Border.html and Border.jwc and I have to try and create an array of IAssets (my list of stylesheets). How do I do this, create a Border.java? Any suggestions would be much appreciated . . . /Brian.