1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.digester3.plugins;
20
21 import org.apache.commons.digester3.Digester;
22
23 public class Slider
24 implements Widget
25 {
26 private String label = "nolabel";
27
28 private int min = 0;
29
30 private int max = 0;
31
32
33 public static void addRules( Digester digester, String pattern )
34 {
35 digester.addSetProperties( pattern );
36
37 Class<?>[] paramtypes = { Integer.class };
38 digester.addCallMethod( pattern + "/min", "setMin", 0, paramtypes );
39 digester.addCallMethod( pattern + "/max", "setMax", 0, paramtypes );
40 }
41
42
43 public static void addRangeRules( Digester digester, String pattern )
44 {
45
46 Class<?>[] paramtypes = { Integer.class, Integer.class };
47 digester.addCallMethod( pattern + "/range", "setRange", 2, paramtypes );
48 digester.addCallParam( pattern + "/range", 0, "min" );
49 digester.addCallParam( pattern + "/range", 1, "max" );
50 }
51
52 public Slider()
53 {
54 }
55
56 public String getLabel()
57 {
58 return label;
59 }
60
61 public void setLabel( String label )
62 {
63 this.label = label;
64 }
65
66 public void setMin( int min )
67 {
68 this.min = min;
69 }
70
71 public int getMin()
72 {
73 return min;
74 }
75
76 public void setMax( int max )
77 {
78 this.max = max;
79 }
80
81 public int getMax()
82 {
83 return max;
84 }
85
86 public void setRange( int min, int max )
87 {
88 this.min = min;
89 this.max = max;
90 }
91 }