Re: ResourceReference with locale and style, for CSSs

2007-11-11 Thread Johan Compagner
yes thats what normally happens, see the ImageTest for example, the
last locale en_US has no image for that locale so we don't generate
it. Thats because normally the packageresource knows to which locale
it resolves to and the resourcereference is getting that locale when
it loads the resource in bind/newresource. But that setting doesn't
work completely right if you use RR direclty and give it to a header
response

On 11/10/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 the only thing that is wrong is that perhaps we COULD generate a url
 without locale and we DONT. but i am american, so im not that familiar
 with the whole locale thing. johan is a better guy to ask for this...

 -gor


 On Nov 10, 2007 1:24 PM, German Morales [EMAIL PROTECTED] wrote:
  So perhaps there's nothing wrong after all?
 
 
  It seems that Igor Vaynberg wrote:
   when wicket generates the links it appends your browser's locale to them
  
   so the link to foo.css will look like foo_en_us.css for example.
  
   then when the url is requested wicket does the resolution with fallback:
  
   first try foo_en_us.css
   then try foo_en.css
   then try foo.css
  
   so it all still works...
  
   im not sure if there is a way for us to generate a url only with
   foo.css in it, because then wicket has to perform the same kind of
   resolution at url generation time... johan?
  
   -igor
  
  
   On Nov 10, 2007 11:48 AM, German Morales [EMAIL PROTECTED]
   wrote:
   Ok, please give me some time, i will ask someone (who is reading) with
   Netbeans 6 already installed to help me produce a quickstart.
  
   Anyway, i insist that now is all working for me, just that it is
 strange
   that it generates the HTML referencing the CSS with full locale and
   style,
   and then when the browser ask for the file, it seems that in that
 moment
   the look up is done and the correct available file is found. Perhaps
   that's the way it is supposed to work?
  
  
   German
  
   It seems that Johan Compagner wrote:
can you make a test case for this and attach it to an issue in your
   jira?
   
I did fix something in RC1 but i don't know if your case is fixed
   
The problem is that when you get or generate an url from a
ResourceReference
first bind() should be called. If that is then a PackageResource then
   the
ResourceReference
should get the locale of the PackageResource but i see that there
   could be
some issues with that.
   
But what doesn't happen is that the headerresponse doesn't call
 bind()
   for
us when you add a resource reference
that should also be fixed
   
johan
   
On Nov 9, 2007 5:54 PM, German Morales [EMAIL PROTECTED]
wrote:
   
1.3.0 beta 4
   
It seems that Johan Compagner wrote:
 I think i asked this before, but what version of wicket??

 Normally (in the current wicket 1.3 buids) a ResourceReference to
 a
 PackageResource will fallback to the real locale the
   PackageResource
is
 loaded
 from after the ResourceReference is binded.

 johan

 On Nov 9, 2007 3:34 PM, German Morales
   [EMAIL PROTECTED]
 wrote:

 Yes, at least that's what i see when i ask Firefox to show me the
source
 of the page.

 It seems that Johan Compagner wrote:
  But even with bind() it still shows you the locale in the url?
 
  On Nov 9, 2007 3:22 PM, German Morales
[EMAIL PROTECTED]
  wrote:
 
  Hi again,
 
  With your solution, the generated HTML now looks this way:
 
  link rel=stylesheet type=text/css
 
 href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css
/
 
  i don't have style_mystyle_mylocale.css, but only
style_mystyle.css
 
  But it works!
 
  So it seems that wicket later (when the browser asks for the
   css)
 makes
  the corresponding look up.
 
  Thanks a lot!
 
  German
 
  PS: just for the record (if someone reads this later), there
   was a
 easy
  typo in the code below. It should be Application.get() and not
  Application.bind().
 
  It seems that Johan Compagner wrote:
   no as i said before
   you have to create the resourcereference with the locale and
   the
  style.
   Those are not automatically picked up from the session. If
   you
 don't
  give
   them in the constructor
   then both are just null
  
   What you could do is this:
  
   ResourceReference reference = new
ResourceReference(MyPage.class,
   style.css,
   locale,style);
   reference.bind(Application.bind());
   cResponse.getHeaderResponse().renderCSSReference(reference);
   johan
  
  
  
   On Nov 9, 2007 1:55 PM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   version 1.3.0-beta4.
  
   I insist that the problem must be something different,
   perhaps
in
 the
   

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread German Morales
Ok, please give me some time, i will ask someone (who is reading) with
Netbeans 6 already installed to help me produce a quickstart.

Anyway, i insist that now is all working for me, just that it is strange
that it generates the HTML referencing the CSS with full locale and style,
and then when the browser ask for the file, it seems that in that moment
the look up is done and the correct available file is found. Perhaps
that's the way it is supposed to work?

German

It seems that Johan Compagner wrote:
 can you make a test case for this and attach it to an issue in your jira?

 I did fix something in RC1 but i don't know if your case is fixed

 The problem is that when you get or generate an url from a
 ResourceReference
 first bind() should be called. If that is then a PackageResource then the
 ResourceReference
 should get the locale of the PackageResource but i see that there could be
 some issues with that.

 But what doesn't happen is that the headerresponse doesn't call bind() for
 us when you add a resource reference
 that should also be fixed

 johan

 On Nov 9, 2007 5:54 PM, German Morales [EMAIL PROTECTED]
 wrote:

 1.3.0 beta 4

 It seems that Johan Compagner wrote:
  I think i asked this before, but what version of wicket??
 
  Normally (in the current wicket 1.3 buids) a ResourceReference to a
  PackageResource will fallback to the real locale the PackageResource
 is
  loaded
  from after the ResourceReference is binded.
 
  johan
 
  On Nov 9, 2007 3:34 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Yes, at least that's what i see when i ask Firefox to show me the
 source
  of the page.
 
  It seems that Johan Compagner wrote:
   But even with bind() it still shows you the locale in the url?
  
   On Nov 9, 2007 3:22 PM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   Hi again,
  
   With your solution, the generated HTML now looks this way:
  
   link rel=stylesheet type=text/css
   href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css
 /
  
   i don't have style_mystyle_mylocale.css, but only
 style_mystyle.css
  
   But it works!
  
   So it seems that wicket later (when the browser asks for the css)
  makes
   the corresponding look up.
  
   Thanks a lot!
  
   German
  
   PS: just for the record (if someone reads this later), there was a
  easy
   typo in the code below. It should be Application.get() and not
   Application.bind().
  
   It seems that Johan Compagner wrote:
no as i said before
you have to create the resourcereference with the locale and the
   style.
Those are not automatically picked up from the session. If you
  don't
   give
them in the constructor
then both are just null
   
What you could do is this:
   
ResourceReference reference = new
 ResourceReference(MyPage.class,
style.css,
locale,style);
reference.bind(Application.bind());
cResponse.getHeaderResponse().renderCSSReference(reference);
johan
   
   
   
On Nov 9, 2007 1:55 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
version 1.3.0-beta4.
   
I insist that the problem must be something different, perhaps
 in
  the
way
i pretend it to work. I know about the ResourceStreamLocator,
 and
  as
   i
tell it works perfectly for the HTML. The difference is that
 from
  my
class
the framework looks automatically for the corresponding HTML,
 but
  how
should it work for the CSS?
   
Should i declare it in the code?
   
  // on renderHead
  cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, style.css));
   
or how?
   
What i'm doing is very simple... i'm forcing (for testing) a
 call
  to
Session.setStyle(whatever), then i have MyPage.html and
MyPage_whatever.html (which works fine) and then style.css and
style_whatever.css (which i expect to be used thanks to the
 code
   above).
   
But when i see the generated html, it comes with the content of
MyPage_whatever.html, but the header is generated this way:
   
link rel=stylesheet type=text/css
href=resources/path.to.mypage.MyPage/style.css /
   
that is, not pointint to style_whatever.css as i expect.
   
Thanks for the support,
   
