the images application had not been updated and was busted for clustering. i fixed this this morning.
the example now shows two ways to create clusterable, shared image resources with a stable urls.
the ok button below is shared under the name okButton via a getter in the application subclass.
the more straightforward approach though is to simply add the resource in your application when
it is constructed. then reference it like the cancelButton below. this is probably the preferred approach
for most applications. for applications that want to lazy-load resources like this (rather than constructing
them all at once during app construction), you can give an implementation of the ISharedResourceFactory
interface when you add the resource to the application. if the resource is ever needed, the resource
factory method will be called to create and share it.
----
public class ImagesApplication extends WicketExampleApplication
{
static private final DefaultButtonImageResource okButtonImageResource = new DefaultButtonImageResource(
"Ok");
public ImagesApplication()
{
getPages().setHomePage(Home.class);
addResource("cancelButton", new DefaultButtonImageResource("Cancel"));
}
final SharedResource getOkButtonImage()
{
return okButtonImageResource.getShared(this, "okButton");
}
}public final class Home extends WicketExamplePage
{
public Home()
{
// Get our custom application subclass
final ImagesApplication application = (ImagesApplication)getApplication();
...
// Add okay button image
add(new Image("okButton", application.getOkButtonImage())); // Add cancel button image
add(new Image("cancelButton", new SharedResource("cancelButton")));
}
}------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
