Re: Dynamic CSS depending on URL

2012-04-10 Thread Lance Java
Hmm... I don't suppose this has anything to do with a recent change I made to the code on github? In a previous version, every URL request pushed a Mode instance onto the Environment but Mode.getMode() could potentially return null when a "special" URL was not used. I slightly changed the impleme

Re: Dynamic CSS depending on URL

2012-04-09 Thread Thiago H. de Paula Figueiredo
On Mon, 09 Apr 2012 15:33:56 -0300, Juan Alba wrote: Sorry Thiago is concerned to all the other stuff that I have been dealing with, that's why I put it as part of the thread. I'm sorry, I didn't remember any mention of the environment in this thread. P.S. Do you have any documentation a

Re: Dynamic CSS depending on URL

2012-04-09 Thread Thiago H. de Paula Figueiredo
Why has this been posted ans an answer to this thread? Please post a new thread (message not replying another). ;) On Mon, 09 Apr 2012 14:05:12 -0300, Juan Alba wrote: I am having some problems with this in 5.1.05 When I run the webapp I see how it gets to the environment.push but it thr

Re: Dynamic CSS depending on URL

2012-04-09 Thread Juan Alba
I am having some problems with this in 5.1.05 When I run the webapp I see how it gets to the environment.push but it throws this runtime error: Render queue error in AfterRender[ExceptionReport:layout]: No object of type ar.com.condortech.lib.tapestryFbSecurityLib.extra.Mode is available from the

Re: Dynamic CSS depending on URL

2012-04-04 Thread Lance Java
Lets get back to basics here... you already have an instance of a link but you want to transform a couple of methods to return slightly different values. Let's forget about base path as it looks like that was added in 5.3 to make this job easier and we don't have that luxury in 5.1.05 In tapestry

Re: Dynamic CSS depending on URL

2012-04-04 Thread Juan Alba
Sorry Lance but I don't understand how to replace the link with an interface if I can't make a copyWithBasePath because I cant set/access all the attributes of the link. Sorry but I don't understand. I am talking about link.getBasePath() and the link.copyWithBasePath(newPath) in the method transf

Re: Dynamic CSS depending on URL

2012-04-03 Thread Lance Java
Take a look at my RequestDelegate class which delegates every method to another class. I then override one method which I want to change. You could do exactly the same and create a LinkDelegate. After all, it's just an interface :) On Tuesday, 3 April 2012, Juan Alba wrote: > First of all thank

Re: Dynamic CSS depending on URL

2012-04-03 Thread Juan Alba
First of all thanks a lot for all your time and help Lance. I have used your example and worked perfect. I could use the mode to put the css dynamically as I wished. Thanks a lot. Now my problem is trying to use it in my web app. In tapestry 5.1.0.5 LinkImpl doesn't have getBasePath(), or copyWith

Re: Dynamic CSS depending on URL

2012-03-31 Thread Lance Java
I've put together a little demo decorating the ComponentEventLinkEncoder which I'm sure you could adapt to the deprecated URLRewriter if you prefer it that way. I've done it in tapestry 5.3 but it could be packported to tapestry 5.1.0.5 as is. I've setup three "special" prefixes for "foo", "bar" a

Re: Dynamic CSS depending on URL

2012-03-30 Thread Thiago H. de Paula Figueiredo
On Fri, 30 Mar 2012 18:03:40 -0300, Juan Alba wrote: This was a test to understand how it works. So the UrlRewrite is like a redirect? No! I thought that was only replacing the url for the new url. Like rendering the XXXPage and showing in the url YYYPage. No. If you rewrite /xxx into /

Re: Dynamic CSS depending on URL

