blob: 8d367c2149012c8773dcdc98649c77265c8bd8cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.fo;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.AutoLength;
import org.apache.fop.fo.expr.Numeric;
import org.apache.fop.apps.FOPException;
public class LengthProperty extends Property {
public static class Maker extends Property.Maker {
public /* protected */ Maker(String name) {
super(name);
}
/**
* protected Property checkPropertyKeywords(String value) {
* if (isAutoLengthAllowed() && value.equals("auto")) {
* return new LengthProperty(Length.AUTO);
* }
* return null;
* }
*/
protected boolean isAutoLengthAllowed() {
return false;
}
public Property convertProperty(Property p,
PropertyList propertyList,
FObj fo) throws FOPException {
if (isAutoLengthAllowed()) {
String pval = p.getString();
if (pval != null && pval.equals("auto"))
return new LengthProperty(new AutoLength());
}
if (p instanceof LengthProperty)
return p;
Length val = p.getLength();
if (val != null)
return new LengthProperty(val);
return convertPropertyDatatype(p, propertyList, fo);
}
}
/*
* public static Property.Maker maker(String prop) {
* return new Maker(prop);
* }
*/
/**
* This object may be also be a subclass of Length, such
* as PercentLength, TableColLength.
*/
private Length length;
public LengthProperty(Length length) {
this.length = length;
// System.err.println("Set LengthProperty: " + length.toString());
}
public Numeric getNumeric() {
return length.asNumeric() ;
}
public Length getLength() {
return this.length;
}
public Object getObject() {
return this.length;
}
}
|