blob: eec77dc3c7d643ce31a191b5422dff0eb20db655 (
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
|
/*
* $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.ColorType;
import org.apache.fop.fo.expr.Numeric;
public class NumberProperty extends Property {
public static class Maker extends Property.Maker {
public Maker(String propName) {
super(propName);
}
public Property convertProperty(Property p,
PropertyList propertyList, FObj fo) {
if (p instanceof NumberProperty)
return p;
Number val = p.getNumber();
if (val != null)
return new NumberProperty(val);
return convertPropertyDatatype(p, propertyList, fo);
}
}
private Number number;
public NumberProperty(Number num) {
this.number = num;
}
public NumberProperty(double num) {
this.number = new Double(num);
}
public NumberProperty(int num) {
this.number = new Integer(num);
}
public Number getNumber() {
return this.number;
}
/**
* public Double getDouble() {
* return new Double(this.number.doubleValue());
* }
* public Integer getInteger() {
* return new Integer(this.number.intValue());
* }
*/
public Object getObject() {
return this.number;
}
public Numeric getNumeric() {
return new Numeric(this.number);
}
public ColorType getColorType() {
// Convert numeric value to color ???
// Convert to hexadecimal and then try to make it into a color?
return new ColorType((float)0.0, (float)0.0, (float)0.0);
}
}
|