* The {@link HtmlTable} which the CSS configuration will apply
* on.
*/
private void applyCssConfiguration(Arguments arguments, HttpServletRequest request, HtmlTable htmlTable) {
Element tableElement = (Element) RequestUtils.getFromRequest(DataTablesDialect.INTERNAL_NODE_TABLE, request);
// CSS class
StringBuilder configuredCssClass = TableConfig.CSS_CLASS.valueFrom(htmlTable.getTableConfiguration());
if (configuredCssClass != null) {
String currentCssClass = tableElement.getAttributeValue("class");
if (StringUtils.isNotBlank(currentCssClass)) {
currentCssClass += HtmlTag.CLASS_SEPARATOR + configuredCssClass.toString();
}
else {
currentCssClass = configuredCssClass.toString();
}
tableElement.setAttribute("class", currentCssClass);
}
// CSS style
StringBuilder configuredCssStyle = TableConfig.CSS_STYLE.valueFrom(htmlTable.getTableConfiguration());
if (configuredCssStyle != null) {
String currentCssStyle = tableElement.getAttributeValue("style");
if (StringUtils.isNotBlank(currentCssStyle)) {
currentCssStyle += HtmlTag.STYLE_SEPARATOR + configuredCssStyle.toString();
}
else {
currentCssStyle = configuredCssStyle.toString();
}
tableElement.setAttribute("style", currentCssStyle);
}
}