KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > xmlEngine > SectionTemplate


1 /*
2  ************************************************************************************
3  * Copyright (C) 2001-2006 Openbravo S.L.
4  * Licensed under the Apache Software License version 2.0
5  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6  * Unless required by applicable law or agreed to in writing, software distributed
7  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8  * CONDITIONS OF ANY KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations under the License.
10  ************************************************************************************
11 */

12 package org.openbravo.xmlEngine;
13
14 import java.util.Vector JavaDoc;
15 import org.apache.log4j.Logger ;
16
17 /**
18   Each of the breaks in a DataTemplate
19  **/

20 class SectionTemplate implements IDComponent {
21   String JavaDoc name;
22   DataTemplate dataTemplate;
23   int intLevel;
24   XmlVectorTemplate vecHeadTemplate;
25   XmlVectorTemplate vecFootTemplate;
26   Vector JavaDoc<Object JavaDoc> vecFunctionTemplate;
27   FieldTemplate breakFieldTemplate;
28
29   static Logger log4jSectionTemplate = Logger.getLogger(SectionTemplate.class);
30
31   public SectionTemplate(String JavaDoc id, DataTemplate dataTemplate) {
32     name = id;
33     this.dataTemplate = dataTemplate;
34     dataTemplate.intTotalLevels++;
35     intLevel = dataTemplate.intTotalLevels; // the first level is 0
36
vecHeadTemplate = new XmlVectorTemplate();
37     vecFootTemplate = new XmlVectorTemplate();
38     vecFunctionTemplate = new Vector JavaDoc<Object JavaDoc>();
39   }
40
41   public int type() {
42     return SECTION;
43   }
44
45   public DataTemplate dataTemplate() {
46     return dataTemplate;
47   }
48
49   public void addFunction(FunctionTemplate function) {
50     vecFunctionTemplate.addElement(function);
51   }
52
53   public SectionValue createSectionValue(XmlDocument xmlDocument, DataValue dataValue) {
54     SectionValue sectionValue = new SectionValue(this, xmlDocument, dataValue);
55     return sectionValue;
56   }
57 }
58
Popular Tags