column.setParameter(CLASS_ATTRIBUTE, (StringUtils.isEmpty(oldClass) ? classValue : oldClass + " " + classValue));
contentGroup.setParameter(CLASS, "gadget-content"); contentGroup.addChildren(gadget.getContent()); gadgetBlock.setParameter(CLASS, idPrefix); gadgetBlock.setParameter(ID, idPrefix + "_" + gadget.getId()); gadgetBlock.addChild(titleBlock); gadgetBlock.addChild(contentGroup);
for (int i = 0; i < columns; i++) { GroupBlock gContainer = new GroupBlock(); gContainer.setParameter(CLASS, DashboardMacro.GADGET_CONTAINER); gContainer.setParameter(ID, DashboardMacro.GADGET_CONTAINER_PREFIX + (i + 1)); gadgetContainers.add(gContainer);
@Override public List<Block> execute(P parameters, String content, MacroTransformationContext context) throws MacroExecutionException { // TODO: include here container CSS. FTM the only rule, the one about justified text, is in the columns.css, in // which case the justification makes the most sense. // transform the container in a group, with appropriate parameters Map<String, String> containerParameters = new HashMap<String, String>(); if (parameters.isJustify()) { containerParameters.put(CLASS_ATTRIBUTE, "container-justified"); } // create the root block for the container macro, as a group block, and add all the blocks resulted from parsing // its content GroupBlock containerRoot = new GroupBlock(containerParameters); containerRoot.addChildren(getContent(parameters, content, context)); // grab the layout manager to layout this container LayoutManager layoutManager = getLayoutManager(parameters.getLayoutStyle()); // if a suitable layout manager was found, layout this container if (layoutManager != null) { layoutManager.layoutContainer(containerRoot); } // add the css class, if any, to the container root if (StringUtils.isNotEmpty(parameters.getCssClass())) { containerRoot.setParameter(CLASS_ATTRIBUTE, parameters.getCssClass()); } // and finally return the styled container root return Collections.<Block> singletonList(containerRoot); }
metadataBlock.setParameter(CLASS, METADATA); isMacroBlock.setParameter(CLASS, "isMacro"); isMacroBlock.addChild(new WordBlock(Boolean.toString(isMacro))); renderedContentBlock.setParameter(CLASS, "content"); WikiPrinter printer = new DefaultWikiPrinter(); BlockRenderer gadgetContentRenderer = getGadgetContentRenderer(); gadgetTitleBlock.setParameter(CLASS, "title");
topLevel.setParameter("class", MACRO_NAME + (StringUtils.isEmpty(parameters.getStyle()) ? "" : " " + parameters.getStyle()));
String classParameterName = "class"; GroupBlock metadataContainer = new GroupBlock(); metadataContainer.setParameter(classParameterName, DashboardMacro.METADATA); sourcePageBlock.setParameter(classParameterName, DashboardMacro.SOURCE_PAGE); metadataContainer.addChild(sourcePageBlock); GroupBlock sourceSpaceBlock = new GroupBlock(); sourceSpaceBlock.setParameter(classParameterName, DashboardMacro.SOURCE_SPACE); metadataContainer.addChild(sourceSpaceBlock); GroupBlock sourceWikiBlock = new GroupBlock(); sourceWikiBlock.addChild(new WordBlock(sourceDoc.getWikiReference().getName())); sourceWikiBlock.setParameter(classParameterName, DashboardMacro.SOURCE_WIKI); metadataContainer.addChild(sourceWikiBlock); String sourceURL = xContext.getWiki().getURL(sourceDoc, "view", "", "", xContext);