German
   
   
It seems that Johan Compagner wrote:
 it should fallback just fine..
 what version of wicket are you using?

 Because in the ResourceStreamLocator we do now this:

 public IResourceStream locate(final Class clazz, String path,
  final
String
 style,
final Locale locale, final String extension)
  {
   // Try the various combinations of style, locale and
 extension
  to
find
   // the resource.
   ResourceNameIterator iter = new ResourceNameIterator(path,
  style,
 locale,
 extension);
   while (iter.hasNext())
   {
String newPath = (String)iter.next();
IResourceStream stream = locate(clazz, newPath);
if (stream != null)
  

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread Igor Vaynberg
when wicket generates the links it appends your browser's locale to them

so the link to foo.css will look like foo_en_us.css for example.

then when the url is requested wicket does the resolution with fallback:

first try foo_en_us.css
then try foo_en.css
then try foo.css

so it all still works...

im not sure if there is a way for us to generate a url only with
foo.css in it, because then wicket has to perform the same kind of
resolution at url generation time... johan?

-igor


On Nov 10, 2007 11:48 AM, German Morales [EMAIL PROTECTED] wrote:
 Ok, please give me some time, i will ask someone (who is reading) with
 Netbeans 6 already installed to help me produce a quickstart.

 Anyway, i insist that now is all working for me, just that it is strange
 that it generates the HTML referencing the CSS with full locale and style,
 and then when the browser ask for the file, it seems that in that moment
 the look up is done and the correct available file is found. Perhaps
 that's the way it is supposed to work?


 German

 It seems that Johan Compagner wrote:
  can you make a test case for this and attach it to an issue in your jira?
 
  I did fix something in RC1 but i don't know if your case is fixed
 
  The problem is that when you get or generate an url from a
  ResourceReference
  first bind() should be called. If that is then a PackageResource then the
  ResourceReference
  should get the locale of the PackageResource but i see that there could be
  some issues with that.
 
  But what doesn't happen is that the headerresponse doesn't call bind() for
  us when you add a resource reference
  that should also be fixed
 
  johan
 
  On Nov 9, 2007 5:54 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  1.3.0 beta 4
 
  It seems that Johan Compagner wrote:
   I think i asked this before, but what version of wicket??
  
   Normally (in the current wicket 1.3 buids) a ResourceReference to a
   PackageResource will fallback to the real locale the PackageResource
  is
   loaded
   from after the ResourceReference is binded.
  
   johan
  
   On Nov 9, 2007 3:34 PM, German Morales [EMAIL PROTECTED]
   wrote:
  
   Yes, at least that's what i see when i ask Firefox to show me the
  source
   of the page.
  
   It seems that Johan Compagner wrote:
But even with bind() it still shows you the locale in the url?
   
On Nov 9, 2007 3:22 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi again,
   
With your solution, the generated HTML now looks this way:
   
link rel=stylesheet type=text/css
href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css
  /
   
i don't have style_mystyle_mylocale.css, but only
  style_mystyle.css
   
But it works!
   
So it seems that wicket later (when the browser asks for the css)
   makes
the corresponding look up.
   
Thanks a lot!
   
German
   
PS: just for the record (if someone reads this later), there was a
   easy
typo in the code below. It should be Application.get() and not
Application.bind().
   
It seems that Johan Compagner wrote:
 no as i said before
 you have to create the resourcereference with the locale and the
style.
 Those are not automatically picked up from the session. If you
   don't
give
 them in the constructor
 then both are just null

 What you could do is this:

 ResourceReference reference = new
  ResourceReference(MyPage.class,
 style.css,
 locale,style);
 reference.bind(Application.bind());
 cResponse.getHeaderResponse().renderCSSReference(reference);
 johan



 On Nov 9, 2007 1:55 PM, German Morales
   [EMAIL PROTECTED]
 wrote:

 version 1.3.0-beta4.

 I insist that the problem must be something different, perhaps
  in
   the
 way
 i pretend it to work. I know about the ResourceStreamLocator,
  and
   as
i
 tell it works perfectly for the HTML. The difference is that
  from
   my
 class
 the framework looks automatically for the corresponding HTML,
  but
   how
 should it work for the CSS?

 Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));

 or how?

 What i'm doing is very simple... i'm forcing (for testing) a
  call
   to
 Session.setStyle(whatever), then i have MyPage.html and
 MyPage_whatever.html (which works fine) and then style.css and
 style_whatever.css (which i expect to be used thanks to the
  code
above).

 But when i see the generated html, it comes with the content of
 MyPage_whatever.html, but the header is generated this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style.css /

 that is, not pointint to style_whatever.css as i expect.

 Thanks for the support,

 German


 It seems that 

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread German Morales
So perhaps there's nothing wrong after all?

It seems that Igor Vaynberg wrote:
 when wicket generates the links it appends your browser's locale to them

 so the link to foo.css will look like foo_en_us.css for example.

 then when the url is requested wicket does the resolution with fallback:

 first try foo_en_us.css
 then try foo_en.css
 then try foo.css

 so it all still works...

 im not sure if there is a way for us to generate a url only with
 foo.css in it, because then wicket has to perform the same kind of
 resolution at url generation time... johan?

 -igor


 On Nov 10, 2007 11:48 AM, German Morales [EMAIL PROTECTED]
 wrote:
 Ok, please give me some time, i will ask someone (who is reading) with
 Netbeans 6 already installed to help me produce a quickstart.

 Anyway, i insist that now is all working for me, just that it is strange
 that it generates the HTML referencing the CSS with full locale and
 style,
 and then when the browser ask for the file, it seems that in that moment
 the look up is done and the correct available file is found. Perhaps
 that's the way it is supposed to work?


 German

 It seems that Johan Compagner wrote:
  can you make a test case for this and attach it to an issue in your
 jira?
 
  I did fix something in RC1 but i don't know if your case is fixed
 
  The problem is that when you get or generate an url from a
  ResourceReference
  first bind() should be called. If that is then a PackageResource then
 the
  ResourceReference
  should get the locale of the PackageResource but i see that there
 could be
  some issues with that.
 
  But what doesn't happen is that the headerresponse doesn't call bind()
 for
  us when you add a resource reference
  that should also be fixed
 
  johan
 
  On Nov 9, 2007 5:54 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  1.3.0 beta 4
 
  It seems that Johan Compagner wrote:
   I think i asked this before, but what version of wicket??
  
   Normally (in the current wicket 1.3 buids) a ResourceReference to a
   PackageResource will fallback to the real locale the
 PackageResource
  is
   loaded
   from after the ResourceReference is binded.
  
   johan
  
   On Nov 9, 2007 3:34 PM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   Yes, at least that's what i see when i ask Firefox to show me the
  source
   of the page.
  
   It seems that Johan Compagner wrote:
But even with bind() it still shows you the locale in the url?
   
On Nov 9, 2007 3:22 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi again,
   
With your solution, the generated HTML now looks this way:
   
link rel=stylesheet type=text/css
href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css
  /
   
i don't have style_mystyle_mylocale.css, but only
  style_mystyle.css
   
But it works!
   
So it seems that wicket later (when the browser asks for the
 css)
   makes
the corresponding look up.
   
Thanks a lot!
   
German
   
PS: just for the record (if someone reads this later), there
 was a
   easy
typo in the code below. It should be Application.get() and not
Application.bind().
   
It seems that Johan Compagner wrote:
 no as i said before
 you have to create the resourcereference with the locale and
 the
style.
 Those are not automatically picked up from the session. If
 you
   don't
give
 them in the constructor
 then both are just null

 What you could do is this:

 ResourceReference reference = new
  ResourceReference(MyPage.class,
 style.css,
 locale,style);
 reference.bind(Application.bind());
 cResponse.getHeaderResponse().renderCSSReference(reference);
 johan



 On Nov 9, 2007 1:55 PM, German Morales
   [EMAIL PROTECTED]
 wrote:

 version 1.3.0-beta4.

 I insist that the problem must be something different,
 perhaps
  in
   the
 way
 i pretend it to work. I know about the
 ResourceStreamLocator,
  and
   as
i
 tell it works perfectly for the HTML. The difference is that
  from
   my
 class
 the framework looks automatically for the corresponding
 HTML,
  but
   how
 should it work for the CSS?

 Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));

 or how?

 What i'm doing is very simple... i'm forcing (for testing) a
  call
   to
 Session.setStyle(whatever), then i have MyPage.html and
 MyPage_whatever.html (which works fine) and then style.css
 and
 style_whatever.css (which i expect to be used thanks to the
  code
above).

 But when i see the generated html, it comes with the content
 of
 MyPage_whatever.html, but the header is generated this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style.css /

 that is, not pointint to 

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread Igor Vaynberg
the only thing that is wrong is that perhaps we COULD generate a url
without locale and we DONT. but i am american, so im not that familiar
with the whole locale thing. johan is a better guy to ask for this...

-gor


On Nov 10, 2007 1:24 PM, German Morales [EMAIL PROTECTED] wrote:
 So perhaps there's nothing wrong after all?


 It seems that Igor Vaynberg wrote:
  when wicket generates the links it appends your browser's locale to them
 
  so the link to foo.css will look like foo_en_us.css for example.
 
  then when the url is requested wicket does the resolution with fallback:
 
  first try foo_en_us.css
  then try foo_en.css
  then try foo.css
 
  so it all still works...
 
  im not sure if there is a way for us to generate a url only with
  foo.css in it, because then wicket has to perform the same kind of
  resolution at url generation time... johan?
 
  -igor
 
 
  On Nov 10, 2007 11:48 AM, German Morales [EMAIL PROTECTED]
  wrote:
  Ok, please give me some time, i will ask someone (who is reading) with
  Netbeans 6 already installed to help me produce a quickstart.
 
  Anyway, i insist that now is all working for me, just that it is strange
  that it generates the HTML referencing the CSS with full locale and
  style,
  and then when the browser ask for the file, it seems that in that moment
  the look up is done and the correct available file is found. Perhaps
  that's the way it is supposed to work?
 
 
  German
 
  It seems that Johan Compagner wrote:
   can you make a test case for this and attach it to an issue in your
  jira?
  
   I did fix something in RC1 but i don't know if your case is fixed
  
   The problem is that when you get or generate an url from a
   ResourceReference
   first bind() should be called. If that is then a PackageResource then
  the
   ResourceReference
   should get the locale of the PackageResource but i see that there
  could be
   some issues with that.
  
   But what doesn't happen is that the headerresponse doesn't call bind()
  for
   us when you add a resource reference
   that should also be fixed
  
   johan
  
   On Nov 9, 2007 5:54 PM, German Morales [EMAIL PROTECTED]
   wrote:
  
   1.3.0 beta 4
  
   It seems that Johan Compagner wrote:
I think i asked this before, but what version of wicket??
   
Normally (in the current wicket 1.3 buids) a ResourceReference to a
PackageResource will fallback to the real locale the
  PackageResource
   is
loaded
from after the ResourceReference is binded.
   
johan
   
On Nov 9, 2007 3:34 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Yes, at least that's what i see when i ask Firefox to show me the
   source
