KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > area > BlockParent


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 /* $Id: BlockParent.java 426576 2006-07-28 15:44:37Z jeremias $ */
19  
20 package org.apache.fop.area;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.List JavaDoc;
24
25 /**
26  * A BlockParent holds block-level areas.
27  */

28 public class BlockParent extends Area {
29
30     // this position is used for absolute position
31
// or as an indent
32
// this has the size in the block progression dimension
33

34     /**
35      * The x offset position of this block parent.
36      * Used for relative (serves as left-offset trait) and absolute positioning
37      * (serves as left-position trait).
38      */

39     protected int xOffset = 0;
40
41     /**
42      * The y offset position of this block parent.
43      * Used for relative (serves as top-offset trait) and absolute positioning
44      * (serves as top-position trait).
45      */

46     protected int yOffset = 0;
47
48     /**
49      * The children of this block parent area.
50      */

51     protected List JavaDoc children = null;
52
53     // orientation if reference area
54
private int orientation = ORIENT_0;
55
56     /** @see org.apache.fop.area.Area#addChildArea(org.apache.fop.area.Area) */
57     public void addChildArea(Area childArea) {
58         if (children == null) {
59             children = new ArrayList JavaDoc();
60         }
61         children.add(childArea);
62     }
63     
64     /**
65      * Add the block area to this block parent.
66      *
67      * @param block the child block area to add
68      */

69     public void addBlock(Block block) {
70         addChildArea(block);
71     }
72
73     /**
74      * Get the list of child areas for this block area.
75      *
76      * @return the list of child areas
77      */

78     public List JavaDoc getChildAreas() {
79         return children;
80     }
81
82     /**
83      * Check whether there are child areas.
84      *
85      * @return the result.
86      */

87     public boolean isEmpty() {
88         return children == null || children.size() == 0;
89     }
90
91     /**
92      * Set the X offset of this block parent area.
93      *
94      * @param off the x offset of the block parent area
95      */

96     public void setXOffset(int off) {
97         xOffset = off;
98     }
99
100     /**
101      * Set the Y offset of this block parent area.
102      *
103      * @param off the y offset of the block parent area
104      */

105     public void setYOffset(int off) {
106         yOffset = off;
107     }
108
109     /**
110      * Get the X offset of this block parent area.
111      *
112      * @return the x offset of the block parent area
113      */

114     public int getXOffset() {
115         return xOffset;
116     }
117
118     /**
119      * Get the Y offset of this block parent area.
120      *
121      * @return the y offset of the block parent area
122      */

123     public int getYOffset() {
124         return yOffset;
125     }
126 }
127
Popular Tags