本文整理汇总了Java中org.thymeleaf.processor.ProcessorResult类的典型用法代码示例。如果您正苦于以下问题:Java ProcessorResult类的具体用法?Java ProcessorResult怎么用?Java ProcessorResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessorResult类属于org.thymeleaf.processor包,在下文中一共展示了ProcessorResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
StringBuffer sb = new StringBuffer();
sb.append("<SCRIPT>\n");
sb.append(" var params = \n ");
sb.append(buildContentMap(arguments)).append(";\n ");
sb.append(getUncacheableDataFunction(arguments, element)).append(";\n");
sb.append("</SCRIPT>");
// Add contentNode to the document
Node contentNode = new Macro(sb.toString());
element.clearChildren();
element.getParent().insertAfter(element, contentNode);
element.getParent().removeChild(element);
// Return OK
return ProcessorResult.OK;
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:20,代码来源:UncacheableDataProcessor.java
示例2: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@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();
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:18,代码来源:AbstractTableAttrProcessor.java
示例3: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@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();
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:18,代码来源:AbstractColumnAttrProcessor.java
示例4: doProcessElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
HttpServletResponse response, HtmlTable htmlTable) {
// The HtmlTable is updated with a new row
if (htmlTable != null) {
htmlTable.getBodyRows().add(new HtmlRow());
}
// Remove internal attribute
if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":data")) {
element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":data");
}
return ProcessorResult.OK;
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:17,代码来源:TrElProcessor.java
示例5: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String[] value = element.getAttributeValue(attributeName).split(":");
String webjarName = value[0];
String filePath = value[1];
element.removeAttribute(attributeName);
element.setAttribute("th:" + attribute, String.format("@{/{path}/%s(path=${#webjars['%s'].path})}", filePath, webjarName));
// reevaluate th:src
element.setRecomputeProcessorsImmediately(true);
return ProcessorResult.OK;
}
开发者ID:Catalysts,项目名称:cat-boot,代码行数:15,代码来源:WebjarsLinkProcessor.java
示例6: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
/**
* This method will handle calling the modifyModelAttributes abstract method and return
* an "OK" processor result
*/
@Override
protected ProcessorResult processElement(final Arguments arguments, final Element element) {
modifyModelAttributes(arguments, element);
// Remove the tag from the DOM
final NestableNode parent = element.getParent();
parent.removeChild(element);
return ProcessorResult.OK;
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:15,代码来源:AbstractModelVariableModifierProcessor.java
示例7: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
// If the form will be not be submitted with a GET, we must add the CSRF token
// We do this instead of checking for a POST because post is default if nothing is specified
if (!"GET".equalsIgnoreCase(element.getAttributeValueFromNormalizedName("method"))) {
try {
String csrfToken = eps.getCSRFToken();
//detect multipart form
if ("multipart/form-data".equalsIgnoreCase(element.getAttributeValueFromNormalizedName("enctype"))) {
Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
.parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValueFromNormalizedName("th:action"));
String action = (String) expression.execute(arguments.getConfiguration(), arguments);
String csrfQueryParameter = "?" + eps.getCsrfTokenParameter() + "=" + csrfToken;
element.removeAttribute("th:action");
element.setAttribute("action", action + csrfQueryParameter);
} else {
Element csrfNode = new Element("input");
csrfNode.setAttribute("type", "hidden");
csrfNode.setAttribute("name", eps.getCsrfTokenParameter());
csrfNode.setAttribute("value", csrfToken);
element.addChild(csrfNode);
}
} catch (ServiceException e) {
throw new RuntimeException("Could not get a CSRF token for this session", e);
}
}
// Convert the <blc:form> node to a normal <form> node
Element newElement = element.cloneElementNodeWithNewName(element.getParent(), "form", false);
newElement.setRecomputeProcessorsImmediately(true);
element.getParent().insertAfter(element, newElement);
element.getParent().removeChild(element);
return ProcessorResult.OK;
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:38,代码来源:FormProcessor.java
示例8: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
.parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
ProductOptionValue productOptionValue = (ProductOptionValue) expression.execute(arguments.getConfiguration(), arguments);
ProductOptionValueDTO dto = new ProductOptionValueDTO();
dto.setOptionId(productOptionValue.getProductOption().getId());
dto.setValueId(productOptionValue.getId());
dto.setValueName(productOptionValue.getAttributeValue());
if (productOptionValue.getPriceAdjustment() != null) {
dto.setPriceAdjustment(productOptionValue.getPriceAdjustment().getAmount());
}
try {
ObjectMapper mapper = new ObjectMapper();
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, dto);
element.setAttribute("data-product-option-value", strWriter.toString());
element.removeAttribute(attributeName);
return ProcessorResult.OK;
} catch (Exception ex) {
LOG.error("There was a problem writing the product option value to JSON", ex);
}
return null;
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:29,代码来源:ProductOptionValueProcessor.java
示例9: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(final Arguments arguments, final Element element, String attributeName) {
if (shouldCache(arguments, element, attributeName)) {
fixElement(element, arguments);
if (checkCacheForElement(arguments, element)) {
// This template has been cached.
element.clearChildren();
element.clearAttributes();
element.setRecomputeProcessorsImmediately(true);
}
}
return ProcessorResult.OK;
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:14,代码来源:BroadleafCacheProcessor.java
示例10: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String parameters = element.getAttributeValue(attributeName);
element.removeAttribute(attributeName);
Map<String, Object> variables = new ParamsCommand(arguments, parameters).execute();
return ProcessorResult.setLocalVariables(variables);
}
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:8,代码来源:ParamsAttrProcessor.java
示例11: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String value = element.getAttributeValue(attributeName);
String query = ExpressionUtil.expressionValue(arguments, value).toString();
element.removeAttribute(attributeName);
Map<String, Object> variables = new QueryCommand(arguments, query).execute();
return ProcessorResult.setLocalVariables(variables);
}
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:9,代码来源:QueryAttrProcessor.java
示例12: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String value = element.getAttributeValue(attributeName);
String query = ExpressionUtil.expressionValue(arguments, value).toString();
element.removeAttribute(attributeName);
Map<String, Object> variables = new UpdateCommand(arguments, query).execute();
return ProcessorResult.setLocalVariables(variables);
}
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:9,代码来源:UpdateAttrProcessor.java
示例13: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String properties = element.getAttributeValue(attributeName);
element.removeAttribute(attributeName);
new ConnectionCommand(arguments, properties).execute();
return ProcessorResult.OK;
}
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:8,代码来源:ConnectionAttrProcessor.java
示例14: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
HttpServletResponse response = ((IWebContext) arguments.getContext()).getHttpServletResponse();
HtmlTable htmlTable = (HtmlTable) RequestUtils.getFromRequest(DataTablesDialect.INTERNAL_BEAN_TABLE, request);
ProcessorResult processorResult = doProcessElement(arguments, element, request, response, htmlTable);
return processorResult;
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:11,代码来源:AbstractElProcessor.java
示例15: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
// A Map<ConfType, Object> is associated with each table id
Map<String, Map<ConfType, Object>> configs = (Map<String, Map<ConfType, Object>>) RequestUtils.getFromRequest(
DataTablesDialect.INTERNAL_BEAN_CONFIGS, request);
String tableId = AttributeUtils.parseStringAttribute(arguments, element, attributeName);
if (configs != null && configs.containsKey(tableId)) {
throw new DandelionException("A div with id '" + tableId + "' is already present in the current template.");
}
else {
configs = new HashMap<String, Map<ConfType, Object>>();
}
configs.put(tableId, new HashMap<ConfType, Object>());
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_CONFIGS, configs, request);
// The node is stored to be easily accessed later during the processing
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_NODE_CONFIG, element, request);
return ProcessorResult.ok();
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:31,代码来源:DivConfAttrProcessor.java
示例16: doProcessElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
HttpServletResponse response, HtmlTable htmlTable) {
Map<Option<?>, Object> stagingConf = new HashMap<Option<?>, Object>();
Map<Option<?>, Extension> stagingExtension = new HashMap<Option<?>, Extension>();
// The staging configuration is stored as a local variable. It must be
// accessible in all column head processors.
Map<String, Object> newVariable = new HashMap<String, Object>();
newVariable.put(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_OPTIONS, stagingConf);
newVariable.put(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_EXTENSIONS, stagingExtension);
return ProcessorResult.setLocalVariables(newVariable);
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:15,代码来源:ColumnInitializerElProcessor.java
示例17: doProcessElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
HttpServletResponse response, HtmlTable htmlTable) {
String tableId = element.getAttributeValue("id");
if (tableId != null) {
String confGroup = (String) RequestUtils.getFromRequest(DataTablesDialect.INTERNAL_CONF_GROUP, request);
HtmlTable newHtmlTable = new HtmlTable(tableId, request, response, confGroup);
request.setAttribute(TableConfiguration.class.getCanonicalName(), newHtmlTable.getTableConfiguration());
// Add a default header row
newHtmlTable.addHeaderRow();
// Store the htmlTable POJO as a request attribute, so that all the
// others following HTML tags can access it and particularly the
// "finalizing div"
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_TABLE, newHtmlTable, request);
// The table node is also saved in the request, to be easily accessed
// later
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_NODE_TABLE, element, request);
// Map used to store the table local configuration
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_TABLE_STAGING_OPTIONS,
new HashMap<Option<?>, Object>(), request);
// The HTML needs to be updated
processMarkup(element);
return ProcessorResult.OK;
}
else {
throw new DandelionException("The 'id' attribute is required by Dandelion-Datatables.");
}
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:39,代码来源:TableInitializerElProcessor.java
示例18: doProcessElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
HttpServletResponse response, HtmlTable htmlTable) {
// All the tbody tag are iterated over
for (Node child : element.getChildren()) {
if (child != null && child instanceof Element) {
Element trChildTag = (Element) child;
String trChildTagName = trChildTag.getNormalizedName();
// The tr nodes must be processed (for HtmlRow creation)
trChildTag.setProcessable(true);
if (trChildTagName != null && trChildTagName.equals("tr")) {
for (Node grandchild : trChildTag.getChildren()) {
if (grandchild != null && grandchild instanceof Element) {
Element thChildTag = (Element) grandchild;
thChildTag.setAttribute(DataTablesDialect.DIALECT_PREFIX + ":data", "internalUse");
// The td nodes must be processed too (for
// HtmlColumn creation)
thChildTag.setProcessable(true);
}
}
}
}
}
// Housekeeping
if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":data")) {
element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":data");
}
return ProcessorResult.ok();
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:41,代码来源:TheadElProcessor.java
示例19: doProcessElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@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();
}
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:40,代码来源:DivExtraHtmlFinalizerElProcessor.java
示例20: doProcess
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected final ProcessorResult doProcess(final Arguments arguments, final ProcessorMatchingContext processorMatchingContext, final Node node) {
Element element = (Element)node;
String attributeName = getAttributeName(processorMatchingContext, element);
ServletContext ctx = getServletContext(arguments);
Object evaluated = StandardExpressionProcessor.processExpression(arguments, element.getAttributeValue(attributeName));
String contextRoot = getContextRoot(arguments);
AttributeData attrData = new AttributeData(attributeName, element, ctx, evaluated, contextRoot);
ProcessorResult result = doProcess(arguments, attrData);
attrData.element.removeAttribute(attrData.attributeName);
return result;
}
开发者ID:connect-group,项目名称:thymesheet-sample,代码行数:15,代码来源:BaseAttributeProcessor.java
注:本文中的org.thymeleaf.processor.ProcessorResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论