of the page.
   
It seems that Johan Compagner wrote:
 But even with bind() it still shows you the locale in the url?

 On Nov 9, 2007 3:22 PM, German Morales
   [EMAIL PROTECTED]
 wrote:

 Hi again,

 With your solution, the generated HTML now looks this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css
   /

 i don't have style_mystyle_mylocale.css, but only
   style_mystyle.css

 But it works!

 So it seems that wicket later (when the browser asks for the
  css)
makes
 the corresponding look up.

 Thanks a lot!

 German

 PS: just for the record (if someone reads this later), there
  was a
easy
 typo in the code below. It should be Application.get() and not
 Application.bind().

 It seems that Johan Compagner wrote:
  no as i said before
  you have to create the resourcereference with the locale and
  the
 style.
  Those are not automatically picked up from the session. If
  you
don't
 give
  them in the constructor
  then both are just null
 
  What you could do is this:
 
  ResourceReference reference = new
   ResourceReference(MyPage.class,
  style.css,
  locale,style);
  reference.bind(Application.bind());
  cResponse.getHeaderResponse().renderCSSReference(reference);
  johan
 
 
 
  On Nov 9, 2007 1:55 PM, German Morales
[EMAIL PROTECTED]
  wrote:
 
  version 1.3.0-beta4.
 
  I insist that the problem must be something different,
  perhaps
   in
the
  way
  i pretend it to work. I know about the
  ResourceStreamLocator,
   and
as
 i
  tell it works perfectly for the HTML. The difference is that
   from
my
  class
  the framework looks automatically for the corresponding
  HTML,
   but
how
  should it work for the CSS?
 
  Should i declare it in the code?
 
// on renderHead
cResponse.getHeaderResponse().renderCSSReference(new
  ResourceReference(MyPage.class, style.css));
 
  or how?
 
  What i'm doing is very simple... i'm forcing (for testing) a
   call
to
  

Re: ResourceReference with locale and style, for CSSs

2007-11-10 Thread Francisco Diaz Trepat - gmail
no problem.
:-)
f(t)

ps: even from my cel, on a date, saturday night, sad... :-)

On 11/10/07, German Morales [EMAIL PROTECTED] wrote:
 Ok, please give me some time, i will ask someone (who is reading) with
 Netbeans 6 already installed to help me produce a quickstart.

 Anyway, i insist that now is all working for me, just that it is strange
 that it generates the HTML referencing the CSS with full locale and style,
 and then when the browser ask for the file, it seems that in that moment
 the look up is done and the correct available file is found. Perhaps
 that's the way it is supposed to work?

 German

 It seems that Johan Compagner wrote:
  can you make a test case for this and attach it to an issue in your jira?
 
  I did fix something in RC1 but i don't know if your case is fixed
 
  The problem is that when you get or generate an url from a
  ResourceReference
  first bind() should be called. If that is then a PackageResource then the
  ResourceReference
  should get the locale of the PackageResource but i see that there could be
  some issues with that.
 
  But what doesn't happen is that the headerresponse doesn't call bind() for
  us when you add a resource reference
  that should also be fixed
 
  johan
 
  On Nov 9, 2007 5:54 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  1.3.0 beta 4
 
  It seems that Johan Compagner wrote:
   I think i asked this before, but what version of wicket??
  
   Normally (in the current wicket 1.3 buids) a ResourceReference to a
   PackageResource will fallback to the real locale the PackageResource
  is
   loaded
   from after the ResourceReference is binded.
  
   johan
  
   On Nov 9, 2007 3:34 PM, German Morales [EMAIL PROTECTED]
   wrote:
  
   Yes, at least that's what i see when i ask Firefox to show me the
  source
   of the page.
  
   It seems that Johan Compagner wrote:
But even with bind() it still shows you the locale in the url?
   
On Nov 9, 2007 3:22 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi again,
   
With your solution, the generated HTML now looks this way:
   
link rel=stylesheet type=text/css
href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css
  /
   
i don't have style_mystyle_mylocale.css, but only
  style_mystyle.css
   
But it works!
   
So it seems that wicket later (when the browser asks for the css)
   makes
the corresponding look up.
   
Thanks a lot!
   
German
   
PS: just for the record (if someone reads this later), there was a
   easy
typo in the code below. It should be Application.get() and not
Application.bind().
   
It seems that Johan Compagner wrote:
 no as i said before
 you have to create the resourcereference with the locale and the
style.
 Those are not automatically picked up from the session. If you
   don't
give
 them in the constructor
 then both are just null

 What you could do is this:

 ResourceReference reference = new
  ResourceReference(MyPage.class,
 style.css,
 locale,style);
 reference.bind(Application.bind());
 cResponse.getHeaderResponse().renderCSSReference(reference);
 johan



 On Nov 9, 2007 1:55 PM, German Morales
   [EMAIL PROTECTED]
 wrote:

 version 1.3.0-beta4.

 I insist that the problem must be something different, perhaps
  in
   the
 way
 i pretend it to work. I know about the ResourceStreamLocator,
  and
   as
i
 tell it works perfectly for the HTML. The difference is that
  from
   my
 class
 the framework looks automatically for the corresponding HTML,
  but
   how
 should it work for the CSS?

 Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));

 or how?

 What i'm doing is very simple... i'm forcing (for testing) a
  call
   to
 Session.setStyle(whatever), then i have MyPage.html and
 MyPage_whatever.html (which works fine) and then style.css and
 style_whatever.css (which i expect to be used thanks to the
  code
above).

 But when i see the generated html, it comes with the content of
 MyPage_whatever.html, but the header is generated this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style.css /

 that is, not pointint to style_whatever.css as i expect.

 Thanks for the support,

 German


 It seems that Johan Compagner wrote:
  it should fallback just fine..
  what version of wicket are you using?
 
  Because in the ResourceStreamLocator we do now this:
 
  public IResourceStream locate(final Class clazz, String path,
   final
 String
  style,
 final Locale locale, final String extension)
   {
// Try the various combinations of style, locale and
  extension
   to
  

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi,

I was thinking (as a last hope) that if this works for the HTMLs, i could
provide different HTMLs that point internally to different CSSs, and it
should work. But that would be duplicating the HTML just to have the CSS
changed, and then it's not a good idea.

Perhaps someone can tell me an official way to have localized and styled
CSSs, the wicket way?

Thanks again,

German

It seems that German Morales wrote:
 Hi,

 I use it inside a page.

 I've tried...

// inside the page constructor
add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
 style.css)));

 and

// inside renderHead
cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));


 And I don't want to set the style and locale explicitely. What i want is
 to deliver the application to a customer, and, if he wants, he adds the
 customized page for a locale or style by itself (he could set the style
 with a parameter or whatever). And as far as i understand the wicket
 approach, that's how it should work automatically. In fact it works
 perfecly when i do it for the html of the same page. The difference is
 that the html is handled in other way (the framework does it) and when i
 try to do it for the CSS of the page i do it (and it doesn't work). So
 there must be something i'm not doing properly.

 Or, how should be the way to provide styled CSSs, there is another
 aproach?

 thanks and bye,

 German

 It seems that Eelco Hillenius wrote:
 The problem is that the file is there... just that it doesn't seem to
 be
 looking for it.

 If i force the full constructor:

 new ResourceReference(MyPage.class, style.css, getLocale(),
 getStyle())

 all works, so the file is correcly found and the name is correct.

 The problem is when i don't set the locale and style explicitely (as it
 is
 supposed to be done):

 new ResourceReference(MyPage.class, style.css)

 then it doesn't find the file. Actually i think it doesn't even try to
 find it, since as i mention i put a breakpoint in
 ResourceReference#setStyle() and nobody is calling it. So later
 internal
 code to load the resource uses style and locale with null values.

 How do you use the resource reference? I think the class was designed
 in such a way that the components that use it (Image for instance) are
 responsible for setting the appropriate locale/ style 'just in time',
 so that switching locales etc works.

 Eelco

 -
 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]



Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread Johan Compagner
if you are creating your own ResourceReferences then you have to give the
style and locale to them
We could enhance the constructors that it does Session.get().getLocale() and
Session.get().getStyle()
if you dont give them..

johan



On Nov 9, 2007 10:27 AM, German Morales [EMAIL PROTECTED] wrote:

 Hi,

 I was thinking (as a last hope) that if this works for the HTMLs, i could
 provide different HTMLs that point internally to different CSSs, and it
 should work. But that would be duplicating the HTML just to have the CSS
 changed, and then it's not a good idea.

 Perhaps someone can tell me an official way to have localized and styled
 CSSs, the wicket way?

 Thanks again,

 German

 It seems that German Morales wrote:
  Hi,
 
  I use it inside a page.
 
  I've tried...
 
 // inside the page constructor
 add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
  style.css)));
 
  and
 
 // inside renderHead
 cResponse.getHeaderResponse().renderCSSReference(new
  ResourceReference(MyPage.class, style.css));
 
 
  And I don't want to set the style and locale explicitely. What i want is
  to deliver the application to a customer, and, if he wants, he adds the
  customized page for a locale or style by itself (he could set the style
  with a parameter or whatever). And as far as i understand the wicket
  approach, that's how it should work automatically. In fact it works
  perfecly when i do it for the html of the same page. The difference is
  that the html is handled in other way (the framework does it) and when i
  try to do it for the CSS of the page i do it (and it doesn't work). So
  there must be something i'm not doing properly.
 
  Or, how should be the way to provide styled CSSs, there is another
  aproach?
 
  thanks and bye,
 
  German
 
  It seems that Eelco Hillenius wrote:
  The problem is that the file is there... just that it doesn't seem to
  be
  looking for it.
 
  If i force the full constructor:
 
  new ResourceReference(MyPage.class, style.css, getLocale(),
  getStyle())
 
  all works, so the file is correcly found and the name is correct.
 
  The problem is when i don't set the locale and style explicitely (as
 it
  is
  supposed to be done):
 
  new ResourceReference(MyPage.class, style.css)
 
  then it doesn't find the file. Actually i think it doesn't even try to
  find it, since as i mention i put a breakpoint in
  ResourceReference#setStyle() and nobody is calling it. So later
  internal
  code to load the resource uses style and locale with null values.
 
  How do you use the resource reference? I think the class was designed
  in such a way that the components that use it (Image for instance) are
  responsible for setting the appropriate locale/ style 'just in time',
  so that switching locales etc works.
 
  Eelco
 
  -
  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]




Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread Johan Compagner
it should fallback just fine..
what version of wicket are you using?

