Re: Tapestry JSONObject : no 'function' type, any workaround ?
Francois Armand wrote: Rico Landefeld wrote: Hello, I had the same annoying problem, but the patch works for me. But my question is: when will be a tapestry maintenance release which contains already this patch? btw, the same problem was solved in tapestry 4.1 long ago. I would like - much prefer in fact - a workaround that does not imply to have my own version of T5... Already does that some times ago for an UTF-8 problem in URLs, and it's a mess to maintain (pom with non standard T5 repos, etc.). So, if someone has a less disruptive workaround, I will be glad to hear it :) (nonetheless, I keep in mind this solution...) Nobody has a real solution ? (real being not patching the framework and maintaining by myself) What I need to do is to create a Window from the Window Prototype. And I'd like to choose the parameters for this object. The js Window object argument is a Javascript Array, with parameters : parameter : value. However some value are Javascript object, for instance showEffect : Element.show What Tapestry write when outputing the JSONObject is showEffect : Element.show. And Element.show is definitively not a JS object. So it fails. Any idea ? Regards, Nicolas - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry JSONObject : no 'function' type, any workaround ?
I love it ! Thank you, you made my day ! Davor Hrg wrote: I have a solution :) I needed it to make my own autocomplete /** * */ package tapestryutil.mixins; /** Workarround to add raw content to JSON, like function references and such. * Number instances are not quoted and are trusted, so we use it.*/ final class JSONRaw extends Number { private final String rawText; JSONRaw(String rawText) { this.rawText = rawText; } @Override public double doubleValue() {return 0;} @Override public float floatValue() {return 0;} @Override public int intValue() {return 0;} @Override public long longValue() {return 0;} @Override public String toString() { return rawText; } } On Mon, Mar 9, 2009 at 3:33 PM, Andreas Andreou andy...@di.uoa.gr wrote: For json responses, i think it's good that the json is strict (i.e. no objects or callbacks allowed as values) For constructing js objects to be included in the html (to configure other js components) it's clear that JSONObject isn't the correct answer (json != js object) Probably the autocmplete mixin needs to use a 'new' JsObject class On Mon, Mar 9, 2009 at 4:10 PM, ningdh ningd...@gmail.com wrote: Not aware of that, sorry. In my window component, I hack to replace double quote of all function to empty. JSONObject options= new JSONObject(); options.put(showEffect, TO_BE_REPLACE + this.showEffect+TO_BE_REPLACE); getPageRenderSupport().addScript(%s = new Window(%s);, getUniqueId(), filterJsFunction(options.toString())); private String filterJsFunction(String jsonString) { // function begin jsonString = jsonString.replaceAll(\TO_BE_REPLACE, ); // function end jsonString = jsonString.replaceAll(TO_BE_REPLACE\, ); return jsonString; } Well, a bit stupid, but works. DH - Original Message - From: Francois Armand farm...@linagora.com To: Tapestry users users@tapestry.apache.org Sent: Monday, March 09, 2009 9:51 PM Subject: Re: Tapestry JSONObject : no 'function' type, any workaround ? ningdh wrote: toString method of JsonObject would double quote our value. One way is to create some data type extends jsonobject to encapsule your data and override the toString method. I haven't tried it yet. But JSONObject and JSONArray are final, that's not possible - it was my first plan. How can I workaround that ? -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- http://fanf42.blogspot.com InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - 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
Re: Localization in Services
Blower, Andy wrote: Not sure how generally useful that would be, but it would solve the problem in an easy way. Thinking some more about this, would it not be easier to simply pass the messages from the page/component event handler method into the service method that's called to send the email? that would be the convenient way, however i do not have page or component. It's a REST web service, so there is no Tapestry injection or call from a Tapestry with messages injected. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Localization in Services
Hello there, I'm currently struggling with a proper way to use localization in a service. My need is fairly simple : i'm using t5-restful-webservices from Bill Holloway (by the way great job Bill) to offer REST services. One of my service sends an email. The email is localized. Using the Asset for the body of the mail works great for its localization. However the mail's subject is stored in the app.properties... I cannot use the @Inject Messages to retrieve the oh-so-convenient Messages service ( Service id 'Messages' is not defined by any module. ) Thus my question is : - How can i access to the app.properties from a given service ? The best of the best would be to have a possibility to use Messages, but i'm open to any other solution Regards, Nick - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Localization in Services
Thanks for the tip Roberto, but I didn't succeed into adding the app.properties (or just i can't get the key, i don't know) And it feels strange to use the ValidationMessage for a standart message Nick Tapestry Infodea wrote: I've forgetten a piece of code, you must contribute the ValidationMessagesSource in your AppModule: public void contributeValidationMessagesSource(OrderedConfigurationString configuration) { configuration.add(myprop, it/infodea/app/internal/myprop); } and define myprop.properties in it/infodea/app/internal/ Tapestry Infodea ha scritto: You can use the ValidationMessagesSource and ThreadLocale services: ValidationMessagesSource validationMessagesSource; ThreadLocale threadLocale; Messages messages = validationMessagesSource.getValidationMessages(threadLocale.getLocale()); Roberto. Nicolas Charles ha scritto: Hello there, I'm currently struggling with a proper way to use localization in a service. My need is fairly simple : i'm using t5-restful-webservices from Bill Holloway (by the way great job Bill) to offer REST services. One of my service sends an email. The email is localized. Using the Asset for the body of the mail works great for its localization. However the mail's subject is stored in the app.properties... I cannot use the @Inject Messages to retrieve the oh-so-convenient Messages service ( Service id 'Messages' is not defined by any module. ) Thus my question is : - How can i access to the app.properties from a given service ? The best of the best would be to have a possibility to use Messages, but i'm open to any other solution Regards, Nick - 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: RESTful web services module
Bill Holloway wrote: Well, against my better judgment, I've posted the little jar I use to make T5 services serve RESTful web service requets. It does this by shooting a RequestFilter into the pipeline that you contribute your service classes to via the IoC. The code and some documentation are at http://code.google.com/p/t5-restful-webservices/ This is ALPHA software, allowing only one method in a T5 service to handle RESTful web service requests. I'm planning to have the beta version include an annotation you can stick on any IoC service method that will restful-web-service-enable it. Feel free to flame. Bill in Austin Hey Bill, I just have one question about this service which looks very promising. Can it handle POST data ? And preferably easily ? Or should i have to parse the request object to fetch my data ? Regards, Nicolas - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Palette NPE
I just had this issue; it was because the object overrided the equals method, but not hashCode, hence the selected object couldn't be found in the selected set. Nick zack1403 wrote: Bump for help on this? Is the because genericSelectModel.getOptionGroups returns null? This occurs intermitently and I havent been able to find a workaround. Zack zack1403 wrote: Hey All, I'm getting a NullPointerException when the palette component in 5.0.16: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer.option(SelectModelRenderer.java:49) at org.apache.tapestry5.corelib.components.Palette$SelectedRenderer.render(Palette.java:147) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$RenderPhaseEventHandler$1.render(ComponentPageElementImpl.java:164) at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72) I'm populating the palette using the code below: selectEncoder = new GenericValueEncoderStringBean(this.spreadsheetHeaders); selectModel = new GenericSelectModelStringBean(this.spreadsheetHeaders, StringBean.class, value, value, propertyAccess); Am I using this correctly? Thanks, Zack - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (newbie) Tapestry generated b/
You could override the MarkupWriterFactory to prevent the abreviation of the b/ tag It should look like this public class XhtmlMarkupWriterFactoryImpl implements MarkupWriterFactory { private final String applicationCharset; private final MarkupModel xmlModel = new DefaultMarkupModel() { private final SetString DONT_ABRV = new HashSetString(Arrays.asList(b, select)); @Override public EndTagStyle getEndTagStyle(String element) { boolean isDontAbr = DONT_ABRV.contains(element); return isDontAbr ? EndTagStyle.REQUIRE : EndTagStyle.ABBREVIATE; } @Override public boolean isXML() { return true; } }; } and alias it in the AppModule : public static void contributeAlias(ConfigurationAliasContributionMarkupWriterFactory configuration, @Inject @Symbol(SymbolConstants.CHARSET) final String applicationCharset) { configuration.add(AliasContribution.create(MarkupWriterFactory.class, new XhtmlMarkupWriterFactoryImpl(applicationCharset))); } Note that i don't abbreviate the select either, for IE doesn't understand at all an empty select/ Regards Nicolas Peter Stavrinides wrote: Tapestry is meant to generate valid XHTML, which means the tag should be closed, but due to a bug introduced recently it appears not to with certain tags see: https://issues.apache.org/jira/browse/TAP5-333 and vote for it to be fixed, in the meantime use a span / instead, it will work... I use the same rounded corner trick! cheers, Peter - Original Message - From: akira [EMAIL PROTECTED] To: users@tapestry.apache.org Sent: Tuesday, 25 November, 2008 2:53:51 AM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: (newbie) Tapestry generated b/ Hi, this is the first time i'm using Tapestry. I'm using a css tricky to make rounded corners, the css uses empty b (bold) to create the rounded corners, when Tapestry generates the html it creates the open b but doesn't create the closing b: what i want: b class=top/b Tapestry generated code: b class=top / There's someplace where i can configure Tapestry to generate close tags when there is nothing between the tags? TIA. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]