Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 23 24 package org.dbforms.taglib; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import org.dbforms.config.ResultSetVector; 30 31 import org.dbforms.util.KeyValuePair; 32 import org.dbforms.util.Util; 33 34 import java.util.List ; 35 36 import javax.servlet.jsp.JspException ; 37 38 39 40 51 public class DbDataContainerLabelTag extends DbBaseHandlerTag 52 implements DataContainer, javax.servlet.jsp.tagext.TryCatchFinally { 53 private List embeddedData = null; 55 private static Log logCat = LogFactory.getLog(DbDataContainerLabelTag.class); 56 private String strict = "false"; 57 58 66 public void setEmbeddedData(List embeddedData) { 67 this.embeddedData = embeddedData; 68 } 69 70 71 76 public void setStrict(String string) { 77 strict = string; 78 } 79 80 81 86 public String getStrict() { 87 return strict; 88 } 89 90 91 94 public void doCatch(Throwable t) throws Throwable { 95 throw t; 96 } 97 98 99 107 public int doEndTag() throws javax.servlet.jsp.JspException { 108 try { 109 String fieldValue = ""; 110 111 if (!Util.getTrue(strict)) { 112 fieldValue = this.getFormattedFieldValue(); 113 } 114 115 String compareValue = this.getFieldValue(); 116 117 if (!ResultSetVector.isNull(getParentForm().getResultSetVector())) { 119 if (embeddedData != null) { 121 int embeddedDataSize = embeddedData.size(); 122 int i = 0; 123 String embeddedDataValue = null; 124 125 while (i < embeddedDataSize) { 126 KeyValuePair aKeyValuePair = (KeyValuePair) embeddedData.get(i); 127 128 if (aKeyValuePair.getKey() 129 .equals(compareValue)) { 130 embeddedDataValue = aKeyValuePair.getValue(); 131 132 break; 133 } 134 135 i++; 136 } 137 138 if (embeddedDataValue != null) { 139 fieldValue = embeddedDataValue; 140 141 } 143 } 144 } 145 146 String size = null; 149 150 if (((size = this.getMaxlength()) != null) 151 && (size.trim() 152 .length() > 0)) { 153 int count = Integer.parseInt(size); 155 156 if (count < fieldValue.length()) { 158 fieldValue = fieldValue.substring(0, count); 159 fieldValue += "..."; 160 } 161 } 162 163 String s = prepareStyles(); 166 167 if (Util.isNull(s)) { 168 pageContext.getOut() 169 .write(fieldValue); 170 } else { 171 pageContext.getOut() 172 .write("<span " + s + ">" + fieldValue + "</span>"); 173 } 174 } catch (java.io.IOException ioe) { 175 logCat.error(ioe); 176 throw new JspException ("IO Error: " + ioe.getMessage()); 177 } catch (Exception e) { 178 logCat.error(e); 179 throw new JspException ("Error: " + e.getMessage()); 180 } 181 182 return EVAL_PAGE; 183 } 184 185 186 189 public void doFinally() { 190 embeddedData = null; 191 super.doFinally(); 192 } 193 } 194
| Popular Tags
|