ResourceReference and SharedResources best practice

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ResourceReference and SharedResources best practice


I have a question regarding best practices when dealing with images that are used as icons in a wicket application. I have looked for a suitable answer and could not find one.

We have several places where we need an AjaxLink and have it displayed with an certain icon. Since this doesn't come with the wicket core components we created a class called ImageAjaxLink that basically takes a ResourceReference and overrides the onComponentTagBody method to output an img tag with the src attribute set to whatever RequestCycle.get().urlFor(resourceReference) returns.

We also have an Images class that declares public static final ResourceReference objects that point to all of our standard icons. This makes it easy to create ImageAjaxLinks because you can just reference the static ResourceReference objects when creating it like this: new ImageAjaxLink("id", Images.ADD_USER){...}

We have never used SharedResources and I don't know if there is a benefit of doing so. Here is my question. How is everyone else handling icons for their links? Is this completely against best practices or is it fine?

Any opinions or advice is appreciated.