本文整理了Java中org.thymeleaf.Arguments.getContext()
方法的一些代码示例,展示了Arguments.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arguments.getContext()
方法的具体详情如下:
包路径:org.thymeleaf.Arguments
类名称:Arguments
方法名:getContext
暂无
代码示例来源:origin: com.github.dandelion/dandelion-thymeleaf
/**
* @param arguments
* Thymeleaf arguments
* @return web context of arguments
*/
public static WebContext getWebContext(Arguments arguments) {
return (WebContext) arguments.getContext();
}
}
代码示例来源:origin: dandelion/dandelion
/**
* @param arguments
* Thymeleaf arguments
* @return web context of arguments
*/
public static WebContext getWebContext(Arguments arguments) {
return (WebContext) arguments.getContext();
}
}
代码示例来源:origin: com.github.datatables4j/datatables4j-core-thymeleaf
public static HtmlTable getTable(Arguments arguments) {
return (HtmlTable) ((IWebContext) arguments.getContext()).getHttpServletRequest()
.getAttribute("htmlTable");
}
代码示例来源:origin: com.github.datatables4j/datatables4j-core-thymeleaf
public static HtmlTable getTable(Arguments arguments){
return (HtmlTable)((IWebContext) arguments.getContext()).getHttpServletRequest().getAttribute("htmlTable");
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public MessageResolution resolveMessage(Arguments args, String key, Object[] msgParams) {
final Locale locale = args.getContext().getLocale();
String targetMsg = resolveProperties(locale).getProperty(key);
if (targetMsg == null) {
targetMsg = "<span style=\"color:red\">" + key + " not found</span>";
} else if (msgParams != null && msgParams.length > 0) {
targetMsg = new MessageFormat(targetMsg, args.getContext().getLocale()).format(msgParams);
}
return new MessageResolution(targetMsg);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public MessageResolution resolveMessage(Arguments args, String key, Object[] msgParams) {
final Locale locale = args.getContext().getLocale();
String targetMsg = resolveProperties(locale).getProperty(key);
if (targetMsg == null) {
targetMsg = key;
} else if (msgParams != null && msgParams.length > 0) {
targetMsg = new MessageFormat(targetMsg, args.getContext().getLocale()).format(msgParams);
}
return new MessageResolution(targetMsg);
}
代码示例来源:origin: org.springframework.social/spring-social-web
@Override
protected boolean isVisible(Arguments arguments, Element element, String attributeName) {
final String providerId = element.getAttributeValue(attributeName);
if (providerId == null || providerId.trim().equals("")) {
return false;
}
ConnectionRepository connectionRepository = getConnectionRepository(arguments.getContext());
return connectionRepository.findConnections(providerId).size() == 0;
}
代码示例来源:origin: org.springframework.social/spring-social-web
@Override
protected boolean isVisible(Arguments arguments, Element element, String attributeName) {
final String providerId = element.getAttributeValue(attributeName);
if (providerId == null || providerId.trim().equals("")) {
return false;
}
ConnectionRepository connectionRepository = getConnectionRepository(arguments.getContext());
return connectionRepository.findConnections(providerId).size() > 0;
}
代码示例来源:origin: dandelion/dandelion-datatables
@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;
}
代码示例来源:origin: dandelion/dandelion-datatables
@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();
}
代码示例来源:origin: dandelion/dandelion-datatables
@Override
protected void doProcessAttribute(Arguments arguments, Element element, String attributeName,
Map<Option<?>, Object> stagingOptions) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
String attrValue = AttributeUtils.parseStringAttribute(arguments, element, attributeName);
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_CONF_GROUP, attrValue, request);
}
}
代码示例来源:origin: com.github.datatables4j/datatables4j-core-thymeleaf
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element,
String attributeName) {
logger.debug("{} attribute found", attributeName);
// Get the request
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
// Get HtmlTable POJO from the HttpServletRequest
HtmlTable htmlTable = Utils.getTable(arguments);
// Get attribute value
String attrValue = element.getAttributeValue(attributeName);
logger.debug("Extracted value : {}", attrValue);
// HtmlTable update
if (htmlTable != null && StringUtils.isNotBlank(attrValue)) {
htmlTable.setLabels(Utils.getBaseUrl(request) + attrValue);
}
return nonLenientOK(element, attributeName);
}
}
代码示例来源:origin: dandelion/dandelion-datatables
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.thymeleaf.thymeleaf
private static Properties loadMessagesForTemplate(
final Arguments arguments, final Properties defaultMessages) {
Validate.notNull(arguments, "Arguments cannot be null");
Validate.notNull(arguments.getContext().getLocale(), "Locale in context cannot be null");
final String resourceName = arguments.getTemplateResolution().getResourceName();
final IResourceResolver resourceResolver = arguments.getTemplateResolution().getResourceResolver();
final Locale locale = arguments.getContext().getLocale();
final String templateBaseName = getTemplateFileNameBase(resourceName);
return MessageResolutionUtils.loadCombinedMessagesFilesFromBaseName(
arguments, resourceResolver, templateBaseName, locale, defaultMessages);
}
代码示例来源:origin: dandelion/dandelion-datatables
/**
* Sets up the export properties, before the filter intercepts the response.
*
* @param arguments
* The Thymeleaf arguments.
* @param htmlTable
* The {@link HtmlTable} to export.
*/
private void setupExport(Arguments arguments, HtmlTable htmlTable) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
HttpServletResponse response = ((IWebContext) arguments.getContext()).getHttpServletResponse();
String currentExportType = ExportUtils.getCurrentExportType(request);
htmlTable.getTableConfiguration().setExporting(true);
htmlTable.getTableConfiguration().setCurrentExportFormat(currentExportType);
// Call the export delegate
ExportDelegate exportDelegate = new ExportDelegate(htmlTable, request);
exportDelegate.prepareExport();
response.reset();
}
代码示例来源:origin: dandelion/dandelion-datatables
@Override
protected void adaptFooter(HtmlTable table) {
Element tfoot = new Element("tfoot");
Node tableNode = (Node) ((IWebContext) arguments.getContext()).getHttpServletRequest().getAttribute(
DataTablesDialect.INTERNAL_NODE_TABLE);
for (HtmlColumn column : table.getLastHeaderRow().getColumns()) {
Element th = new Element("th");
th.addChild(new Text(column.getContent().toString()));
tfoot.addChild(th);
}
((Element) tableNode).addChild(tfoot);
}
}
代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.thymeleaf.thymeleaf
Validate.notNull(arguments.getContext(), "Context cannot be null");
Validate.notNull(messageKey, "Message key cannot be null");
return getAbsentMessageRepresentation(messageKey, arguments.getContext().getLocale());
代码示例来源:origin: com.github.datatables4j/datatables4j-core-thymeleaf
/**
* TODO
*
* @param element
*/
private void generateFooter(Element element, Arguments arguments) {
Element tfoot = new Element("tfoot");
Node tableNode = (Node)((IWebContext) arguments.getContext()).getHttpServletRequest().getAttribute("tableNode");
for(HtmlColumn column : htmlTable.getLastHeaderRow().getColumns()){
Element th = new Element("th");
th.addChild(new Text(column.getContent()));
tfoot.addChild(th);
}
((Element) tableNode).addChild(tfoot);
}
}
代码示例来源:origin: dandelion/dandelion-datatables
@Override
protected void adaptHeader(HtmlTable table) {
Node tableNode = (Node) ((IWebContext) arguments.getContext()).getHttpServletRequest().getAttribute(
DataTablesDialect.INTERNAL_NODE_TABLE);
Element thead = DomUtils.findElement((Element) tableNode, "thead");
Element tr = new Element("tr");
for (HtmlColumn column : table.getLastHeaderRow().getColumns()) {
Element th = new Element("th");
th.addChild(new Text(column.getContent().toString()));
tr.addChild(th);
}
if (thead != null) {
thead.addChild(tr);
}
else {
thead = new Element("thead");
thead.addChild(tr);
((Element) tableNode).addChild(thead);
}
}
代码示例来源:origin: com.github.datatables4j/datatables4j-core-thymeleaf
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
// Get the HTTP request
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
// HtmlTable htmlTable = (HtmlTable)
// arguments.getLocalVariable("htmlTable");
HtmlTable htmlTable = Utils.getTable(arguments);
this.htmlTable = htmlTable;
if (this.htmlTable != null) {
// The table is being exported
if (RequestHelper.isTableBeingExported(request, this.htmlTable)) {
setupExport(arguments);
}
// The table must be generated and displayed
else {
setupHtmlGeneration(arguments, element, request);
}
}
// The "finalizing div" can now be removed
element.getParent().removeChild(element);
return ProcessorResult.OK;
}
内容来源于网络,如有侵权,请联系作者删除!