Please extend ResourceStreamFactory.locate(...) and register your
factory with the application.
Juergen
On 1/10/07, Ernesto Reinaldo Barreiro <[EMAIL PROTECTED]> wrote:
Hi,
In an application we were using CompoundResourceStreamLocator but after
syncronyzing with the 2.0 repository I have found this class simply
dissappeared and I cannot find a replacement for it. I noticed
IResourceStreamLocator was replaced with IResourceStreamFactory but I
couldn't find an implementation of a CompoundResourceStreamFactory. A
possible implementation of such a class could be:
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import wicket.util.resource.IResourceStream;
import wicket.util.resource.locator.IResourceStreamFactory;
public class CompoundResourceStreamFactory implements IResourceStreamFactory
{
List<IResourceStreamFactory> resourceStreamFactories = new
ArrayList<IResourceStreamFactory>();
public IResourceStream locate(Class clazz, String path, String style,
Locale locale, String extension) {
for(IResourceStreamFactory factory: resourceStreamFactories) {
if(factory != null) {
IResourceStream stream = factory.locate(clazz,
path, style, locale,
extension);
if(stream != null)
return stream;
}
}
return null;
}
public IResourceStream locate(Class clazz, String path) {
for(IResourceStreamFactory factory: resourceStreamFactories) {
if(factory != null) {
IResourceStream stream = factory.locate(clazz,
path);
if(stream != null)
return stream;
}
}
return null;
}
public void addResourceStreamFactory(IResourceStreamFactory factory){
resourceStreamFactories.add(factory);
}
public void removeResourceStreamFactory(IResourceStreamFactory factory){
resourceStreamFactories.remove(factory);
}
}
I also notice that IResourceSettings has a method
void setResourceStreamLocator(IResourceStreamFactory resourceStreamFactory);
shouldn't it be named setResourceStreamFactory?
Best regards,
Ernesto
--
View this message in context:
http://www.nabble.com/which-is-the-replacement-for-CompoundResourceStreamLocator-%282.0%29-tf2952690.html#a8258305
Sent from the Wicket - Dev mailing list archive at Nabble.com.