Class ImageRemapperUtil
java.lang.Object
net.sf.basedb.clients.web.extensions.skin.ImageRemapperUtil
Utility class for working with image remapping.
- Since:
- 3.4
- Author:
- nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate static ImageRemapper
private static boolean
private static ServletContext
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImageRemapper
Get the current image remapper.static ImageRemapper
Get a new image remapper if it is needed, otherwise null.static void
init
(ServletContext context) Initialized at server startup.static void
remapAllTo
(ImageRemapper mapper, String url) Scan the given url for images (png and gif) and remap them.static void
setCurrentMapper
(ImageRemapper remapper) Changes the current image remapper.
-
Field Details
-
servletContext
-
currentImageRemapper
-
newMapperIsNeeded
private static transient boolean newMapperIsNeeded
-
-
Constructor Details
-
ImageRemapperUtil
public ImageRemapperUtil()
-
-
Method Details
-
init
Initialized at server startup. -
getNewImageRemapperIfNeeded
Get a new image remapper if it is needed, otherwise null. Once the remapping is complete, usesetCurrentMapper(ImageRemapper)
to change the current image remapper. -
getCurrentMapper
Get the current image remapper. Can be null if remapping is not needed. -
setCurrentMapper
Changes the current image remapper. The remapping should have been complete before calling this method since the image remapper is not thread-safe for writing. If the new remapper size is 0 the current remapper is set to null. -
remapAllTo
Scan the given url for images (png and gif) and remap them. The url can be a path that is relative the root of the server or root of the context. It should always start with a /. The remapping is done so that the given path is searched recursively and the subpaths found are remapped the full path. For example, if url is /extensions/example.jar/remap and this folder contains a subfolder with two images (images/baselogo.png and images/cancel.png) the following remap is done: /images/baselogo.png --> /extensions/example.jar/remap/images/baselogo.png /images/cancel.png --> /extensions/example.jar/remap/images/cancel.png
-