KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > digester > plugins > Slider


1 /* $Id: Slider.java 155412 2005-02-26 12:58:36Z dirkv $
2  *
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

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 JavaDoc label = "nolabel";
24     private int min = 0;
25     private int max = 0;
26
27     // define rules on this class
28
public static void addRules(Digester digester, String JavaDoc pattern) {
29         digester.addSetProperties(pattern);
30         
31         Class JavaDoc[] paramtypes = {Integer JavaDoc.class};
32         digester.addCallMethod(pattern+"/min", "setMin", 0, paramtypes);
33         digester.addCallMethod(pattern+"/max", "setMax", 0, paramtypes);
34     }
35     
36     // define different rules on this class
37
public static void addRangeRules(Digester digester, String JavaDoc pattern) {
38         // note: deliberately no addSetProperties rule
39
Class JavaDoc[] paramtypes = {Integer JavaDoc.class, Integer JavaDoc.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 JavaDoc getLabel() {
48         return label;
49     }
50     
51     public void setLabel(String JavaDoc 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