本文整理匯總了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);
}