Because in the ResourceStreamLocator we do now this:

public IResourceStream locate(final Class clazz, String path, final String
style,
   final Locale locale, final String extension)
 {
  // Try the various combinations of style, locale and extension to find
  // the resource.
  ResourceNameIterator iter = new ResourceNameIterator(path, style, locale,
extension);
  while (iter.hasNext())
  {
   String newPath = (String)iter.next();
   IResourceStream stream = locate(clazz, newPath);
   if (stream != null)
   {
stream.setLocale(iter.getLocale());
return stream;
   }
  }
  return null;
 }

johan



On Nov 9, 2007 1:11 PM, German Morales [EMAIL PROTECTED] wrote:

 Hi again,

 Also, the problem is not giving the parameters to the ResourceReferences,
 if i call the full constructor then the ResourceReference works, but the
 problem is that it does not make a look up to see what's available, it
 just goes for the full thing. So, if i call the constructor with the
 session locale and style, what it does is search for the file
 style_mystyle_mylocale.css. This is not my intention, what i want it that
 that the framework searches for the style_mystyle_mylocale.css, then if
 not found fall back to style_mystyle.css, style_mylocale.css, style.css
 and so on (i'm not sure of the exact order of look up). So, modifying the
 constructor or passing the full parameters is not the solution, i think.


 Regards,

 German

 It seems that Johan Compagner wrote:
   if you are creating your own ResourceReferences then you have to give
 the
  style and locale to them
  We could enhance the constructors that it does Session.get().getLocale()
  and
  Session.get().getStyle()
  if you dont give them..
 
  johan
 
 
 
  On Nov 9, 2007 10:27 AM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi,
 
  I was thinking (as a last hope) that if this works for the HTMLs, i
  could
  provide different HTMLs that point internally to different CSSs, and it
  should work. But that would be duplicating the HTML just to have the
 CSS
  changed, and then it's not a good idea.
 
  Perhaps someone can tell me an official way to have localized and
 styled
  CSSs, the wicket way?
 
  Thanks again,
 
  German
 
  It seems that German Morales wrote:
   Hi,
  
   I use it inside a page.
  
   I've tried...
  
  // inside the page constructor
  add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
   style.css)));
  
   and
  
  // inside renderHead
  cResponse.getHeaderResponse().renderCSSReference(new
   ResourceReference(MyPage.class, style.css));
  
  
   And I don't want to set the style and locale explicitely. What i want
  is
   to deliver the application to a customer, and, if he wants, he adds
  the
   customized page for a locale or style by itself (he could set the
  style
   with a parameter or whatever). And as far as i understand the wicket
   approach, that's how it should work automatically. In fact it works
   perfecly when i do it for the html of the same page. The difference
 is
   that the html is handled in other way (the framework does it) and
 when
  i
   try to do it for the CSS of the page i do it (and it doesn't work).
 So
   there must be something i'm not doing properly.
  
   Or, how should be the way to provide styled CSSs, there is another
   aproach?
  
   thanks and bye,
  
   German
  
   It seems that Eelco Hillenius wrote:
   The problem is that the file is there... just that it doesn't seem
  to
   be
   looking for it.
  
   If i force the full constructor:
  
   new ResourceReference(MyPage.class, style.css, getLocale(),
   getStyle())
  
   all works, so the file is correcly found and the name is correct.
  
   The problem is when i don't set the locale and style explicitely
 (as
  it
   is
   supposed to be done):
  
   new ResourceReference(MyPage.class, style.css)
  
   then it doesn't find the file. Actually i think it doesn't even try
  to
   find it, since as i mention i put a breakpoint in
   ResourceReference#setStyle() and nobody is calling it. So later
   internal
   code to load the resource uses style and locale with null values.
  
   How do you use the resource reference? I think the class was
 designed
   in such a way that the components that use it (Image for instance)
  are
   responsible for setting the appropriate locale/ style 'just in
 time',
   so that switching locales etc works.
  
   Eelco
  
  
 -
   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 

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi,

Well, i'm not sure to want to be creating the ResourceReferences on my
own. Is there another way to have the same i have for HTML (automatic look
up by the framework for localized and styled versions) but for CSSs?

German

It seems that Johan Compagner wrote:
 if you are creating your own ResourceReferences then you have to give the
 style and locale to them
 We could enhance the constructors that it does Session.get().getLocale()
 and
 Session.get().getStyle()
 if you dont give them..

 johan



 On Nov 9, 2007 10:27 AM, German Morales [EMAIL PROTECTED]
 wrote:

 Hi,

 I was thinking (as a last hope) that if this works for the HTMLs, i
 could
 provide different HTMLs that point internally to different CSSs, and it
 should work. But that would be duplicating the HTML just to have the CSS
 changed, and then it's not a good idea.

 Perhaps someone can tell me an official way to have localized and styled
 CSSs, the wicket way?

 Thanks again,

 German

 It seems that German Morales wrote:
  Hi,
 
  I use it inside a page.
 
  I've tried...
 
 // inside the page constructor
 add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
  style.css)));
 
  and
 
 // inside renderHead
 cResponse.getHeaderResponse().renderCSSReference(new
  ResourceReference(MyPage.class, style.css));
 
 
  And I don't want to set the style and locale explicitely. What i want
 is
  to deliver the application to a customer, and, if he wants, he adds
 the
  customized page for a locale or style by itself (he could set the
 style
  with a parameter or whatever). And as far as i understand the wicket
  approach, that's how it should work automatically. In fact it works
  perfecly when i do it for the html of the same page. The difference is
  that the html is handled in other way (the framework does it) and when
 i
  try to do it for the CSS of the page i do it (and it doesn't work). So
  there must be something i'm not doing properly.
 
  Or, how should be the way to provide styled CSSs, there is another
  aproach?
 
  thanks and bye,
 
  German
 
  It seems that Eelco Hillenius wrote:
  The problem is that the file is there... just that it doesn't seem
 to
  be
  looking for it.
 
  If i force the full constructor:
 
  new ResourceReference(MyPage.class, style.css, getLocale(),
  getStyle())
 
  all works, so the file is correcly found and the name is correct.
 
  The problem is when i don't set the locale and style explicitely (as
 it
  is
  supposed to be done):
 
  new ResourceReference(MyPage.class, style.css)
 
  then it doesn't find the file. Actually i think it doesn't even try
 to
  find it, since as i mention i put a breakpoint in
  ResourceReference#setStyle() and nobody is calling it. So later
  internal
  code to load the resource uses style and locale with null values.
 
  How do you use the resource reference? I think the class was designed
  in such a way that the components that use it (Image for instance)
 are
  responsible for setting the appropriate locale/ style 'just in time',
  so that switching locales etc works.
 
  Eelco
 
  -
  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]






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



Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
version 1.3.0-beta4.

I insist that the problem must be something different, perhaps in the way
i pretend it to work. I know about the ResourceStreamLocator, and as i
tell it works perfectly for the HTML. The difference is that from my class
the framework looks automatically for the corresponding HTML, but how
should it work for the CSS?

Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, style.css));

or how?

What i'm doing is very simple... i'm forcing (for testing) a call to
Session.setStyle(whatever), then i have MyPage.html and
MyPage_whatever.html (which works fine) and then style.css and
style_whatever.css (which i expect to be used thanks to the code above).

But when i see the generated html, it comes with the content of
MyPage_whatever.html, but the header is generated this way:

link rel=stylesheet type=text/css
href=resources/path.to.mypage.MyPage/style.css /

that is, not pointint to style_whatever.css as i expect.

Thanks for the support,

German


