1 21 package net.mlw.vlh.web.tag; 22 23 import java.util.Locale ; 24 25 import javax.servlet.http.HttpServletRequest ; 26 import javax.servlet.jsp.JspException ; 27 28 import net.mlw.vlh.ValueList; 29 import net.mlw.vlh.web.ValueListConfigBean; 30 import net.mlw.vlh.web.tag.support.ColumnInfo; 31 import net.mlw.vlh.web.util.JspUtils; 32 33 42 public class ControlsTag extends BaseColumnTag 43 { 44 45 48 public int doStartTag() throws JspException 49 { 50 51 if (bodyContent != null) 52 { 53 bodyContent.clearBody(); 54 } 55 56 58 ValueListSpaceTag rootTag = (ValueListSpaceTag) JspUtils.getParent(this, ValueListSpaceTag.class); 59 60 ValueList valueList = rootTag.getValueList(); 61 if (valueList == null || rootTag.getValueList().getList() == null || rootTag.getValueList().getList().size() == 0) 62 { 63 return SKIP_BODY; 64 } 65 else 66 { 67 return super.doStartTag(); 68 } 69 } 70 71 74 public int doEndTag() throws JspException 75 { 76 ValueListSpaceTag rootTag = (ValueListSpaceTag) JspUtils.getParent(this, ValueListSpaceTag.class); 77 ValueListConfigBean config = rootTag.getConfig(); 78 DefaultRowTag rowTag = (DefaultRowTag) JspUtils.getParent(this, DefaultRowTag.class); 79 appendClassCellAttribute(rowTag.getRowStyleClass()); 80 Locale locale = config.getLocaleResolver().resolveLocale((HttpServletRequest ) pageContext.getRequest()); 81 82 if (rowTag.getCurrentRowNumber() == 0) 83 { 84 String titleKey = getTitleKey(); 85 String label = (titleKey == null) ? getTitle() : config.getMessageSource().getMessage(titleKey, null, titleKey, locale); 86 87 ColumnInfo columnInfo = new ColumnInfo(config.getDisplayHelper().help(pageContext, label), null, null, getAttributes()); 88 89 String toolTipKey = getToolTipKey(); 91 columnInfo.setToolTip((toolTipKey == null) ? getToolTip() : config.getMessageSource().getMessage(toolTipKey, null, toolTipKey, 92 locale)); 93 94 rowTag.addColumnInfo(columnInfo); 95 } 96 97 StringBuffer sb = new StringBuffer (rowTag.getDisplayProvider().getCellPreProcess(getCellAttributes())); 98 99 101 if (bodyContent != null && bodyContent.getString() != null && bodyContent.getString().trim().length() > 0) 102 { 103 sb.append(bodyContent.getString().trim()); 104 bodyContent.clearBody(); 105 } 106 sb.append(rowTag.getDisplayProvider().getCellPostProcess()); 107 JspUtils.write(pageContext, sb.toString()); 108 109 release(); 110 111 return EVAL_PAGE; 112 } 113 } | Popular Tags |