2012-03-30 Thread Juan Alba
On Fri, Mar 30, 2012 at 5:23 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Fri, 30 Mar 2012 17:16:00 -0300, Juan Alba > wrote: > > URLRewriterRule rule = new URLRewriterRule() { >> @Override >> public Request process(Request request, URLRewriteContext context) { >>

Re: Dynamic CSS depending on URL

2012-03-30 Thread Thiago H. de Paula Figueiredo
On Fri, 30 Mar 2012 17:16:00 -0300, Juan Alba wrote: URLRewriterRule rule = new URLRewriterRule() { @Override public Request process(Request request, URLRewriteContext context) { return new SimpleRequestWrapper(request, request.getPath()+"/test");

Re: Dynamic CSS depending on URL

2012-03-30 Thread Juan Alba
Guys I am having problems with the URLRewrite: As a test I am trying to write in the browser url : thePath/test for every url, so I did this: public static void contributeURLRewriter(OrderedConfiguration configuration) { URLRewriterRule rule = new URLRewriterRule() { @Override public

Re: Dynamic CSS depending on URL

2012-03-30 Thread Juan Alba
Ok, I think that I have no solution for my problem. I do the authentication in the webapp with Spring so in my AppModule I have: configuration.add("spring-security.target.url", "/start"); This means that when authentication process finishes it will redirect there (without using the urlRewriter)..

Re: Dynamic CSS depending on URL

2012-03-30 Thread Thiago H. de Paula Figueiredo
On Fri, 30 Mar 2012 10:05:07 -0300, Juan Alba wrote: Thiago, where can I find some documentation on the URLRewriter (some examples or how tos)? http://tapestry.apache.org/url-rewriting.html -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, devel

Re: Dynamic CSS depending on URL

2012-03-30 Thread Juan Alba
Thiago, where can I find some documentation on the URLRewriter (some examples or how tos)? Thanks! On Fri, Mar 30, 2012 at 10:02 AM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Fri, 30 Mar 2012 09:39:08 -0300, Lance Java > wrote: > > No, URLRewriters can decorate the result

Re: Dynamic CSS depending on URL

2012-03-30 Thread Thiago H. de Paula Figueiredo
On Fri, 30 Mar 2012 09:39:08 -0300, Lance Java wrote: No, URLRewriters can decorate the result (generated links) too. Fair enough... I would still decorate the ComponentEventLinkEncoder to future-proof your code (URLRewriter is not in the 5.3 code base) URLRewriter does that. If you want

Re: Dynamic CSS depending on URL

2012-03-30 Thread Lance Java
> No, URLRewriters can decorate the result (generated links) too. Fair enough... I would still decorate the ComponentEventLinkEncoder to future-proof your code (URLRewriter is not in the 5.3 code base)

Re: Dynamic CSS depending on URL

2012-03-30 Thread Thiago H. de Paula Figueiredo
On Fri, 30 Mar 2012 04:58:25 -0300, Lance Java wrote: I'm not 100% but I think that you might need to decorate the ComponentEventLinkEncoder instead of contributing a URLRewriter as I *think* that URLRewriters can't decorate the result, they can only short circut out of the chain. No, URLRe

Re: Dynamic CSS depending on URL

2012-03-30 Thread Lance Java
I'm not 100% but I think that you might need to decorate the ComponentEventLinkEncoder instead of contributing a URLRewriter as I *think* that URLRewriters can't decorate the result, they can only short circut out of the chain. I think you will need to do something like this: public class AppModu

Re: Dynamic CSS depending on URL

2012-03-29 Thread Jon Williams
Hey Y'all I was reading the thread and you know another prime use case is sizing images for mobile or web using css alone. We need to be able to do this. I could use use it starting yesterday. Just so you know, Jon On Thu, Mar 29, 2012 at 2:20 PM, Juan Alba wrote: > Thanks Lance Again. > > I h

Re: Dynamic CSS depending on URL

2012-03-29 Thread Thiago H. de Paula Figueiredo
On Thu, 29 Mar 2012 17:20:29 -0300, Juan Alba wrote: Thanks Lance Again. I have just been being reading the article you share with me and I realized that is for tapestry 5.2.0. I am using 5.1.0.5, so I will have to use the URLRewriter* service (Can't update to 5.2.0). I have no idea h

Re: Dynamic CSS depending on URL

2012-03-29 Thread Juan Alba
Thanks Lance Again. I have just been being reading the article you share with me and I realized that is for tapestry 5.2.0. I am using 5.1.0.5, so I will have to use the * URLRewriter* service (Can't update to 5.2.0). I have no idea how this work either, do you think that I will be able to do some

Re: Dynamic CSS depending on URL

2012-03-28 Thread Lance Java
Great, if Tapestry is the only thing rendering your links then it will all work. By overriding the PageRenderLinkTransformer you are intercepting both link creation and URL decoding so you are covering the whole flow. On Wednesday, 28 March 2012, Juan Alba wrote: > Thanks Again Lance. > > On Wed

Re: Dynamic CSS depending on URL

2012-03-28 Thread Juan Alba
Thanks Again Lance. On Wed, Mar 28, 2012 at 12:10 PM, Lance Java wrote: > I was assuming that all of your links were rendered by Tapestry (eg > EventLink and ActionLink). If this was the case then it *should* just work. > You are assuming well. I am using ActionLinks. Right now, When you click a

Re: Dynamic CSS depending on URL

2012-03-28 Thread Lance Java
I was assuming that all of your links were rendered by Tapestry (eg EventLink and ActionLink). If this was the case then it *should* just work. I'm not sure what you mean by webLibs but I am guessing that you are generating links without invoking Tapestry's Link generation API's. If this is the ca

Re: Dynamic CSS depending on URL

2012-03-28 Thread Juan Alba
First of all, thanks again Lance! On Wed, Mar 28, 2012 at 11:25 AM, Lance Java wrote: > Perhaps this would work > > Create an environmental object called Mode > > public interface Mode { > public String getMode(); // facebook or normal > } > > Use tapestry's URL rewriting to rewrite http://my

Re: Dynamic CSS depending on URL

2012-03-28 Thread Lance Java
Perhaps this would work Create an environmental object called Mode public interface Mode { public String getMode(); // facebook or normal } Use tapestry's URL rewriting to rewrite http://myapp/facebook/page to http://myapp/page (see http://blog.tapestry5.de/index.php/2010/09/06/new-url-rewrit

Re: Dynamic CSS depending on URL

2012-03-28 Thread Juan Alba
Thanks Bob and Lance for the ideas and recomendations. I think that Lance understood better my problem. The mode to change the css I have it already solved with Thiago's suggestion. Now my problem is that I can't define which stylesheet to use from server's side because the only way to define it is

Re: Dynamic CSS depending on URL

2012-03-28 Thread Lance Java
All of the solutions mentioned on this thread assume that there is a way ofdetermining which "mode" your pages/components need to include styles for. >From what you have said, it seems that you currently only know the "mode" clientside in javascript. I get the feeling that you may need to re-thin

Re: Dynamic CSS depending on URL

2012-03-27 Thread Bob Harner
Just a thought (haven't used it myself)... consider Template Skinning, which allows you to have more than one tml file for a given page or component. http://blog.tapestry5.de/index.php/2011/06/24/template-skinning/ On Tue, Mar 27, 2012 at 11:12 AM, Juan Alba wrote: > Thanks for your help guy

Re: Dynamic CSS depending on URL

2012-03-27 Thread Juan Alba
Thanks for your help guys, now I am realizing that my real problem is another one. It concerns more with the logic to know what style to load. My app can be used in the browser (regular way) or also as a Facebook App. This means an iframe where everything is smaller, and the backgrounds need to be

Re: Dynamic CSS depending on URL

2012-03-27 Thread Lance Java
Tapestry uses the ImportWorker to process @Import annotations http://tapestry.apache.org/5.3/apidocs/src-html/org/apache/tapestry5/internal/transform/ImportWorker.html You could quite easily write your own annotation (and worker) to do a similar job with your custom logic On Monday, 26 March 2012

Re: Dynamic CSS depending on URL

2012-03-26 Thread Thiago H. de Paula Figueiredo
On Mon, 26 Mar 2012 12:00:03 -0300, kado wrote: Hi, Hi! My webapp now is loading the stylesheets in the Layout component in this way: @IncludeStylesheet({"context:css/mainLayout.css","context:css/components.css"}) I have been looking for a solution in the mailing list and didn't find a

Dynamic CSS depending on URL

2012-03-26 Thread kado
ing about contributing in the AppModule, but I don't know how to use it with my working scheme. Any idea? Thanks! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Dynamic-CSS-depending-on-URL-tp5595488p5595488.html Sent from the Tapestry - User mail