KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > area > inline > Leader


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: Leader.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.area.inline;
21
22 import org.apache.fop.fo.Constants;
23
24 /**
25  * This is a leader inline area.
26  * This class is only used for leader with leader-pattern of rule.
27  */

28 public class Leader extends InlineArea {
29
30     // in the case of use content or dots this is replaced
31
// with the set of inline areas
32
// if space replaced with a space
33
// otherwise this is a holder for a line
34

35     private int ruleStyle = Constants.EN_SOLID;
36     private int ruleThickness = 1000;
37
38     /**
39      * Create a new leader area.
40      */

41     public Leader() {
42     }
43
44     /**
45      * Set the rule style of this leader area.
46      *
47      * @param style the rule style for the leader line
48      */

49     public void setRuleStyle(int style) {
50         ruleStyle = style;
51     }
52
53     /**
54      * Set the rule style of this leader area.
55      * @param style the rule style for the leader area (XSL enum values)
56      */

57     public void setRuleStyle(String JavaDoc style) {
58         if ("dotted".equalsIgnoreCase(style)) {
59             setRuleStyle(Constants.EN_DOTTED);
60         } else if ("dashed".equalsIgnoreCase(style)) {
61             setRuleStyle(Constants.EN_DASHED);
62         } else if ("solid".equalsIgnoreCase(style)) {
63             setRuleStyle(Constants.EN_SOLID);
64         } else if ("double".equalsIgnoreCase(style)) {
65             setRuleStyle(Constants.EN_DOUBLE);
66         } else if ("groove".equalsIgnoreCase(style)) {
67             setRuleStyle(Constants.EN_GROOVE);
68         } else if ("ridge".equalsIgnoreCase(style)) {
69             setRuleStyle(Constants.EN_RIDGE);
70         } else if ("none".equalsIgnoreCase(style)) {
71             setRuleStyle(Constants.EN_NONE);
72         }
73     }
74     
75     /**
76      * Set the rule thickness of the rule in miilipoints.
77      *
78      * @param rt the rule thickness in millipoints
79      */

80     public void setRuleThickness(int rt) {
81         ruleThickness = rt;
82     }
83
84     /**
85      * Get the rule style of this leader.
86      *
87      * @return the rule style
88      */

89     public int getRuleStyle() {
90         return ruleStyle;
91     }
92
93     /** @return the rule style as string */
94     public String JavaDoc getRuleStyleAsString() {
95         switch (getRuleStyle()) {
96         case Constants.EN_DOTTED: return "dotted";
97         case Constants.EN_DASHED: return "dashed";
98         case Constants.EN_SOLID: return "solid";
99         case Constants.EN_DOUBLE: return "double";
100         case Constants.EN_GROOVE: return "groove";
101         case Constants.EN_RIDGE: return "ridge";
102         case Constants.EN_NONE: return "none";
103         default:
104             throw new IllegalStateException JavaDoc("Unsupported rule style: " + getRuleStyle());
105         }
106     }
107     
108     /**
109      * Get the rule thickness of the rule in miilipoints.
110      *
111      * @return the rule thickness in millipoints
112      */

113     public int getRuleThickness() {
114         return ruleThickness;
115     }
116
117 }
118
119
Popular Tags