It seems that Johan Compagner wrote:
 it should fallback just fine..
 what version of wicket are you using?

 Because in the ResourceStreamLocator we do now this:

 public IResourceStream locate(final Class clazz, String path, final String
 style,
final Locale locale, final String extension)
  {
   // Try the various combinations of style, locale and extension to find
   // the resource.
   ResourceNameIterator iter = new ResourceNameIterator(path, style,
 locale,
 extension);
   while (iter.hasNext())
   {
String newPath = (String)iter.next();
IResourceStream stream = locate(clazz, newPath);
if (stream != null)
{
 stream.setLocale(iter.getLocale());
 return stream;
}
   }
   return null;
  }

 johan



 On Nov 9, 2007 1:11 PM, German Morales [EMAIL PROTECTED]
 wrote:

 Hi again,

 Also, the problem is not giving the parameters to the
 ResourceReferences,
 if i call the full constructor then the ResourceReference works, but the
 problem is that it does not make a look up to see what's available, it
 just goes for the full thing. So, if i call the constructor with the
 session locale and style, what it does is search for the file
 style_mystyle_mylocale.css. This is not my intention, what i want it
 that
 that the framework searches for the style_mystyle_mylocale.css, then if
 not found fall back to style_mystyle.css, style_mylocale.css, style.css
 and so on (i'm not sure of the exact order of look up). So, modifying
 the
 constructor or passing the full parameters is not the solution, i think.


 Regards,

 German

 It seems that Johan Compagner wrote:
   if you are creating your own ResourceReferences then you have to give
 the
  style and locale to them
  We could enhance the constructors that it does
 Session.get().getLocale()
  and
  Session.get().getStyle()
  if you dont give them..
 
  johan
 
 
 
  On Nov 9, 2007 10:27 AM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi,
 
  I was thinking (as a last hope) that if this works for the HTMLs, i
  could
  provide different HTMLs that point internally to different CSSs, and
 it
  should work. But that would be duplicating the HTML just to have the
 CSS
  changed, and then it's not a good idea.
 
  Perhaps someone can tell me an official way to have localized and
 styled
  CSSs, the wicket way?
 
  Thanks again,
 
  German
 
  It seems that German Morales wrote:
   Hi,
  
   I use it inside a page.
  
   I've tried...
  
  // inside the page constructor
  add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
   style.css)));
  
   and
  
  // inside renderHead
  cResponse.getHeaderResponse().renderCSSReference(new
   ResourceReference(MyPage.class, style.css));
  
  
   And I don't want to set the style and locale explicitely. What i
 want
  is
   to deliver the application to a customer, and, if he wants, he adds
  the
   customized page for a locale or style by itself (he could set the
  style
   with a parameter or whatever). And as far as i understand the
 wicket
   approach, that's how it should work automatically. In fact it works
   perfecly when i do it for the html of the same page. The difference
 is
   that the html is handled in other way (the framework does it) and
 when
  i
   try to do it for the CSS of the page i do it (and it doesn't work).
 So
   there must be something i'm not doing properly.
  
   Or, how should be the way to provide styled CSSs, there is another
   aproach?
  
   thanks and bye,
  
   German
  
   It seems that Eelco Hillenius wrote:
   The problem is that the file is there... just that it doesn't
 seem
  to
   be
   looking for it.
  
   If i force the full constructor:
  
   new ResourceReference(MyPage.class, style.css, getLocale(),
   getStyle())
  
   all works, so the file is correcly found and the name is correct.
  
   The problem is when i don't set the locale and style explicitely
 (as
  it
   is
   

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread Johan Compagner
no as i said before
you have to create the resourcereference with the locale and the style.
Those are not automatically picked up from the session. If you don't give
them in the constructor
then both are just null

What you could do is this:

ResourceReference reference = new ResourceReference(MyPage.class, style.css,
locale,style);
reference.bind(Application.bind());
cResponse.getHeaderResponse().renderCSSReference(reference);
johan



On Nov 9, 2007 1:55 PM, German Morales [EMAIL PROTECTED] wrote:

 version 1.3.0-beta4.

 I insist that the problem must be something different, perhaps in the way
 i pretend it to work. I know about the ResourceStreamLocator, and as i
 tell it works perfectly for the HTML. The difference is that from my class
 the framework looks automatically for the corresponding HTML, but how
 should it work for the CSS?

 Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));

 or how?

 What i'm doing is very simple... i'm forcing (for testing) a call to
 Session.setStyle(whatever), then i have MyPage.html and
 MyPage_whatever.html (which works fine) and then style.css and
 style_whatever.css (which i expect to be used thanks to the code above).

 But when i see the generated html, it comes with the content of
 MyPage_whatever.html, but the header is generated this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style.css /

 that is, not pointint to style_whatever.css as i expect.

 Thanks for the support,

 German


 It seems that Johan Compagner wrote:
  it should fallback just fine..
  what version of wicket are you using?
 
  Because in the ResourceStreamLocator we do now this:
 
  public IResourceStream locate(final Class clazz, String path, final
 String
  style,
 final Locale locale, final String extension)
   {
// Try the various combinations of style, locale and extension to find
// the resource.
ResourceNameIterator iter = new ResourceNameIterator(path, style,
  locale,
  extension);
while (iter.hasNext())
{
 String newPath = (String)iter.next();
 IResourceStream stream = locate(clazz, newPath);
 if (stream != null)
 {
  stream.setLocale(iter.getLocale());
  return stream;
 }
}
return null;
   }
 
  johan
 
 
 
  On Nov 9, 2007 1:11 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi again,
 
  Also, the problem is not giving the parameters to the
  ResourceReferences,
  if i call the full constructor then the ResourceReference works, but
 the
  problem is that it does not make a look up to see what's available, it
  just goes for the full thing. So, if i call the constructor with the
  session locale and style, what it does is search for the file
  style_mystyle_mylocale.css. This is not my intention, what i want it
  that
  that the framework searches for the style_mystyle_mylocale.css, then if
  not found fall back to style_mystyle.css, style_mylocale.css, style.css
  and so on (i'm not sure of the exact order of look up). So, modifying
  the
  constructor or passing the full parameters is not the solution, i
 think.
 
 
  Regards,
 
  German
 
  It seems that Johan Compagner wrote:
if you are creating your own ResourceReferences then you have to
 give
  the
   style and locale to them
   We could enhance the constructors that it does
  Session.get().getLocale()
   and
   Session.get().getStyle()
   if you dont give them..
  
   johan
  
  
  
   On Nov 9, 2007 10:27 AM, German Morales [EMAIL PROTECTED]
   wrote:
  
   Hi,
  
   I was thinking (as a last hope) that if this works for the HTMLs, i
   could
   provide different HTMLs that point internally to different CSSs, and
  it
   should work. But that would be duplicating the HTML just to have the
  CSS
   changed, and then it's not a good idea.
  
   Perhaps someone can tell me an official way to have localized and
  styled
   CSSs, the wicket way?
  
   Thanks again,
  
   German
  
   It seems that German Morales wrote:
Hi,
   
I use it inside a page.
   
I've tried...
   
   // inside the page constructor
   add(HeaderContributor.forCss(new ResourceReference(MyPage.class
 ,
style.css)));
   
and
   
   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, style.css));
   
   
And I don't want to set the style and locale explicitely. What i
  want
   is
to deliver the application to a customer, and, if he wants, he
 adds
   the
customized page for a locale or style by itself (he could set the
   style
with a parameter or whatever). And as far as i understand the
  wicket
approach, that's how it should work automatically. In fact it
 works
perfecly when i do it for the html of the same page. The
 difference
  is
that the html is handled in other way (the framework does it) and
  when
   i
try to do 

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Hi again,

With your solution, the generated HTML now looks this way:

link rel=stylesheet type=text/css
href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css /

i don't have style_mystyle_mylocale.css, but only style_mystyle.css

But it works!

So it seems that wicket later (when the browser asks for the css) makes
the corresponding look up.

Thanks a lot!

German

PS: just for the record (if someone reads this later), there was a easy
typo in the code below. It should be Application.get() and not
Application.bind().

