本文整理汇总了Java中org.thymeleaf.model.IProcessableElementTag.getAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:Java IProcessableElementTag.getAttributeValue方法的具体用法?Java IProcessableElementTag.getAttributeValue怎么用?Java IProcessableElementTag.getAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.thymeleaf.model.IProcessableElementTag
的用法示例。
在下文中一共展示了IProcessableElementTag.getAttributeValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContents
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
static Contents getContents(final ITemplateContext context,
final IProcessableElementTag tag) {
final Contents contents;
final String from = tag.getAttributeValue(ATTR_FROM);
if (from != null) {
final IEngineConfiguration configuration = context.getConfiguration();
final IStandardExpressionParser parser = getExpressionParser(configuration);
final IStandardExpression expression = parser.parseExpression(context, from);
contents = (Contents) expression.execute(context);
} else {
Object contentsVar = context.getVariable(DEFAULT_VAR_CONTENTS);
if (contentsVar != null) {
contents = (Contents) contentsVar;
} else {
contents = null;
}
}
if (contents != null) {
return contents;
} else {
throw new IllegalStateException(
"Unable to get RxComposer Contents. " +
"You should either provide a template variable named 'contents' or " +
"provide it using attribute 'from': '<rxc:fragment from='${myContents}' position='A' />");
}
}
示例2: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allRolesStr = tag.getAttributeValue("name");
final String[] roles = StringUtils.split(allRolesStr, DELIMITER);
if(ShiroFacade.hasAllRoles(roles)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例3: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
String attributeValue, IElementTagStructureHandler structureHandler) {
String attrValue = String.valueOf(Expressions.evaluate(context, attributeValue)).trim();
Page<?> page = PageUtils.findPage(context);
String url = PageUtils.createSortUrl(context, attrValue);
// Append class to the element if sorted by this field
Sort sort = page.getSort();
boolean isSorted = sort != null && sort.getOrderFor(attrValue) != null;
String clas = isSorted
? SORTED_PREFIX.concat(sort.getOrderFor(attrValue).getDirection().toString().toLowerCase())
: EMPTY;
structureHandler.setAttribute(HREF, url);
String currentClass = tag.getAttributeValue(CLASS);
structureHandler.setAttribute(CLASS, Strings.concat(currentClass, BLANK, clas));
}
示例4: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(ITemplateContext iTemplateContext,
IProcessableElementTag iProcessableElementTag,
AttributeName attributeName,
String attributeValue,
IElementTagStructureHandler iElementTagStructureHandler) {
final String type = iProcessableElementTag.getAttributeValue("type");
final String property = iProcessableElementTag.getAttributeValue("property");
final String text = ShiroFacade.getPrincipalText(type, property);
final String elementCompleteName = iProcessableElementTag.getElementCompleteName();
final IModelFactory modelFactory = iTemplateContext.getModelFactory();
final IModel model = modelFactory.createModel();
model.add(modelFactory.createOpenElementTag(elementCompleteName));
model.add(modelFactory.createText(HtmlEscape.escapeHtml5(text)));
model.add(modelFactory.createCloseElementTag(elementCompleteName));
iElementTagStructureHandler.replaceWith(model, false);
}
示例5: getPosition
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
static Position getPosition(final ITemplateContext context,
final IProcessableElementTag tag) {
String position = tag.getAttributeValue("position");
try {
final IEngineConfiguration configuration = context.getConfiguration();
final IStandardExpressionParser parser = getExpressionParser(configuration);
final IStandardExpression expression = parser.parseExpression(context, position);
return () -> expression.execute(context).toString();
} catch (final Exception e) {
return () -> position;
}
}
示例6: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allRolesStr = tag.getAttributeValue("name");
final String[] roles = StringUtils.split(allRolesStr, DELIMITER);
if(!ShiroFacade.hasAnyRoles(roles)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例7: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allPermissionsStr = tag.getAttributeValue("name");
final String[] permissions = StringUtils.split(allPermissionsStr, DELIMITER);
if(ShiroFacade.hasAllPermissions(permissions)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例8: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allPermissionsStr = tag.getAttributeValue("name");
final String[] permissions = StringUtils.split(allPermissionsStr, DELIMITER);
if(ShiroFacade.hasAnyPermissions(permissions)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例9: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allRolesStr = tag.getAttributeValue("name");
final String[] roles = StringUtils.split(allRolesStr, DELIMITER);
if(ShiroFacade.hasAllRoles(roles)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例10: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allPermissionsStr = tag.getAttributeValue("name");
final String[] permissions = StringUtils.split(allPermissionsStr, DELIMITER);
if(!ShiroFacade.hasAnyPermissions(permissions)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例11: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(
final ITemplateContext context, final IProcessableElementTag tag,
final IElementTagStructureHandler structureHandler) {
final String allRolesStr = tag.getAttributeValue("name");
final String[] roles = StringUtils.split(allRolesStr, DELIMITER);
if(ShiroFacade.hasAnyRoles(roles)){
structureHandler.removeTags();
} else {
structureHandler.removeElement();
}
}
示例12: decorate
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
public String decorate(final IProcessableElementTag tag, final ITemplateContext context) {
Page<?> page = PageUtils.findPage(context);
// laquo
String firstPage = PageUtils.createPageUrl(context, 0);
Locale locale = context.getLocale();
String laquo = PageUtils.isFirstPage(page) ? getLaquo(locale) : getLaquo(firstPage, locale);
// Previous page
String previous = getPreviousPageLink(page, context);
// Links
String pageLinks = createPageLinks(page, context);
// Next page
String next = getNextPageLink(page, context);
// raquo
String lastPage = PageUtils.createPageUrl(context, page.getTotalPages() - 1);
String raquo = page.isLast() ? getRaquo(locale) : getRaquo(lastPage, locale);
boolean isUl = Strings.UL.equalsIgnoreCase(tag.getElementCompleteName());
String currentClass = tag.getAttributeValue(Strings.CLASS);
String clas = (isUl && !Strings.isEmpty(currentClass)) ? currentClass : DEFAULT_CLASS;
return Messages.getMessage(BUNDLE_NAME, "pagination", locale, clas, laquo, previous, pageLinks, next, raquo);
}
示例13: doProcess
import org.thymeleaf.model.IProcessableElementTag; //导入方法依赖的package包/类
@Override
protected void doProcess(ITemplateContext iTemplateContext,
IProcessableElementTag iProcessableElementTag,
IElementTagStructureHandler iElementTagStructureHandler) {
final String type = iProcessableElementTag.getAttributeValue("type");
final String property = iProcessableElementTag.getAttributeValue("property");
final String text = ShiroFacade.getPrincipalText(type, property);
iElementTagStructureHandler.replaceWith(text, false);
}