KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > forms > binding > ClassJXPathBinding


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

16 package org.apache.cocoon.forms.binding;
17
18 import org.apache.cocoon.forms.formmodel.Widget;
19 import org.apache.commons.jxpath.JXPathContext;
20
21 /**
22  * ClassJXPathBinding provides an implementation of a {@link Binding}
23  * which allows the specification of a class of reusable bindings.
24  * <p>
25  * NOTES: <ol>
26  * <li>This Binding uses the provided widget-id as the name for the class.</li>
27  * </ol>
28  *
29  * @version $Id: ClassJXPathBinding.java 151179 2005-02-03 16:55:16Z tim $
30  */

31 public class ClassJXPathBinding extends ComposedJXPathBindingBase {
32
33     private final String JavaDoc widgetId;
34
35     /**
36      * Constructs ClassJXPathBinding
37      * @param commonAtts
38      * @param widgetId
39      * @param childBindings
40      */

41     public ClassJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String JavaDoc widgetId, JXPathBindingBase[] childBindings) {
42         super(commonAtts, childBindings);
43         this.widgetId = widgetId;
44     }
45
46     /**
47      * Returns binding definition id.
48      */

49     public String JavaDoc getId() {
50         return widgetId;
51     }
52
53     /**
54      * Narrows the scope on the form-model to the member widget-field, and
55      * narrows the scope on the object-model to the member xpath-context
56      * before continuing the binding over the child-bindings.
57      */

58     public void doLoad(Widget frmModel, JXPathContext jxpc) {
59         // Do nothing
60
}
61
62     /**
63      * Narrows the scope on the form-model to the member widget-field, and
64      * narrows the scope on the object-model to the member xpath-context
65      * before continuing the binding over the child-bindings.
66      */

67     public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
68         // Do nothing
69
}
70
71     public String JavaDoc toString() {
72         return "ClassJXPathBinding [widget=" + this.widgetId + "]";
73     }
74 }
75
Popular Tags