}
@Override
public void endVisit(CssSprite x, Context ctx) {
JClassType bundleType = context.getClientBundleType();
DotPathValue functionName = x.getResourceFunction();
if (functionName == null) {
logger.log(TreeLogger.ERROR, "The @sprite rule " + x.getSelectors()
+ " must specify the " + CssSprite.IMAGE_PROPERTY_NAME + " property");
throw new CssCompilerException("No image property specified");
}
JClassType imageResourceType = context.getGeneratorContext().getTypeOracle().findType(
ImageResource.class.getName());
assert imageResourceType != null;
// Find the image accessor method
JMethod imageMethod;
try {
imageMethod = ResourceGeneratorUtil.getMethodByPath(bundleType,
functionName.getParts(), imageResourceType);
} catch (NotFoundException e) {
logger.log(TreeLogger.ERROR, "Unable to find ImageResource method "
+ functionName + " in " + bundleType.getQualifiedSourceName() + " : "
+ e.getMessage());
throw new CssCompilerException("Cannot find image function");
}
ImageOptions options = imageMethod.getAnnotation(ImageOptions.class);
RepeatStyle repeatStyle;
if (options != null) {
repeatStyle = options.repeatStyle();
} else {
repeatStyle = RepeatStyle.None;
}
String instance = "(" + context.getImplementationSimpleSourceName()
+ ".this." + functionName.getExpression() + ")";
CssRule replacement = new CssRule();
replacement.getSelectors().addAll(x.getSelectors());
List<CssProperty> properties = replacement.getProperties();