@Override @SuppressWarnings("unchecked") protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) { HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest(); Map<Option<?>, Object> stagingOptions = (Map<Option<?>, Object>) request .getAttribute(DataTablesDialect.INTERNAL_BEAN_TABLE_STAGING_OPTIONS); // Make the actual attribute processing doProcessAttribute(arguments, element, attributeName, stagingOptions); // Housekeeping element.removeAttribute(attributeName); return ProcessorResult.ok(); }
@SuppressWarnings("unchecked") protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request, HttpServletResponse response, HtmlTable htmlTable) { Map<String, Map<ConfType, Object>> configs = (Map<String, Map<ConfType, Object>>) RequestUtils.getFromRequest( DataTablesDialect.INTERNAL_BEAN_CONFIGS, request); String tableId = ((Element) element.getParent()).getAttributeValue(DataTablesDialect.DIALECT_PREFIX + ":conf"); String uid = element.getAttributeValue(DataTablesDialect.DIALECT_PREFIX + ":uid"); if (configs != null) { if (configs.containsKey(tableId)) { List<ExtraHtml> extraHtmls = (List<ExtraHtml>) configs.get(tableId).get(ConfType.EXTRAHTML); if (extraHtmls != null && !extraHtmls.isEmpty()) { for (ExtraHtml extraHtml : extraHtmls) { if (extraHtml.getUid().equals(uid)) { Element e = DomUtils.findElement((Element) element.getParent(), "div", DataTablesDialect.DIALECT_PREFIX + ":uid", uid); StringBuilder sb = new StringBuilder(); for (Node child : e.getChildren()) { sb.append(DOMUtils.getHtml5For(child).replaceAll("[\n\r]", "").trim()); } extraHtml.setContent(sb.toString()); } } } } else { logger.warn("No configuration was found for the table with id '{}'", tableId); } } return ProcessorResult.ok(); }
return ProcessorResult.ok();
@Override @SuppressWarnings("unchecked") protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) { Map<Option<?>, Object> stagingOptions = (Map<Option<?>, Object>) arguments .getLocalVariable(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_OPTIONS); Map<Option<?>, Extension> stagingExtensions = (Map<Option<?>, Extension>) arguments .getLocalVariable(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_EXTENSIONS); // Perform the actual attribute processing doProcessAttribute(arguments, element, attributeName, stagingOptions, stagingExtensions); // Housekeeping element.removeAttribute(attributeName); return ProcessorResult.ok(); }
return ProcessorResult.ok();
return ProcessorResult.ok();
return ProcessorResult.ok();
return ProcessorResult.ok();
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); AssetAttributeNames assetsAttributeName = (AssetAttributeNames) AttributesUtil.find(strippedAttributeName, AssetAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); switch (assetsAttributeName) { case JS_EXCLUDES: arc.excludeJs(element.getAttributeValue(attributeName)); break; case CSS_EXCLUDES: arc.excludeCss(element.getAttributeValue(attributeName)); break; default: break; } return ProcessorResult.ok(); } }
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); BundleAttributeNames assetsAttributeName = (BundleAttributeNames) AttributesUtil.find(strippedAttributeName, BundleAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext context = AssetRequestContext.get(request); switch (assetsAttributeName) { case INCLUDES: context.addBundles(element.getAttributeValue(attributeName)); break; case EXCLUDES: context.excludeBundles(element.getAttributeValue(attributeName)); break; } return ProcessorResult.ok(); } }
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); BundleAttributeNames assetsAttributeName = (BundleAttributeNames) AttributesUtil.find(strippedAttributeName, BundleAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext context = AssetRequestContext.get(request); switch (assetsAttributeName) { case INCLUDES: context.addBundles(element.getAttributeValue(attributeName)); break; case EXCLUDES: context.excludeBundles(element.getAttributeValue(attributeName)); break; } return ProcessorResult.ok(); } }
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); AssetAttributeNames assetsAttributeName = (AssetAttributeNames) AttributesUtil.find(strippedAttributeName, AssetAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); switch (assetsAttributeName) { case JS_EXCLUDES: arc.excludeJs(element.getAttributeValue(attributeName)); break; case CSS_EXCLUDES: arc.excludeCss(element.getAttributeValue(attributeName)); break; default: break; } return ProcessorResult.ok(); } }
@Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); PlaceholderAttributeNames placeholderAttributeName = (PlaceholderAttributeNames) AttributesUtil .find(strippedAttributeName, PlaceholderAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); String attributeValue = element.getAttributeValue(attributeName); if (StringUtils.isBlank(attributeValue)) { throw new DandelionException("The \"type\" attribute cannot be blank. Possible values: \"" + PLACEHOLDER_TYPE_JS + "\" or \"" + PLACEHOLDER_TYPE_CSS + "\"."); } String placeholder = "dandelionPlaceholder" + attributeValue; handlePlaceholder(attributeValue, arc, placeholder); switch (placeholderAttributeName) { // Include a new Text node containing the placeholder within the existing // element case PLACEHOLDER_INCLUDE: Text text = new Text(placeholder); element.insertChild(element.getChildren().size(), text); break; // Replace the current element by the placeholder case PLACEHOLDER_REPLACE: text = new Text(placeholder); element.clearChildren(); element.addChild(text); break; } return ProcessorResult.ok(); }
@Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); PlaceholderAttributeNames placeholderAttributeName = (PlaceholderAttributeNames) AttributesUtil .find(strippedAttributeName, PlaceholderAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); String attributeValue = element.getAttributeValue(attributeName); if (StringUtils.isBlank(attributeValue)) { throw new DandelionException("The \"type\" attribute cannot be blank. Possible values: \"" + PLACEHOLDER_TYPE_JS + "\" or \"" + PLACEHOLDER_TYPE_CSS + "\"."); } String placeholder = "dandelionPlaceholder" + attributeValue; handlePlaceholder(attributeValue, arc, placeholder); switch (placeholderAttributeName) { // Include a new Text node containing the placeholder within the existing // element case PLACEHOLDER_INCLUDE: Text text = new Text(placeholder); element.insertChild(element.getChildren().size(), text); break; // Replace the current element by the placeholder case PLACEHOLDER_REPLACE: text = new Text(placeholder); element.clearChildren(); element.addChild(text); break; } return ProcessorResult.ok(); }