1 17 18 package org.apache.commons.digester.plugins; 19 20 import org.apache.commons.digester.Digester; 21 22 public class Slider implements Widget { 23 private String label = "nolabel"; 24 private int min = 0; 25 private int max = 0; 26 27 public static void addRules(Digester digester, String pattern) { 29 digester.addSetProperties(pattern); 30 31 Class [] paramtypes = {Integer .class}; 32 digester.addCallMethod(pattern+"/min", "setMin", 0, paramtypes); 33 digester.addCallMethod(pattern+"/max", "setMax", 0, paramtypes); 34 } 35 36 public static void addRangeRules(Digester digester, String pattern) { 38 Class [] paramtypes = {Integer .class, Integer .class}; 40 digester.addCallMethod(pattern+"/range", "setRange", 2, paramtypes); 41 digester.addCallParam(pattern+"/range", 0, "min"); 42 digester.addCallParam(pattern+"/range", 1, "max"); 43 } 44 45 public Slider() {} 46 47 public String getLabel() { 48 return label; 49 } 50 51 public void setLabel(String label) { 52 this.label = label; 53 } 54 55 public void setMin(int min) { 56 this.min = min; 57 } 58 59 public int getMin() { 60 return min; 61 } 62 63 public void setMax(int max) { 64 this.max = max; 65 } 66 67 public int getMax() { 68 return max; 69 } 70 71 public void setRange(int min, int max) { 72 this.min = min; 73 this.max = max; 74 } 75 } 76 | Popular Tags |