It seems that Johan Compagner wrote:
 no as i said before
 you have to create the resourcereference with the locale and the style.
 Those are not automatically picked up from the session. If you don't give
 them in the constructor
 then both are just null

 What you could do is this:

 ResourceReference reference = new ResourceReference(MyPage.class,
 style.css,
 locale,style);
 reference.bind(Application.bind());
 cResponse.getHeaderResponse().renderCSSReference(reference);
 johan



 On Nov 9, 2007 1:55 PM, German Morales [EMAIL PROTECTED]
 wrote:

 version 1.3.0-beta4.

 I insist that the problem must be something different, perhaps in the
 way
 i pretend it to work. I know about the ResourceStreamLocator, and as i
 tell it works perfectly for the HTML. The difference is that from my
 class
 the framework looks automatically for the corresponding HTML, but how
 should it work for the CSS?

 Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));

 or how?

 What i'm doing is very simple... i'm forcing (for testing) a call to
 Session.setStyle(whatever), then i have MyPage.html and
 MyPage_whatever.html (which works fine) and then style.css and
 style_whatever.css (which i expect to be used thanks to the code above).

 But when i see the generated html, it comes with the content of
 MyPage_whatever.html, but the header is generated this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style.css /

 that is, not pointint to style_whatever.css as i expect.

 Thanks for the support,

 German


 It seems that Johan Compagner wrote:
  it should fallback just fine..
  what version of wicket are you using?
 
  Because in the ResourceStreamLocator we do now this:
 
  public IResourceStream locate(final Class clazz, String path, final
 String
  style,
 final Locale locale, final String extension)
   {
// Try the various combinations of style, locale and extension to
 find
// the resource.
ResourceNameIterator iter = new ResourceNameIterator(path, style,
  locale,
  extension);
while (iter.hasNext())
{
 String newPath = (String)iter.next();
 IResourceStream stream = locate(clazz, newPath);
 if (stream != null)
 {
  stream.setLocale(iter.getLocale());
  return stream;
 }
}
return null;
   }
 
  johan
 
 
 
  On Nov 9, 2007 1:11 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi again,
 
  Also, the problem is not giving the parameters to the
  ResourceReferences,
  if i call the full constructor then the ResourceReference works, but
 the
  problem is that it does not make a look up to see what's available,
 it
  just goes for the full thing. So, if i call the constructor with the
  session locale and style, what it does is search for the file
  style_mystyle_mylocale.css. This is not my intention, what i want it
  that
  that the framework searches for the style_mystyle_mylocale.css, then
 if
  not found fall back to style_mystyle.css, style_mylocale.css,
 style.css
  and so on (i'm not sure of the exact order of look up). So, modifying
  the
  constructor or passing the full parameters is not the solution, i
 think.
 
 
  Regards,
 
  German
 
  It seems that Johan Compagner wrote:
if you are creating your own ResourceReferences then you have to
 give
  the
   style and locale to them
   We could enhance the constructors that it does
  Session.get().getLocale()
   and
   Session.get().getStyle()
   if you dont give them..
  
   johan
  
  
  
   On Nov 9, 2007 10:27 AM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   Hi,
  
   I was thinking (as a last hope) that if this works for the HTMLs,
 i
   could
   provide different HTMLs that point internally to different CSSs,
 and
  it
   should work. But that would be duplicating the HTML just to have
 the
  CSS
   changed, and then it's not a good idea.
  
   Perhaps someone can tell me an official way to have localized and
  styled
   CSSs, the wicket way?
  
   Thanks again,
  
   German
  
   It seems that German Morales wrote:
Hi,
   
I use it inside a page.
   
I've tried...
   
   // inside the page constructor
   add(HeaderContributor.forCss(new
 ResourceReference(MyPage.class
 ,
style.css)));
   
and
   
   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread Johan Compagner
But even with bind() it still shows you the locale in the url?

On Nov 9, 2007 3:22 PM, German Morales [EMAIL PROTECTED] wrote:

 Hi again,

 With your solution, the generated HTML now looks this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css /

 i don't have style_mystyle_mylocale.css, but only style_mystyle.css

 But it works!

 So it seems that wicket later (when the browser asks for the css) makes
 the corresponding look up.

 Thanks a lot!

 German

 PS: just for the record (if someone reads this later), there was a easy
 typo in the code below. It should be Application.get() and not
 Application.bind().

 It seems that Johan Compagner wrote:
  no as i said before
  you have to create the resourcereference with the locale and the style.
  Those are not automatically picked up from the session. If you don't
 give
  them in the constructor
  then both are just null
 
  What you could do is this:
 
  ResourceReference reference = new ResourceReference(MyPage.class,
  style.css,
  locale,style);
  reference.bind(Application.bind());
  cResponse.getHeaderResponse().renderCSSReference(reference);
  johan
 
 
 
  On Nov 9, 2007 1:55 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  version 1.3.0-beta4.
 
  I insist that the problem must be something different, perhaps in the
  way
  i pretend it to work. I know about the ResourceStreamLocator, and as i
  tell it works perfectly for the HTML. The difference is that from my
  class
  the framework looks automatically for the corresponding HTML, but how
  should it work for the CSS?
 
  Should i declare it in the code?
 
// on renderHead
cResponse.getHeaderResponse().renderCSSReference(new
  ResourceReference(MyPage.class, style.css));
 
  or how?
 
  What i'm doing is very simple... i'm forcing (for testing) a call to
  Session.setStyle(whatever), then i have MyPage.html and
  MyPage_whatever.html (which works fine) and then style.css and
  style_whatever.css (which i expect to be used thanks to the code
 above).
 
  But when i see the generated html, it comes with the content of
  MyPage_whatever.html, but the header is generated this way:
 
  link rel=stylesheet type=text/css
  href=resources/path.to.mypage.MyPage/style.css /
 
  that is, not pointint to style_whatever.css as i expect.
 
  Thanks for the support,
 
  German
 
 
  It seems that Johan Compagner wrote:
   it should fallback just fine..
   what version of wicket are you using?
  
   Because in the ResourceStreamLocator we do now this:
  
   public IResourceStream locate(final Class clazz, String path, final
  String
   style,
  final Locale locale, final String extension)
{
 // Try the various combinations of style, locale and extension to
  find
 // the resource.
 ResourceNameIterator iter = new ResourceNameIterator(path, style,
   locale,
   extension);
 while (iter.hasNext())
 {
  String newPath = (String)iter.next();
  IResourceStream stream = locate(clazz, newPath);
  if (stream != null)
  {
   stream.setLocale(iter.getLocale());
   return stream;
  }
 }
 return null;
}
  
   johan
  
  
  
   On Nov 9, 2007 1:11 PM, German Morales [EMAIL PROTECTED]
   wrote:
  
   Hi again,
  
   Also, the problem is not giving the parameters to the
   ResourceReferences,
   if i call the full constructor then the ResourceReference works, but
  the
   problem is that it does not make a look up to see what's available,
  it
   just goes for the full thing. So, if i call the constructor with the
   session locale and style, what it does is search for the file
   style_mystyle_mylocale.css. This is not my intention, what i want it
   that
   that the framework searches for the style_mystyle_mylocale.css, then
  if
   not found fall back to style_mystyle.css, style_mylocale.css,
  style.css
   and so on (i'm not sure of the exact order of look up). So,
 modifying
   the
   constructor or passing the full parameters is not the solution, i
  think.
  
  
   Regards,
  
   German
  
   It seems that Johan Compagner wrote:
 if you are creating your own ResourceReferences then you have to
  give
   the
style and locale to them
We could enhance the constructors that it does
   Session.get().getLocale()
and
Session.get().getStyle()
if you dont give them..
   
johan
   
   
   
On Nov 9, 2007 10:27 AM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi,
   
I was thinking (as a last hope) that if this works for the HTMLs,
  i
could
provide different HTMLs that point internally to different CSSs,
  and
   it
should work. But that would be duplicating the HTML just to have
  the
   CSS
changed, and then it's not a good idea.
   
Perhaps someone can tell me an official way to have localized and
   styled
CSSs, the wicket way?
   
Thanks again,
   
German
   
It seems that German Morales wrote:
 Hi,


Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Furthermore, now that i understand more about this, i tried again my
original version:

cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, style.css, getLocale(), getStyle()));

and it also works as expected.

Perhaps i was not expecting it to work because the generated HTML
referenced a file i didn't have, or who knows why.

Thanks again.

German


