Oh, okay, thank you very much. Here's the utility class I ended up
writing in case anyone's interested.
On 8/16/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
> maybe we should add another resourcereference constructor:
>
> /**
> * Constructs a ResourceReference with the given scope and name. The
> scope
> * is used as a namespace and the scope together with the name must
> uniquely
> * identify the reference.
> *
> * @param scope
> * The scope of the name
> * @param name
> * The name of the resource
> */
> public ResourceReference(final Class scope, final String name,
> Resource resource)
> {
> this.scope = scope;
> this.name = name;
> this.resource = resource;
> // add to SharedREsources
> }
>
> one problem i think is that resource is transient
> So better is to sub class resource references with the same kind of
> constructor
> and then hold that resource java reference as a reference that is given
> in newResource()
>
> I think more people find this a bit confusing, they thing in
> images/resources not really in references to it.
>
> johan
>
>
>
>
>
> Juergen Donnerstag wrote:
> > Example taken from wicket-examples. I think the javadoc related to the
> > resource classes is not bad, what I think is lacking is a overview on
> > Resources, ResourceLocators, ResourceReferences etc..
> >
> > return new ResourceReference(Letter.class, asString() + (enabled ?
> > "_enabled" : "_disabled"))
> > {
> > protected Resource newResource()
> > {
> > // Lazy loading of shared resource
> > final DefaultButtonImageResource buttonResource = new
> > DefaultButtonImageResource(30, 30, asString());
> > if (!enabled)
> > {
> > buttonResource.setColor(Color.GRAY);
> > }
> >
> > return buttonResource;
> > }
> > };
> >
> > Juergen
> >
> > On 8/16/05, Phil Kulak <[EMAIL PROTECTED]> wrote:
> >
> >> I would really appreciate it if someone could let me know if this is
> >> possible. If it's not currently possible, I'd be happy to submit a
> >> patch for whatever solution I come up with. I'd like to not resort to
> >> a servlet if I can help it.
> >>
> >> On 8/15/05, Phil Kulak <[EMAIL PROTECTED]> wrote:
> >>
> >>> So I've got a FileResourceStream and I'd like to give a link to it to
> >>> the user. ResourceLink takes a ResourceReference, which I don't have.
> >>> Any ideas? Thanks!
> >>>
> >>>
> >> -------------------------------------------------------
> >> SF.Net email is Sponsored by the Better Software Conference & EXPO
> >> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> >> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> >> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> >> _______________________________________________
> >> Wicket-user mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >>
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
package com.apropobenefits.wicket;
import wicket.Resource;
import wicket.ResourceReference;
import wicket.util.resource.IResourceStream;
public class SimpleResourceReference extends ResourceReference {
private Resource resource;
public SimpleResourceReference(Class scope, String name, Resource resource) {
super(scope, name);
this.resource = resource;
}
public SimpleResourceReference(Class scope, String name,
final IResourceStream stream) {
super(scope, name);
resource = new Resource() {
@Override
public IResourceStream getResourceStream() {
return stream;
}
};
}
@Override
protected Resource newResource() {
return resource;
}
}