View Javadoc
1 package com.mlw.fps.view.taglib; 2 3 import javax.servlet.jsp.JspException; 4 5 import org.apache.struts.util.RequestUtils; 6 import org.apache.struts.util.ResponseUtils; 7 8 import com.mlw.fps.view.form.AdvancedSortInfoForm; 9 10 /*** 11 * 12 * @author Matthew Wilson 13 * @version $Revision: 1.3 $ 14 */ 15 public class HeaderTag extends javax.servlet.jsp.tagext.BodyTagSupport 16 { 17 private String sortInfo; 18 private String action; 19 20 /*** Holds value of property valueList. */ 21 private String valueList; 22 23 /*** Holds value of property sortColumn. */ 24 private String sortColumn; 25 26 /*** Creates new GridTag 27 */ 28 public HeaderTag() 29 { 30 super(); 31 } 32 33 public String getSortInfo() 34 { 35 return sortInfo; 36 } 37 38 public AdvancedSortInfoForm getSortInfoBean() throws JspException 39 { 40 return (AdvancedSortInfoForm)RequestUtils.lookup(pageContext, sortInfo, null); 41 } 42 43 public void release() 44 { 45 sortColumn = null; 46 valueList = null; 47 sortInfo = null; 48 action = null; 49 } 50 51 /*** 52 * @throws JspException 53 * @return 54 **/ 55 public int doStartTag() throws JspException 56 { 57 AdvancedSortInfoForm sortInfo = getSortInfoBean(); 58 if( sortInfo.getColumn()==null ) sortInfo.setColumn(sortColumn); 59 60 ResponseUtils.write(pageContext, "<tr>"); 61 return EVAL_BODY_AGAIN; 62 } 63 64 public int doEndTag() throws JspException 65 { 66 if( getBodyContent()!=null) 67 { 68 ResponseUtils.write(pageContext, getBodyContent().getString() ); 69 } 70 ResponseUtils.write(pageContext, "</tr>"); 71 72 if( valueList!=null ) 73 { 74 AdvancedSortInfoForm sortInfo = (AdvancedSortInfoForm)getSortInfoBean(); 75 com.mlw.fps.view.manager.ViewManager view = (com.mlw.fps.view.manager.ViewManager)pageContext.getSession().getAttribute("viewManager"); 76 77 com.mlw.vlh.ValueListInfo info = new com.mlw.vlh.ValueListInfo( 78 sortInfo.getColumn(), 79 sortInfo.getDirection(), 80 view.getFilterManager().getSystemFilters().getFilters() 81 ); 82 83 if( sortInfo.getKillerPk() != null ) 84 info.getFilters().put("killerPk", sortInfo.getKillerPk() ); 85 else 86 info.getFilters().remove("killerPk"); 87 88 89 if( sortInfo.getWeaponPk() != null ) 90 info.getFilters().put("weaponPk", sortInfo.getWeaponPk() ); 91 else 92 info.getFilters().remove("weaponPk"); 93 94 pageContext.getRequest().setAttribute(valueList, com.mlw.vlh.ValueListHandler.getInstance().getValueList(info, valueList) ); 95 96 info.getFilters().remove("killerPk"); 97 } 98 99 return SKIP_BODY; 100 } 101 102 /*** Setter for property sortInfo. 103 * @param sortInfo New value of property sortInfo. 104 */ 105 public void setSortInfo(String sortInfo) 106 { 107 this.sortInfo = sortInfo; 108 } 109 110 /*** Setter for property action. 111 * @param action New value of property action. 112 */ 113 public void setAction(String action) 114 { 115 this.action = action; 116 } 117 public String getAction() 118 { 119 if( action.endsWith("&") ) 120 { 121 return action; 122 } 123 else if( action.indexOf('?') > 0 ) 124 { 125 return action + "&"; 126 } 127 else 128 { 129 return action + "?"; 130 } 131 } 132 133 /*** Getter for property valueList. 134 * @return Value of property valueList. 135 */ 136 public String getValueList() 137 { 138 return this.valueList; 139 } 140 141 /*** Setter for property valueList. 142 * @param valueList New value of property valueList. 143 */ 144 public void setValueList(String valueList) 145 { 146 this.valueList = valueList; 147 } 148 149 /*** Getter for property sortColumn. 150 * @return Value of property sortColumn. 151 */ 152 public String getSortColumn() 153 { 154 return this.sortColumn; 155 } 156 157 /*** Setter for property sortColumn. 158 * @param sortColumn New value of property sortColumn. 159 */ 160 public void setSortColumn(String sortColumn) 161 { 162 this.sortColumn = sortColumn; 163 } 164 165 }

This page was automatically generated by Maven