It seems that German Morales wrote:
 Hi again,

 With your solution, the generated HTML now looks this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css /

 i don't have style_mystyle_mylocale.css, but only style_mystyle.css

 But it works!

 So it seems that wicket later (when the browser asks for the css) makes
 the corresponding look up.

 Thanks a lot!

 German

 PS: just for the record (if someone reads this later), there was a easy
 typo in the code below. It should be Application.get() and not
 Application.bind().

 It seems that Johan Compagner wrote:
 no as i said before
 you have to create the resourcereference with the locale and the style.
 Those are not automatically picked up from the session. If you don't
 give
 them in the constructor
 then both are just null

 What you could do is this:

 ResourceReference reference = new ResourceReference(MyPage.class,
 style.css,
 locale,style);
 reference.bind(Application.bind());
 cResponse.getHeaderResponse().renderCSSReference(reference);
 johan



 On Nov 9, 2007 1:55 PM, German Morales [EMAIL PROTECTED]
 wrote:

 version 1.3.0-beta4.

 I insist that the problem must be something different, perhaps in the
 way
 i pretend it to work. I know about the ResourceStreamLocator, and as i
 tell it works perfectly for the HTML. The difference is that from my
 class
 the framework looks automatically for the corresponding HTML, but how
 should it work for the CSS?

 Should i declare it in the code?

   // on renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));

 or how?

 What i'm doing is very simple... i'm forcing (for testing) a call to
 Session.setStyle(whatever), then i have MyPage.html and
 MyPage_whatever.html (which works fine) and then style.css and
 style_whatever.css (which i expect to be used thanks to the code
 above).

 But when i see the generated html, it comes with the content of
 MyPage_whatever.html, but the header is generated this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style.css /

 that is, not pointint to style_whatever.css as i expect.

 Thanks for the support,

 German


 It seems that Johan Compagner wrote:
  it should fallback just fine..
  what version of wicket are you using?
 
  Because in the ResourceStreamLocator we do now this:
 
  public IResourceStream locate(final Class clazz, String path, final
 String
  style,
 final Locale locale, final String extension)
   {
// Try the various combinations of style, locale and extension to
 find
// the resource.
ResourceNameIterator iter = new ResourceNameIterator(path, style,
  locale,
  extension);
while (iter.hasNext())
{
 String newPath = (String)iter.next();
 IResourceStream stream = locate(clazz, newPath);
 if (stream != null)
 {
  stream.setLocale(iter.getLocale());
  return stream;
 }
}
return null;
   }
 
  johan
 
 
 
  On Nov 9, 2007 1:11 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi again,
 
  Also, the problem is not giving the parameters to the
  ResourceReferences,
  if i call the full constructor then the ResourceReference works, but
 the
  problem is that it does not make a look up to see what's available,
 it
  just goes for the full thing. So, if i call the constructor with the
  session locale and style, what it does is search for the file
  style_mystyle_mylocale.css. This is not my intention, what i want it
  that
  that the framework searches for the style_mystyle_mylocale.css, then
 if
  not found fall back to style_mystyle.css, style_mylocale.css,
 style.css
  and so on (i'm not sure of the exact order of look up). So,
 modifying
  the
  constructor or passing the full parameters is not the solution, i
 think.
 
 
  Regards,
 
  German
 
  It seems that Johan Compagner wrote:
if you are creating your own ResourceReferences then you have to
 give
  the
   style and locale to them
   We could enhance the constructors that it does
  Session.get().getLocale()
   and
   Session.get().getStyle()
   if you dont give them..
  
   johan
  
  
  
   On Nov 9, 2007 10:27 AM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   Hi,
  
   I was thinking (as a last hope) that if this works for the HTMLs,
 i
   could
   provide different HTMLs that point internally to different CSSs,
 and
  it
   should work. But that would be duplicating the HTML just to have
 the
  CSS
   changed, and then it's not a good idea.
  
   Perhaps someone can tell me an official way to have 

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
Yes, at least that's what i see when i ask Firefox to show me the source
of the page.

It seems that Johan Compagner wrote:
 But even with bind() it still shows you the locale in the url?

 On Nov 9, 2007 3:22 PM, German Morales [EMAIL PROTECTED]
 wrote:

 Hi again,

 With your solution, the generated HTML now looks this way:

 link rel=stylesheet type=text/css
 href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css /

 i don't have style_mystyle_mylocale.css, but only style_mystyle.css

 But it works!

 So it seems that wicket later (when the browser asks for the css) makes
 the corresponding look up.

 Thanks a lot!

 German

 PS: just for the record (if someone reads this later), there was a easy
 typo in the code below. It should be Application.get() and not
 Application.bind().

 It seems that Johan Compagner wrote:
  no as i said before
  you have to create the resourcereference with the locale and the
 style.
  Those are not automatically picked up from the session. If you don't
 give
  them in the constructor
  then both are just null
 
  What you could do is this:
 
  ResourceReference reference = new ResourceReference(MyPage.class,
  style.css,
  locale,style);
  reference.bind(Application.bind());
  cResponse.getHeaderResponse().renderCSSReference(reference);
  johan
 
 
 
  On Nov 9, 2007 1:55 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  version 1.3.0-beta4.
 
  I insist that the problem must be something different, perhaps in the
  way
  i pretend it to work. I know about the ResourceStreamLocator, and as
 i
  tell it works perfectly for the HTML. The difference is that from my
  class
  the framework looks automatically for the corresponding HTML, but how
  should it work for the CSS?
 
  Should i declare it in the code?
 
// on renderHead
cResponse.getHeaderResponse().renderCSSReference(new
  ResourceReference(MyPage.class, style.css));
 
  or how?
 
  What i'm doing is very simple... i'm forcing (for testing) a call to
  Session.setStyle(whatever), then i have MyPage.html and
  MyPage_whatever.html (which works fine) and then style.css and
  style_whatever.css (which i expect to be used thanks to the code
 above).
 
  But when i see the generated html, it comes with the content of
  MyPage_whatever.html, but the header is generated this way:
 
  link rel=stylesheet type=text/css
  href=resources/path.to.mypage.MyPage/style.css /
 
  that is, not pointint to style_whatever.css as i expect.
 
  Thanks for the support,
 
  German
 
 
  It seems that Johan Compagner wrote:
   it should fallback just fine..
   what version of wicket are you using?
  
   Because in the ResourceStreamLocator we do now this:
  
   public IResourceStream locate(final Class clazz, String path, final
  String
   style,
  final Locale locale, final String extension)
{
 // Try the various combinations of style, locale and extension to
  find
 // the resource.
 ResourceNameIterator iter = new ResourceNameIterator(path, style,
   locale,
   extension);
 while (iter.hasNext())
 {
  String newPath = (String)iter.next();
  IResourceStream stream = locate(clazz, newPath);
  if (stream != null)
  {
   stream.setLocale(iter.getLocale());
   return stream;
  }
 }
 return null;
}
  
   johan
  
  
  
   On Nov 9, 2007 1:11 PM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   Hi again,
  
   Also, the problem is not giving the parameters to the
   ResourceReferences,
   if i call the full constructor then the ResourceReference works,
 but
  the
   problem is that it does not make a look up to see what's
 available,
  it
   just goes for the full thing. So, if i call the constructor with
 the
   session locale and style, what it does is search for the file
   style_mystyle_mylocale.css. This is not my intention, what i want
 it
   that
   that the framework searches for the style_mystyle_mylocale.css,
 then
  if
   not found fall back to style_mystyle.css, style_mylocale.css,
  style.css
   and so on (i'm not sure of the exact order of look up). So,
 modifying
   the
   constructor or passing the full parameters is not the solution, i
  think.
  
  
   Regards,
  
   German
  
   It seems that Johan Compagner wrote:
 if you are creating your own ResourceReferences then you have
 to
  give
   the
style and locale to them
We could enhance the constructors that it does
   Session.get().getLocale()
and
Session.get().getStyle()
if you dont give them..
   
johan
   
   
   
On Nov 9, 2007 10:27 AM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi,
   
I was thinking (as a last hope) that if this works for the
 HTMLs,
  i
could
provide different HTMLs that point internally to different
 CSSs,
  and
   it
should work. But that would be duplicating the HTML just to
 have
  the
   CSS
changed, and then it's not a good idea.
   
Perhaps someone can tell me an official way to have localized

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread Johan Compagner
I think i asked this before, but what version of wicket??

Normally (in the current wicket 1.3 buids) a ResourceReference to a
PackageResource will fallback to the real locale the PackageResource is
loaded
from after the ResourceReference is binded.

johan

On Nov 9, 2007 3:34 PM, German Morales [EMAIL PROTECTED] wrote:

 Yes, at least that's what i see when i ask Firefox to show me the source
 of the page.

 It seems that Johan Compagner wrote:
  But even with bind() it still shows you the locale in the url?
 
  On Nov 9, 2007 3:22 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi again,
 
  With your solution, the generated HTML now looks this way:
 
  link rel=stylesheet type=text/css
  href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css /
 
  i don't have style_mystyle_mylocale.css, but only style_mystyle.css
 
  But it works!
 
  So it seems that wicket later (when the browser asks for the css) makes
  the corresponding look up.
 
  Thanks a lot!
 
  German
 
  PS: just for the record (if someone reads this later), there was a easy
  typo in the code below. It should be Application.get() and not
  Application.bind().
 
  It seems that Johan Compagner wrote:
   no as i said before
   you have to create the resourcereference with the locale and the
  style.
   Those are not automatically picked up from the session. If you don't
  give
   them in the constructor
   then both are just null
  
   What you could do is this:
  
   ResourceReference reference = new ResourceReference(MyPage.class,
   style.css,
   locale,style);
   reference.bind(Application.bind());
   cResponse.getHeaderResponse().renderCSSReference(reference);
   johan
  
  
  
   On Nov 9, 2007 1:55 PM, German Morales [EMAIL PROTECTED]
   wrote:
  
   version 1.3.0-beta4.
  
   I insist that the problem must be something different, perhaps in
 the
   way
   i pretend it to work. I know about the ResourceStreamLocator, and as
  i
   tell it works perfectly for the HTML. The difference is that from my
   class
   the framework looks automatically for the corresponding HTML, but
 how
   should it work for the CSS?
  
   Should i declare it in the code?
  
 // on renderHead
 cResponse.getHeaderResponse().renderCSSReference(new
   ResourceReference(MyPage.class, style.css));
  
   or how?
  
   What i'm doing is very simple... i'm forcing (for testing) a call to
   Session.setStyle(whatever), then i have MyPage.html and
   MyPage_whatever.html (which works fine) and then style.css and
   style_whatever.css (which i expect to be used thanks to the code
  above).
  
   But when i see the generated html, it comes with the content of
   MyPage_whatever.html, but the header is generated this way:
  
   link rel=stylesheet type=text/css
   href=resources/path.to.mypage.MyPage/style.css /
  
   that is, not pointint to style_whatever.css as i expect.
  
   Thanks for the support,
  
   German
  
  
   It seems that Johan Compagner wrote:
it should fallback just fine..
what version of wicket are you using?
   
Because in the ResourceStreamLocator we do now this:
   
public IResourceStream locate(final Class clazz, String path,
 final
   String
style,
   final Locale locale, final String extension)
 {
  // Try the various combinations of style, locale and extension
 to
   find
  // the resource.
  ResourceNameIterator iter = new ResourceNameIterator(path,
 style,
locale,
extension);
  while (iter.hasNext())
  {
   String newPath = (String)iter.next();
   IResourceStream stream = locate(clazz, newPath);
   if (stream != null)
   {
stream.setLocale(iter.getLocale());
return stream;
   }
  }
  return null;
 }
   
johan
   
   
   
On Nov 9, 2007 1:11 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi again,
   
Also, the problem is not giving the parameters to the
ResourceReferences,
if i call the full constructor then the ResourceReference works,
  but
   the
problem is that it does not make a look up to see what's
  available,
   it
just goes for the full thing. So, if i call the constructor with
  the
session locale and style, what it does is search for the file
style_mystyle_mylocale.css. This is not my intention, what i want
  it
that
that the framework searches for the style_mystyle_mylocale.css,
  then
   if
not found fall back to style_mystyle.css, style_mylocale.css,
   style.css
and so on (i'm not sure of the exact order of look up). So,
  modifying
the
constructor or passing the full parameters is not the solution, i
   think.
   
   
Regards,
   
German
   
It seems that Johan Compagner wrote:
  if you are creating your own ResourceReferences then you have
  to
   give
the
 style and locale to them
 We could enhance the constructors that it does
Session.get().getLocale()
 and
 Session.get().getStyle()
 if 

Re: ResourceReference with locale and style, for CSSs

2007-11-09 Thread German Morales
1.3.0 beta 4

It seems that Johan Compagner wrote:
 I think i asked this before, but what version of wicket??

 Normally (in the current wicket 1.3 buids) a ResourceReference to a
 PackageResource will fallback to the real locale the PackageResource is
 loaded
 from after the ResourceReference is binded.

 johan

 On Nov 9, 2007 3:34 PM, German Morales [EMAIL PROTECTED]
 wrote:

 Yes, at least that's what i see when i ask Firefox to show me the source
 of the page.

 It seems that Johan Compagner wrote:
  But even with bind() it still shows you the locale in the url?
 
  On Nov 9, 2007 3:22 PM, German Morales [EMAIL PROTECTED]
  wrote:
 
  Hi again,
 
  With your solution, the generated HTML now looks this way:
 
  link rel=stylesheet type=text/css
  href=resources/path.to.mypage.MyPage/style_mystyle_mylocale.css /
 
  i don't have style_mystyle_mylocale.css, but only style_mystyle.css
 
  But it works!
 
  So it seems that wicket later (when the browser asks for the css)
 makes
  the corresponding look up.
 
  Thanks a lot!
 
  German
 
  PS: just for the record (if someone reads this later), there was a
 easy
  typo in the code below. It should be Application.get() and not
  Application.bind().
 
  It seems that Johan Compagner wrote:
   no as i said before
   you have to create the resourcereference with the locale and the
  style.
   Those are not automatically picked up from the session. If you
 don't
  give
   them in the constructor
   then both are just null
  
   What you could do is this:
  
   ResourceReference reference = new ResourceReference(MyPage.class,
   style.css,
   locale,style);
   reference.bind(Application.bind());
   cResponse.getHeaderResponse().renderCSSReference(reference);
   johan
  
  
  
   On Nov 9, 2007 1:55 PM, German Morales
 [EMAIL PROTECTED]
   wrote:
  
   version 1.3.0-beta4.
  
   I insist that the problem must be something different, perhaps in
 the
   way
   i pretend it to work. I know about the ResourceStreamLocator, and
 as
  i
   tell it works perfectly for the HTML. The difference is that from
 my
   class
   the framework looks automatically for the corresponding HTML, but
 how
   should it work for the CSS?
  
   Should i declare it in the code?
  
 // on renderHead
 cResponse.getHeaderResponse().renderCSSReference(new
   ResourceReference(MyPage.class, style.css));
  
   or how?
  
   What i'm doing is very simple... i'm forcing (for testing) a call
 to
   Session.setStyle(whatever), then i have MyPage.html and
   MyPage_whatever.html (which works fine) and then style.css and
   style_whatever.css (which i expect to be used thanks to the code
  above).
  
   But when i see the generated html, it comes with the content of
   MyPage_whatever.html, but the header is generated this way:
  
   link rel=stylesheet type=text/css
   href=resources/path.to.mypage.MyPage/style.css /
  
   that is, not pointint to style_whatever.css as i expect.
  
   Thanks for the support,
  
   German
  
  
   It seems that Johan Compagner wrote:
it should fallback just fine..
what version of wicket are you using?
   
Because in the ResourceStreamLocator we do now this:
   
public IResourceStream locate(final Class clazz, String path,
 final
   String
style,
   final Locale locale, final String extension)
 {
  // Try the various combinations of style, locale and extension
 to
   find
  // the resource.
  ResourceNameIterator iter = new ResourceNameIterator(path,
 style,
locale,
extension);
  while (iter.hasNext())
  {
   String newPath = (String)iter.next();
   IResourceStream stream = locate(clazz, newPath);
   if (stream != null)
   {
stream.setLocale(iter.getLocale());
return stream;
   }
  }
  return null;
 }
   
johan
   
   
   
On Nov 9, 2007 1:11 PM, German Morales
  [EMAIL PROTECTED]
wrote:
   
Hi again,
   
Also, the problem is not giving the parameters to the
ResourceReferences,
if i call the full constructor then the ResourceReference
 works,
  but
   the
problem is that it does not make a look up to see what's
  available,
   it
just goes for the full thing. So, if i call the constructor
 with
  the
session locale and style, what it does is search for the file
style_mystyle_mylocale.css. This is not my intention, what i
 want
  it
that
that the framework searches for the style_mystyle_mylocale.css,
  then
   if
not found fall back to style_mystyle.css, style_mylocale.css,
   style.css
and so on (i'm not sure of the exact order of look up). So,
  modifying
the
constructor or passing the full parameters is not the solution,
 i
   think.
   
   
Regards,
   
German
   
It seems that Johan Compagner wrote:
  if you are creating your own ResourceReferences then you
 have
  to
   give
the
 style and locale to them
 We could enhance the constructors that it does

Re: ResourceReference with locale and style, for CSSs

2007-11-08 Thread Johan Compagner
they locale and style are used to search for it yes
they are not forced.. What do you mean with that?
If the file with that style and locale isn't there it will fallback

johan


On Nov 7, 2007 10:50 PM, German Morales [EMAIL PROTECTED] wrote:

 Hi all,

 I'm having trouble with localized and styled CSSs.

 Everything works alright with HTML. For example, wicket finds
 MyPage_mystyle.html instead of MyPage.html if i've called
 session.setStyle(mystyle). But for CSS i can't get it working.

 i've tried different approaches like:

   // inside the page constructor
   add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
 style.css)));


   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));


 None of this worked for me. However, it works if I call the full
 constructor of ResourceReference:

 new ResourceReference(MyPage.class, style.css, getLocale(), getStyle())

 But i'm not supposed to do that, because then the Locale and Style are
 forced, and i want this only if the file is present. I know some
 ResourceStreamLocator should be involved in the process, but i don't know
 how. I see in the ResourceReference javadoc that the framework should be
 calling the setStyle() method, but i debugged it and it doesn't happen.

 What am i doing wrong?

 Thanks in advance,

 German



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




