Re: [Wicket-user] CSS background images

2006-08-07 Thread Johan Compagner
is it already in (haven't seen the commit i think)else do make a patch for it on sourceforge.johanOn 8/1/06, Al Maw 
[EMAIL PROTECTED] wrote:Igor Vaynberg wrote: i guess it is not something that we support right now, but something
 that is cleary needed. we need to build a resource that can load a css file, parse for images, replace them, and then serve the altered content. i know almaw has been working on something like this but i dont know how
 far he got. a patch would be welcome, if not then i guess you will have to wait until one of the core devels has the time.Sorry for the late reply - been on holiday. Please find attachedsomething that might be useful.
You'll need to change CssResource#getResourceStream() to understand howto tell if your app is in debug mode or not (see discussion on the devlist a week or two ago about that).Best regards,
Al Maw-Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cashhttp://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-08-07 Thread Eelco Hillenius
It's with Al Maw's earlier mail. We should consider whether/ where we
can integrate this functionality in existing parts instead of bluntly
copying it though. I haven't looked into it yet.

Eelco


On 8/7/06, Johan Compagner [EMAIL PROTECTED] wrote:
 is it already in (haven't seen the commit i think)
 else do make a patch for it on sourceforge.

 johan



 On 8/1/06, Al Maw  [EMAIL PROTECTED] wrote:
 
 Igor Vaynberg wrote:
  i guess it is not something that we support right now, but something
  that is cleary needed. we need to build a resource that can load a css
  file, parse for images, replace them, and then serve the altered content.
 
  i know almaw has been working on something like this but i dont know how
  far he got. a patch would be welcome, if not then i guess you will have
  to wait until one of the core devels has the time.

 Sorry for the late reply - been on holiday. Please find attached
 something that might be useful.

 You'll need to change CssResource#getResourceStream() to understand how
 to tell if your app is in debug mode or not (see discussion on the dev
 list a week or two ago about that).

 Best regards,

  Al Maw


 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys -- and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user





 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys -- and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-08-01 Thread Al Maw
Igor Vaynberg wrote:
 i guess it is not something that we support right now, but something
 that is cleary needed. we need to build a resource that can load a css
 file, parse for images, replace them, and then serve the altered content.
 
 i know almaw has been working on something like this but i dont know how
 far he got. a patch would be welcome, if not then i guess you will have
 to wait until one of the core devels has the time.

Sorry for the late reply - been on holiday. Please find attached
something that might be useful.

You'll need to change CssResource#getResourceStream() to understand how
to tell if your app is in debug mode or not (see discussion on the dev
list a week or two ago about that).

Best regards,

Al Maw
package foo.wicket.resources;

import wicket.Application;
import wicket.AttributeModifier;
import wicket.Component;
import wicket.ResourceReference;
import wicket.SharedResources;
import wicket.markup.ComponentTag;
import wicket.markup.html.WebMarkupContainer;
import wicket.model.IModel;
import wicket.model.Model;
import wicket.util.value.ValueMap;

/**
 * Created on 03-May-2006.
 * @author Alastair Maw
 */
public class CssReference extends WebMarkupContainer {

private static final long serialVersionUID = 1L;

/**
 * Construct.
 * @param id component id
 * @param referer the class that is refering; is used as the relative
 * root for gettting the resource
 * @param file reference as a string
 */
public CssReference(final String id, final Class referer, final String file) {
this(id, referer, new Model(file));
}

public CssReference(final String id, final Class referer, final IModel file) {
super(id);
IModel srcReplacement = new Model() {
private static final long serialVersionUID = 1L;

public Object getObject(Component component) {

Object o = file.getObject(component);
if (o == null) {
throw new IllegalArgumentException(The model must provide a non-null object (component ==  + component + ));
}
if (!(o instanceof String)) {
throw new IllegalArgumentException(The model must provide an instance of String);
}

String f = (String)component.getConverter().convert(file.getObject(component), String.class);
final SharedResources sharedResources = Application.get().getSharedResources();
CssResource resource = (CssResource)sharedResources.get(referer, f, getLocale(), getStyle(), true);
if (resource == null) {
resource = new CssResource(getRequestCycle(), referer, file.getObject(component).toString());
sharedResources.add(referer, f, null, null, resource);
}

String url = getRequestCycle().urlFor(new ResourceReference(referer, f)).toString();
return url;

}
};
add(new AttributeModifier(href, true, srcReplacement));
}

/**
 * @see wicket.Component#onComponentTag(wicket.markup.ComponentTag)
 */
protected void onComponentTag(ComponentTag tag) {
// Must be attached to a style tag
checkComponentTag(tag, link);
ValueMap attributes = tag.getAttributes();
attributes.put(rel, stylesheet);
attributes.put(type, text/css);
}

}
package foo.wicket.resources;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import wicket.Application;
import wicket.RequestCycle;
import wicket.Resource;
import wicket.ResourceReference;
import wicket.WicketRuntimeException;
import wicket.markup.html.PackageResourceReference;
import wicket.markup.html.WebResource;
import wicket.util.lang.Packages;
import wicket.util.resource.IResourceStream;
import wicket.util.resource.ResourceStreamNotFoundException;
import wicket.util.resource.StringBufferResourceStream;
import wicket.util.resource.locator.IResourceStreamLocator;
import wicket.util.time.Time;

/**
 * Created on 03-May-2006.
 * @author Alastair Maw
 */
public class CssResource extends WebResource {

private static final long serialVersionUID = 1L;

private static Log log = LogFactory.getLog(CssResource.class);

/** CSS definition */
private StringBufferResourceStream css = new StringBufferResourceStream();

private Class scope;
private String path;

public CssResource(RequestCycle cycle, Class scope, String path) {
this.scope = scope;
this.path = path;
refreshResource(cycle);
}

private void refreshResource(RequestCycle cycle) {
String absolutePath = Packages.absolutePath(scope, path);

// Locate the resource
IResourceStreamLocator locator = 

Re: [Wicket-user] CSS background images

2006-07-24 Thread Eelco Hillenius
As you don't have to pre-register packaged resources anymore, you can
reference them if you know the URL, which for such resources always
has the same form:

/webapp/servletname/resources/some.package.SomeClass/theme.css

and even

/webapp/servletname/resources/some.package.SomeClass/some/sub/dir/theme.css

for *unmounted* packages. SomeClass is then used as the class relative
to the loading.

Also, you can use RequestCycle's urlFor and classes of
wicket.extensions.util.resource to do the trick without depending on
Wicket's internals too much. For instance with:

Map m = new HashMap();
RequestCycle r = RequestCycle.get();
m.put(star1, r.urlFor(new PackageResourceReference(StarPanel.class,
star1.gif)));
add(TextTemplateHeaderContributor.forCss(SomeClass.class, theme.css,
Model.valueOf(m)));

and in theme.css all ${star1} will be replaced by that image.

Still a lot of work though, so like Igor said, it would be nice to
have something simpler even. One of the starting points for this might
be TextTemplateHeaderContributor.forCss or CssTemplate it depends on.
CssTemplate could (optionally) parse the body of that file - it's
doing that for the var subst anyway - and replace urls and such.

Contribution is welcome :)

Btw, I'm about to move that package to core for 2.0 (so it looses the
extensions part in the package for that version).

Eelco


On 7/24/06, Igor Vaynberg [EMAIL PROTECTED] wrote:
 i guess it is not something that we support right now, but something that is
 cleary needed. we need to build a resource that can load a css file, parse
 for images, replace them, and then serve the altered content.

 i know almaw has been working on something like this but i dont know how far
 he got. a patch would be welcome, if not then i guess you will have to wait
 until one of the core devels has the time.

 even a patch to parse css and figure out where the paths are would be very
 helpful.

 -Igor



 On 7/23/06, Ryan Sonnek  [EMAIL PROTECTED] wrote:
 

 I know this is a pretty newbie question, but how can i package an image with
 my wicket app, and reference it within a static css file?  I've been
 searching through the wicket wiki, with no luck.  is there a wicket-stuff
 app or someplace i can dig through for an example?

  Just to be clear, here's what i'm expecting to do with my css:

  .myapplicationClass {
background-image:
 url('/com/codecrate/app/BackgroundImage.gif');
  }

 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
  opinions on IT  business topics through brief surveys -- and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys -- and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-07-24 Thread Igor Vaynberg
i think in this case we are talking about a contextpathprepender but for the css, not just a variable interpolator.also while the texttemplate stuff works what it does is sinclude the css into the page, im talking about a resource so you can have all this stuff done once and served/cached through the normal link/ tag.
-IgorOn 7/24/06, Eelco Hillenius [EMAIL PROTECTED] wrote:
As you don't have to pre-register packaged resources anymore, you canreference them if you know the URL, which for such resources alwayshas the same form:/webapp/servletname/resources/some.package.SomeClass/theme.css
and even/webapp/servletname/resources/some.package.SomeClass/some/sub/dir/theme.cssfor *unmounted* packages. SomeClass is then used as the class relativeto the loading.Also, you can use RequestCycle's urlFor and classes of
wicket.extensions.util.resource to do the trick without depending onWicket's internals too much. For instance with:Map m = new HashMap();RequestCycle r = RequestCycle.get();m.put(star1, 
r.urlFor(new PackageResourceReference(StarPanel.class,star1.gif)));add(TextTemplateHeaderContributor.forCss(SomeClass.class, theme.css,Model.valueOf(m)));and in theme.css all ${star1} will be replaced by that image.
Still a lot of work though, so like Igor said, it would be nice tohave something simpler even. One of the starting points for this mightbe TextTemplateHeaderContributor.forCss or CssTemplate it depends on.
CssTemplate could (optionally) parse the body of that file - it'sdoing that for the var subst anyway - and replace urls and such.Contribution is welcome :)Btw, I'm about to move that package to core for 
2.0 (so it looses theextensions part in the package for that version).EelcoOn 7/24/06, Igor Vaynberg [EMAIL PROTECTED] wrote: i guess it is not something that we support right now, but something that is
 cleary needed. we need to build a resource that can load a css file, parse for images, replace them, and then serve the altered content. i know almaw has been working on something like this but i dont know how far
 he got. a patch would be welcome, if not then i guess you will have to wait until one of the core devels has the time. even a patch to parse css and figure out where the paths are would be very
 helpful. -Igor On 7/23/06, Ryan Sonnek  [EMAIL PROTECTED] wrote:  I know this is a pretty newbie question, but how can i package an image with
 my wicket app, and reference it within a static css file?I've been searching through the wicket wiki, with no luck.is there a wicket-stuff app or someplace i can dig through for an example?
Just to be clear, here's what i'm expecting to do with my css:.myapplicationClass {background-image: url('/com/codecrate/app/BackgroundImage.gif');}
 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___ Wicket-user mailing listWicket-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT  business topics through brief surveys -- and earn cash 
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list 
Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-
Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-07-24 Thread Eelco Hillenius
On 7/24/06, Igor Vaynberg [EMAIL PROTECTED] wrote:
 i think in this case we are talking about a contextpathprepender but for the
 css, not just a variable interpolator.

Yes, that's pretty obvious. I wasn't proposing 'just variable
interpolation', but just explaining what there is now to fix his
problem, and what might be one of the starting points.

 also while the texttemplate stuff works what it does is sinclude the css
 into the page, im talking about a resource so you can have all this stuff
 done once and served/cached through the normal link/ tag.

Like that wicket:head section. That's fine, but we should ultimately
have a mechanism that works both ways. I prefer header contribution
using behaviors in general because it works with any component, at any
place, not just panels. But of course, such a thing should be
consistent with what we have now. But in such a way that it is
optional, as it would be rather expensive to parse any packaged
resource we serve.

Eelco

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-07-24 Thread Igor Vaynberg
we only need to parse css resources and we only need to parse them once for this to work i think.-IgorOn 7/24/06, Eelco Hillenius 
[EMAIL PROTECTED] wrote:On 7/24/06, Igor Vaynberg 
[EMAIL PROTECTED] wrote: i think in this case we are talking about a contextpathprepender but for the css, not just a variable interpolator.Yes, that's pretty obvious. I wasn't proposing 'just variable
interpolation', but just explaining what there is now to fix hisproblem, and what might be one of the starting points. also while the texttemplate stuff works what it does is sinclude the css into the page, im talking about a resource so you can have all this stuff
 done once and served/cached through the normal link/ tag.Like that wicket:head section. That's fine, but we should ultimatelyhave a mechanism that works both ways. I prefer header contribution
using behaviors in general because it works with any component, at anyplace, not just panels. But of course, such a thing should beconsistent with what we have now. But in such a way that it isoptional, as it would be rather expensive to parse any packaged
resource we serve.Eelco-Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cashhttp://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-07-24 Thread Eelco Hillenius
Only when we would cache the results.

Eelco


On 7/24/06, Igor Vaynberg [EMAIL PROTECTED] wrote:
 we only need to parse css resources and we only need to parse them once for
 this to work i think.

 -Igor



 On 7/24/06, Eelco Hillenius  [EMAIL PROTECTED] wrote:
 
 On 7/24/06, Igor Vaynberg  [EMAIL PROTECTED] wrote:
  i think in this case we are talking about a contextpathprepender but for
 the
  css, not just a variable interpolator.

 Yes, that's pretty obvious. I wasn't proposing 'just variable
 interpolation', but just explaining what there is now to fix his
 problem, and what might be one of the starting points.

  also while the texttemplate stuff works what it does is sinclude the css
  into the page, im talking about a resource so you can have all this stuff
  done once and served/cached through the normal link/ tag.

 Like that wicket:head section. That's fine, but we should ultimately
 have a mechanism that works both ways. I prefer header contribution
 using behaviors in general because it works with any component, at any
 place, not just panels. But of course, such a thing should be
 consistent with what we have now. But in such a way that it is
 optional, as it would be rather expensive to parse any packaged
 resource we serve.

 Eelco

 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys -- and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user


 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share your
 opinions on IT  business topics through brief surveys -- and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] CSS background images

2006-07-23 Thread Igor Vaynberg
i guess it is not something that we support right now, but something that is cleary needed. we need to build a resource that can load a css file, parse for images, replace them, and then serve the altered content.i know almaw has been working on something like this but i dont know how far he got. a patch would be welcome, if not then i guess you will have to wait until one of the core devels has the time.
even a patch to parse css and figure out where the paths are would be very helpful.-IgorOn 7/23/06, Ryan Sonnek 
[EMAIL PROTECTED] wrote:I know this is a pretty newbie question, but how can i package an image
with my wicket app, and reference it within a static css file?
I've been searching through the wicket wiki, with no luck. is
there a wicket-stuff app or someplace i can dig through for an example?

Just to be clear, here's what i'm expecting to do with my css:

.myapplicationClass {
 background-image: url('/com/codecrate/app/BackgroundImage.gif');
}

-Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user