| 1 23 package org.mdarad.framework.util.struts.criteria; 24 25 import java.util.Locale ; 26 27 import org.mdarad.framework.expr.Operator; 28 import org.mdarad.framework.expr.OperatorTypes; 29 30 36 public class NumericCriterion extends FormCriterionWithOperator { 37 38 49 public NumericCriterion(String name, Class associatedEntity, CriterionProperty property, String bundleName, Locale locale) { 50 super(name, associatedEntity, property, bundleName, locale); 51 } 52 53 65 public NumericCriterion(String name, Class associatedEntity, CriterionProperty property, String bundleName, Locale locale, boolean isDynamic) { 66 super(name, associatedEntity, property, bundleName, locale, isDynamic); 67 } 68 69 77 public NumericCriterion(NumericCriterion criterion) { 78 super(criterion); 79 } 80 81 87 public void setPropertyValue(String value) { 88 if (value != null) { 89 try { 90 setValue(new Integer (value)); 91 } catch (NumberFormatException nfe) { 92 } 94 } 95 } 96 97 102 public String getPropertyValue() { 103 if (getValue() != null) { 104 return getValue().toString(); 105 } 106 107 return ""; 108 } 109 110 116 public Class getObjectType() { 117 return Integer .class; 118 } 119 120 125 public Operator[] getOperators() { 126 127 return new Operator[] { 128 new Operator("operator.numeric.equal.label", OperatorTypes.EQUAL, getBundle(), getLocale()), 129 new Operator("operator.numeric.lowerThan.label", OperatorTypes.LOWER_THAN, getBundle(), getLocale()), 130 new Operator("operator.numeric.higherThan.label", OperatorTypes.GREATER_THAN, getBundle(), getLocale()), 131 new Operator("operator.numeric.lowerThanOrEqual.label", OperatorTypes.LOWER_THAN_OR_EQUAL, getBundle(), getLocale()), 132 new Operator("operator.numeric.higherThanOrEqual.label", OperatorTypes.GREATER_THAN_OR_EQUAL, getBundle(), getLocale()) 133 }; 134 } 135 136 141 public CriterionFormPattern getFormPattern() { 142 return CriterionFormPatterns.OPERATOR_INPUT; 143 } 144 } 145 | Popular Tags |