001 package railo.runtime.tag; 002 003 import railo.commons.lang.StringUtil; 004 import railo.runtime.exp.ExpressionException; 005 006 007 /** 008 * 009 */ 010 public final class InputBean { 011 private short type=Input.TYPE_TEXT; 012 private short validate=Input.VALIDATE_NONE; 013 private String name; 014 private boolean required; 015 private String onValidate; 016 private String onError; 017 private String pattern; 018 //private String passThrough; 019 private double range_min=Double.NaN; 020 private double range_max=Double.NaN; 021 private String message; 022 private int maxLength=-1; 023 024 /** 025 * @return Returns the message. 026 */ 027 public String getMessage() { 028 return message; 029 } 030 /** 031 * @param message The message to set. 032 */ 033 public void setMessage(String message) { 034 this.message = message; 035 } 036 /** 037 * @return Returns the name. 038 */ 039 public String getName() { 040 return name; 041 } 042 /** 043 * @param name The name to set. 044 */ 045 public void setName(String name) { 046 this.name = name; 047 } 048 /** 049 * @return Returns the onError. 050 */ 051 public String getOnError() { 052 return onError; 053 } 054 /** 055 * @param onError The onError to set. 056 */ 057 public void setOnError(String onError) { 058 this.onError = onError; 059 } 060 /** 061 * @return Returns the onValidate. 062 */ 063 public String getOnValidate() { 064 return onValidate; 065 } 066 /** 067 * @param onValidate The onValidate to set. 068 */ 069 public void setOnValidate(String onValidate) { 070 this.onValidate = onValidate; 071 } 072 073 /** 074 * @return Returns the pattern. 075 */ 076 public String getPattern() { 077 return pattern; 078 } 079 /** 080 * @param pattern The pattern to set. 081 * @throws ExpressionException 082 */ 083 public void setPattern(String pattern) throws ExpressionException { 084 // ' 085 if(StringUtil.startsWith(pattern, '\'')) { 086 if(!StringUtil.endsWith(pattern, '\'')) 087 throw new ExpressionException("invalid pattern definition ["+pattern+", missing closing [']"); 088 pattern=pattern.substring(1,pattern.length()-1); 089 } 090 // " 091 if(StringUtil.startsWith(pattern, '"')) { 092 if(!StringUtil.endsWith(pattern, '"')) 093 throw new ExpressionException("invalid pattern definition ["+pattern+", missing closing [\"]"); 094 pattern=pattern.substring(1,pattern.length()-1); 095 } 096 097 if(!StringUtil.startsWith(pattern, '/')) pattern="/".concat(pattern); 098 if(!StringUtil.endsWith(pattern, '/')) pattern=pattern.concat("/"); 099 this.pattern = pattern; 100 } 101 /** 102 * @return Returns the range_max. 103 */ 104 public double getRangeMax() { 105 return range_max; 106 } 107 /** 108 * @param range_max The range_max to set. 109 */ 110 public void setRangeMax(double range_max) { 111 this.range_max = range_max; 112 } 113 /** 114 * @return Returns the range_min. 115 */ 116 public double getRangeMin() { 117 return range_min; 118 } 119 /** 120 * @param range_min The range_min to set. 121 */ 122 public void setRangeMin(double range_min) { 123 this.range_min = range_min; 124 } 125 /** 126 * @return Returns the required. 127 */ 128 public boolean isRequired() { 129 return required; 130 } 131 /** 132 * @param required The required to set. 133 */ 134 public void setRequired(boolean required) { 135 this.required = required; 136 } 137 /** 138 * @return Returns the type. 139 */ 140 public short getType() { 141 return type; 142 } 143 /** 144 * @param type The type to set. 145 */ 146 public void setType(short type) { 147 this.type = type; 148 } 149 /** 150 * @return Returns the validate. 151 */ 152 public short getValidate() { 153 return validate; 154 } 155 /** 156 * @param validate The validate to set. 157 */ 158 public void setValidate(short validate) { 159 this.validate = validate; 160 } 161 public void setMaxLength(int maxLength) { 162 this.maxLength=maxLength; 163 } 164 public int getMaxLength() { 165 return maxLength; 166 } 167 }