KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fo > properties > CommonMarginBlock


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: CommonMarginBlock.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.fo.properties;
21
22 import org.apache.fop.datatypes.Length;
23 import org.apache.fop.fo.Constants;
24 import org.apache.fop.fo.PropertyList;
25 import org.apache.fop.fo.expr.PropertyException;
26
27 /**
28  * Store all common margin properties for blocks.
29  * See Sec. 7.10 of the XSL-FO Standard.
30  * Public "structure" allows direct member access.
31  */

32 public class CommonMarginBlock {
33     /**
34      * The "margin-top" property.
35      */

36     public Length marginTop;
37
38     /**
39      * The "margin-bottom" property.
40      */

41     public Length marginBottom;
42
43     /**
44      * The "margin-left" property.
45      */

46     public Length marginLeft;
47
48     /**
49      * The "margin-right" property.
50      */

51     public Length marginRight;
52
53     /**
54      * The "space-before" property.
55      */

56     public SpaceProperty spaceBefore;
57
58     /**
59      * The "space-after" property.
60      */

61     public SpaceProperty spaceAfter;
62
63     /**
64      * The "start-indent" property.
65      */

66     public Length startIndent;
67
68     /**
69      * The "end-indent" property.
70      */

71     public Length endIndent;
72
73     /**
74      * Create a CommonMarginBlock object.
75      * @param pList The PropertyList with propery values.
76      */

77     public CommonMarginBlock(PropertyList pList) throws PropertyException {
78         marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength();
79         marginBottom = pList.get(Constants.PR_MARGIN_BOTTOM).getLength();
80         marginLeft = pList.get(Constants.PR_MARGIN_LEFT).getLength();
81         marginRight = pList.get(Constants.PR_MARGIN_RIGHT).getLength();
82
83         spaceBefore = pList.get(Constants.PR_SPACE_BEFORE).getSpace();
84         spaceAfter = pList.get(Constants.PR_SPACE_AFTER).getSpace();
85
86         startIndent = pList.get(Constants.PR_START_INDENT).getLength();
87         endIndent = pList.get(Constants.PR_END_INDENT).getLength();
88     }
89     
90     /** @see java.lang.Object#toString() */
91     public String JavaDoc toString() {
92         return "CommonMarginBlock:\n"
93             + "Margins (top, bottom, left, right): ("
94             + marginTop + ", " + marginBottom + ", "
95             + marginLeft + ", " + marginRight + ")\n"
96             + "Space (before, after): ("
97             + spaceBefore + ", " + spaceAfter + ")\n"
98             + "Indents (start, end): ("
99             + startIndent + ", " + endIndent + ")\n";
100     }
101     
102 }
103
Popular Tags