Re: ResourceReference with locale and style, for CSSs

2007-11-08 Thread German Morales
Hi johan,

The problem is that the file is there... just that it doesn't seem to be
looking for it.

If i force the full constructor:

new ResourceReference(MyPage.class, style.css, getLocale(), getStyle())

all works, so the file is correcly found and the name is correct.

The problem is when i don't set the locale and style explicitely (as it is
supposed to be done):

new ResourceReference(MyPage.class, style.css)

then it doesn't find the file. Actually i think it doesn't even try to
find it, since as i mention i put a breakpoint in
ResourceReference#setStyle() and nobody is calling it. So later internal
code to load the resource uses style and locale with null values.

I'm not sure if there's something i'm missing, or how it is supposed to be
done.

Thanks,

German


It seems that Johan Compagner wrote:
 they locale and style are used to search for it yes
 they are not forced.. What do you mean with that?
 If the file with that style and locale isn't there it will fallback

 johan


 On Nov 7, 2007 10:50 PM, German Morales [EMAIL PROTECTED]
 wrote:

 Hi all,

 I'm having trouble with localized and styled CSSs.

 Everything works alright with HTML. For example, wicket finds
 MyPage_mystyle.html instead of MyPage.html if i've called
 session.setStyle(mystyle). But for CSS i can't get it working.

 i've tried different approaches like:

   // inside the page constructor
   add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
 style.css)));


   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
 ResourceReference(MyPage.class, style.css));


 None of this worked for me. However, it works if I call the full
 constructor of ResourceReference:

 new ResourceReference(MyPage.class, style.css, getLocale(),
 getStyle())

 But i'm not supposed to do that, because then the Locale and Style are
 forced, and i want this only if the file is present. I know some
 ResourceStreamLocator should be involved in the process, but i don't
 know
 how. I see in the ResourceReference javadoc that the framework should be
 calling the setStyle() method, but i debugged it and it doesn't happen.

 What am i doing wrong?

 Thanks in advance,

 German



 -
 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: ResourceReference with locale and style, for CSSs

2007-11-08 Thread German Morales
Hi,

I use it inside a page.

I've tried...

   // inside the page constructor
   add(HeaderContributor.forCss(new ResourceReference(MyPage.class,
style.css)));

and

   // inside renderHead
   cResponse.getHeaderResponse().renderCSSReference(new
ResourceReference(MyPage.class, style.css));


And I don't want to set the style and locale explicitely. What i want is
to deliver the application to a customer, and, if he wants, he adds the
customized page for a locale or style by itself (he could set the style
with a parameter or whatever). And as far as i understand the wicket
approach, that's how it should work automatically. In fact it works
perfecly when i do it for the html of the same page. The difference is
that the html is handled in other way (the framework does it) and when i
try to do it for the CSS of the page i do it (and it doesn't work). So
there must be something i'm not doing properly.

Or, how should be the way to provide styled CSSs, there is another aproach?

thanks and bye,

German

It seems that Eelco Hillenius wrote:
 The problem is that the file is there... just that it doesn't seem to be
 looking for it.

 If i force the full constructor:

 new ResourceReference(MyPage.class, style.css, getLocale(),
 getStyle())

 all works, so the file is correcly found and the name is correct.

 The problem is when i don't set the locale and style explicitely (as it
 is
 supposed to be done):

 new ResourceReference(MyPage.class, style.css)

 then it doesn't find the file. Actually i think it doesn't even try to
 find it, since as i mention i put a breakpoint in
 ResourceReference#setStyle() and nobody is calling it. So later internal
 code to load the resource uses style and locale with null values.

 How do you use the resource reference? I think the class was designed
 in such a way that the components that use it (Image for instance) are
 responsible for setting the appropriate locale/ style 'just in time',
 so that switching locales etc works.

 Eelco

 -
 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]