use of org.xwiki.rendering.macro.box.BoxMacroParameters in project xwiki-platform by xwiki.
the class RssMacro method execute.
@Override
public List<Block> execute(RssMacroParameters parameters, String content, MacroTransformationContext context) throws MacroExecutionException {
List<Block> result;
SyndFeed feed = this.romeFeedFactory.createFeed(parameters);
if (parameters.isDecoration()) {
BoxMacroParameters boxParameters = new BoxMacroParameters();
boolean hasImage = parameters.isImage() && (feed.getImage() != null);
boxParameters.setCssClass(FEED_CLASS_VALUE);
if (StringUtils.isNotEmpty(parameters.getWidth())) {
boxParameters.setWidth(parameters.getWidth());
}
boxParameters.setBlockTitle(generateBoxTitle("rsschanneltitle", feed));
if (hasImage) {
boxParameters.setImage(new ResourceReference(feed.getImage().getUrl(), ResourceType.URL));
}
result = this.boxMacro.execute(boxParameters, content == null ? StringUtils.EMPTY : content, context);
} else {
result = Arrays.<Block>asList(new GroupBlock(Collections.singletonMap(CLASS_ATTRIBUTE, FEED_CLASS_VALUE)));
}
generateEntries(result.get(0), feed, parameters);
return result;
}
Aggregations