KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > gvt > flow > MarginInfo


1 /*
2
3    Copyright 2002-2003 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.batik.gvt.flow;
19
20 public class MarginInfo {
21     public final static int ALIGN_START = 0;
22     public final static int ALIGN_MIDDLE = 1;
23     public final static int ALIGN_END = 2;
24     public final static int ALIGN_FULL = 3;
25
26     protected float top;
27     protected float right;
28     protected float bottom;
29     protected float left;
30
31     protected float indent;
32
33     protected int alignment;
34
35     protected float lineHeight;
36     protected boolean fontSizeRelative;
37
38     protected boolean flowRegionBreak;
39
40
41     public MarginInfo(float top, float right, float bottom, float left,
42                       float indent, int alignment, float lineHeight,
43                       boolean fontSizeRelative, boolean flowRegionBreak) {
44         this.top = top;
45         this.right = right;
46         this.bottom = bottom;
47         this.left = left;
48
49         this.indent = indent;
50
51         this.alignment = alignment;
52
53         this.lineHeight = lineHeight;
54         this.fontSizeRelative = fontSizeRelative;
55
56         this.flowRegionBreak = flowRegionBreak;
57     }
58
59     public MarginInfo(float margin, int alignment) {
60         setMargin(margin);
61         this.indent = 0;
62         this.alignment = alignment;
63         this.flowRegionBreak = false;
64     }
65
66     public void setMargin(float margin) {
67         this.top = margin;
68         this.right = margin;
69         this.bottom = margin;
70         this.left = margin;
71     }
72
73     public float getTopMargin() { return top; }
74     public float getRightMargin() { return right; }
75     public float getBottomMargin() { return bottom; }
76     public float getLeftMargin() { return left; }
77
78     public float getIndent() { return indent; }
79
80     public int getTextAlignment() { return alignment; }
81
82
83     public float getLineHeight() { return lineHeight; }
84     public boolean isFontSizeRelative() { return fontSizeRelative; }
85
86     public boolean isFlowRegionBreak() { return flowRegionBreak; }
87 }
88
Popular Tags