1 16 package com.blandware.atleap.webapp.taglib.core.grid.util; 17 18 19 26 public class NumberFilter extends BaseFilter { 27 28 29 31 private String firstCondition = FilterConditions.NUMBER_EQUAL; 32 private Float firstValue = new Float (0); 33 private String secondCondition = FilterConditions.CONDITION_NOT_SET; 34 private Float secondValue = null; 35 private String logicCopula = FilterConditions.LOGIC_COPULA_AND; 36 37 42 public NumberFilter(String fieldName) { 43 super(fieldName); 44 } 45 46 53 private String createClause(String condition, Float compareTo) { 54 if ( condition.equalsIgnoreCase(FilterConditions.OBJECT_IS_NULL) || condition.equalsIgnoreCase(FilterConditions.OBJECT_IS_NOT_NULL) ) { 55 return createNullComparison(condition); 56 } else { 57 return fieldName + " " + condition + " " + compareTo.toString(); 58 } 59 } 60 61 67 public void createFirstClause(String condition, Float compareTo) { 68 this.firstCondition = condition; 69 this.firstValue = compareTo; 70 setFirstClause(createClause(condition, compareTo)); 71 } 72 73 80 public void createSecondClause(String condition, Float compareTo, String logicCopula) { 81 this.secondCondition = condition; 82 this.secondValue = compareTo; 83 this.logicCopula = logicCopula; 84 setSecondClause(createClause(condition, compareTo), logicCopula); 85 } 86 87 93 public void createSecondClause(String condition, Float compareTo) { 94 createSecondClause(condition, compareTo, FilterConditions.LOGIC_COPULA_AND); 95 } 96 97 102 public String getFirstCondition() { 103 return firstCondition; 104 } 105 106 111 public Float getFirstValue() { 112 return firstValue; 113 } 114 115 120 public String getSecondCondition() { 121 return secondCondition; 122 } 123 124 129 public Float getSecondValue() { 130 return secondValue; 131 } 132 133 138 public String getLogicCopula() { 139 return logicCopula; 140 } 141 142 } 143 | Popular Tags |