本文整理汇总了Java中javax.servlet.jsp.tagext.BodyTagSupport.findAncestorWithClass方法的典型用法代码示例。如果您正苦于以下问题:Java BodyTagSupport.findAncestorWithClass方法的具体用法?Java BodyTagSupport.findAncestorWithClass怎么用?Java BodyTagSupport.findAncestorWithClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.jsp.tagext.BodyTagSupport
的用法示例。
在下文中一共展示了BodyTagSupport.findAncestorWithClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doStartTag
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public int doStartTag() throws JspException {
ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
ListTag.class);
listName = parent.getUniqueName();
int retval = BodyTagSupport.SKIP_BODY;
setupRhnSet();
if (command.equals(ListCommand.ENUMERATE)) {
parent.addColumn();
retval = BodyTagSupport.EVAL_PAGE;
}
else if (command.equals(ListCommand.COL_HEADER)) {
renderHeader(parent);
retval = BodyTagSupport.EVAL_PAGE;
}
else if (command.equals(ListCommand.RENDER)) {
renderCheckbox();
}
return retval;
}
示例2: getOnClickScript
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* renders
* //onclick="checkbox_clicked(this, '$rhnSet')"
*
*/
private String getOnClickScript(String funcName, String boxName) {
Object current = getCurrent();
Object parent = getParentObject();
String childIds = "[]";
String memberIds = "[]";
String parentId = "";
ListTag parentTag = (ListTag)
BodyTagSupport.findAncestorWithClass(this, ListTag.class);
if (RhnListTagFunctions.isExpandable(current)) {
childIds = getChildIds(current);
}
else {
parentId = getParentId(current, parent);
memberIds = getMemberIds(current, parent);
}
return String.format(CHECKBOX_CLICKED_SCRIPT, funcName, boxName,
rhnSet, makeSelectAllCheckboxId(listName),
childIds, memberIds, parentId,
parentTag.isParentAnElement());
}
示例3: doStartTag
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public int doStartTag() throws JspException {
ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
ListTag.class);
listName = parent.getUniqueName();
int retval = BodyTagSupport.SKIP_BODY;
if (command.equals(ListCommand.ENUMERATE)) {
parent.addColumn();
renderHiddenField();
retval = BodyTagSupport.EVAL_PAGE;
}
else if (command.equals(ListCommand.COL_HEADER)) {
renderHeader(parent);
retval = BodyTagSupport.EVAL_PAGE;
}
else if (command.equals(ListCommand.RENDER)) {
render(valueExpr);
}
return retval;
}
示例4: getDecorator
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
private ListDecorator getDecorator(String decName) throws JspException {
if (decName != null) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
if (decName.indexOf('.') == -1) {
decName = "com.redhat.rhn.frontend.taglibs.list.decorators." +
decName;
}
ListDecorator dec = (ListDecorator) cl.loadClass(decName)
.newInstance();
ListSetTag parent = (ListSetTag) BodyTagSupport
.findAncestorWithClass(this, ListSetTag.class);
dec.setEnvironment(pageContext, parent, getUniqueName());
return dec;
}
catch (Exception e) {
String msg = "Exception while adding Decorator [" + decName + "]";
throw new JspException(msg, e);
}
}
return null;
}
示例5: doStartTag
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* ${@inheritDoc}
*/
public int doStartTag() throws JspException {
ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
ListTag.class);
int retval = BodyTagSupport.SKIP_BODY;
currentSortDir = fetchSortDir();
if (command.equals(ListCommand.ENUMERATE)) {
parent.addColumn();
retval = BodyTagSupport.EVAL_PAGE;
if (isSortable()) {
parent.setSortable(true);
}
}
else if (command.equals(ListCommand.COL_HEADER)) {
renderHeader();
retval = BodyTagSupport.EVAL_PAGE;
}
else if (command.equals(ListCommand.RENDER)) {
if (isBound) {
renderBound();
retval = BodyTagSupport.SKIP_BODY;
}
else {
renderUnbound();
retval = BodyTagSupport.EVAL_BODY_INCLUDE;
}
}
return retval;
}
示例6: fetchSortDir
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* Gets the active sort direction for the column, or empty string if the list is not
* sorted on this column.
*
* @return Active sort direction for the column
*/
private String fetchSortDir() {
String sortName = getSortName();
ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
ListTag.class);
if (isAlphaBarSelected() && parent.getAlphaBarColumn().equals(sortName)) {
return RequestContext.SORT_ASC;
}
String requestLabel = pageContext.getRequest().
getParameter(ListTagUtil.makeSortByLabel(getListName()));
if (requestLabel != null && !requestLabel.equals(sortName)) {
return "";
}
String sortDirectionKey = ListTagUtil.makeSortDirLabel(getListName());
String sortDir = pageContext.getRequest().getParameter(sortDirectionKey);
if (StringUtils.isBlank(sortDir)) {
sortDir = defaultSortDir;
}
return StringUtils.isEmpty(sortDir) ? "" : sortDir;
}
示例7: renderUnbound
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
protected void renderUnbound() throws JspException {
ListTag parent = (ListTag)
BodyTagSupport.findAncestorWithClass(this, ListTag.class);
if (attributeName != null) {
Object bean = parent.getCurrentObject();
String value = ListTagUtil.getBeanValue(bean, attributeName);
pageContext.setAttribute("beanValue", value, PageContext.PAGE_SCOPE);
}
writeStartingTd();
}
示例8: renderBound
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
protected void renderBound() throws JspException {
ListTag parent = (ListTag)
BodyTagSupport.findAncestorWithClass(this, ListTag.class);
Object bean = parent.getCurrentObject();
writeStartingTd();
ListTagUtil.write(pageContext, ListTagUtil.
getBeanValue(bean, attributeName));
}
示例9: setupColumnFilter
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
private void setupColumnFilter() throws JspException {
ListTag parent = (ListTag)
BodyTagSupport.findAncestorWithClass(this, ListTag.class);
String key = headerKey;
if (!StringUtils.isBlank(filterMessage)) {
key = filterMessage;
}
ColumnFilter f = new ColumnFilter(key, filterAttr);
parent.setColumnFilter(f);
}
示例10: verifyEnvironment
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
private void verifyEnvironment() throws JspException {
if (BodyTagSupport.findAncestorWithClass(this, this.getClass()) != null) {
throw new JspException("ListSet tags may not be nested.");
}
if (pageContext.getRequest().getAttribute("parentUrl") == null) {
throw new JspException("Request attribute 'parentUrl' must be set.");
}
}
示例11: doEndTag
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public int doEndTag() throws JspException {
ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
if (command.equals(ListCommand.ENUMERATE)) {
if (!StringUtils.isBlank(name)) {
ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
ListTag.class);
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (name.indexOf('.') == -1) {
name = "com.redhat.rhn.frontend.taglibs.list.row." +
name;
}
RowRenderer row = (RowRenderer) cl.loadClass(name)
.newInstance();
if (!StringUtils.isEmpty(classes)) {
row.setRowClasses(classes);
}
parent.setRowRenderer(row);
}
catch (Exception e) {
String msg = "Exception while adding Decorator [" + name + "]";
throw new JspException(msg, e);
}
}
}
return super.doEndTag();
}
示例12: getCurrentCommand
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* Locates the current ListCommand
* @param caller tag calling the method
* @param ctx caller's page context
* @return ListCommand if found, otherwise null
*/
public static ListCommand getCurrentCommand(Tag caller, PageContext ctx) {
ListTag parent = null;
if (!(caller instanceof ListTag)) {
parent = (ListTag) BodyTagSupport.findAncestorWithClass(caller, ListTag.class);
}
else {
parent = (ListTag) caller;
}
if (parent != null) {
return (ListCommand) ctx.getAttribute(parent.getUniqueName() + "_cmd");
}
return null;
}
示例13: isSelected
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
private boolean isSelected() {
if (!StringUtils.isBlank(selectExpr)) {
return selectExpr.equalsIgnoreCase("true");
}
ListTag parent = (ListTag)BodyTagSupport.
findAncestorWithClass(this, ListTag.class);
String selectionsKey = ListSessionSetHelper.makeSelectionsName(parent.getName());
Map selections = (Map)pageContext.getRequest().getAttribute(selectionsKey);
return selections != null && selections.containsKey(valueExpr);
}
示例14: doEndTag
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public int doEndTag() throws JspException {
ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
if (command.equals(ListCommand.ENUMERATE)) {
if (!StringUtils.isBlank(name)) {
ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
ListTag.class);
parent.addDecorator(name);
}
}
return super.doEndTag();
}
示例15: getTransactionLogParent
import javax.servlet.jsp.tagext.BodyTagSupport; //导入方法依赖的package包/类
protected TransactionLogTag getTransactionLogParent()
{
return (TransactionLogTag)BodyTagSupport.findAncestorWithClass(this, TransactionLogTag.class);
}