pbwest 2002/11/26 18:52:08
Modified:src/org/apache/fop/fo/properties Tag: FOP_0-20-0_Alt-Design
BorderColor.java
Log:
Now extends ColorTransparent.
Extracted processList() from refineParsing().
Fixed getColor() to try enumerated color before logging warning and
attempting system-color.
Revision ChangesPath
No revision
No revision
1.1.2.4 +78 -66xml-fop/src/org/apache/fop/fo/properties/Attic/BorderColor.java
Index: BorderColor.java
===
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderColor.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- BorderColor.java 31 Oct 2002 01:52:08 - 1.1.2.3
+++ BorderColor.java 27 Nov 2002 02:52:08 - 1.1.2.4
@@ -6,15 +6,17 @@
import org.apache.fop.datatypes.PropertyValue;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.NCName;
+import org.apache.fop.datatypes.EnumType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropNames;
import org.apache.fop.fo.ShorthandPropSets;
import org.apache.fop.fo.properties.Property;
+import org.apache.fop.messaging.MessageHandler;
import java.util.Map;
import java.util.Iterator;
-public class BorderColor extends Property {
+public class BorderColor extends ColorTransparent {
public static final int dataTypes = SHORTHAND;
public static final int traitMapping = SHORTHAND_MAP;
public static final int initialValueType = NOTYPE_IT;
@@ -78,75 +80,68 @@
return refineExpansionList(PropNames.BORDER_COLOR, foNode,
ShorthandPropSets.expandAndCopySHand(value));
}
-if (type == PropertyValue.COLOR_TYPE)
-return refineExpansionList(PropNames.BORDER_COLOR, foNode,
-ShorthandPropSets.expandAndCopySHand(value));
-if (type == PropertyValue.NCNAME) {
-// Must be a standard color
-ColorType color;
-try {
-color = new ColorType(PropNames.BORDER_COLOR,
-((NCName)value).getNCName());
-} catch (PropertyException e) {
-throw new PropertyException
-(((NCName)value).getNCName() +
- not a standard color for border-color);
-}
-return refineExpansionList(PropNames.BORDER_COLOR, foNode,
-ShorthandPropSets.expandAndCopySHand(color));
-}
-else throw new PropertyException
-(Invalid + value.getClass().getName() +
- value for border-color);
+// Form a list and pass to processList
+ PropertyValueList tmpList = new PropertyValueList(propindex);
+ tmpList.add(value);
+ return processList(tmpList);
} else {
if (nested) throw new PropertyException
(PropertyValueList invalid for nested border-color
+ refineParsing() method);
-// List may contain only multiple color specifiers
-// i.e. ColorTypes or NCNames specifying a standard color or
-// 'transparent'.
-PropertyValueList list =
-spaceSeparatedList((PropertyValueList)value);
-ColorType top, left, bottom, right;
-int count = list.size();
-if (count 2 || count 4)
-throw new PropertyException
-(border-color list contains + count + items);
-
-Iterator colors = list.iterator();
-
-// There must be at least two
-top = getColor((PropertyValue)(colors.next()));
-right = getColor((PropertyValue)(colors.next()));
-try {
-bottom = (ColorType)(top.clone());
-left = (ColorType)(right.clone());
-} catch (CloneNotSupportedException cnse) {
-throw new PropertyException
-(clone() not supported on ColorType);
-}
+return processList(spaceSeparatedList((PropertyValueList)value));
+}
+}
+
+private PropertyValueList processList(PropertyValueList list)
+throws PropertyException
+{
+// List may contain only multiple color specifiers
+// i.e. ColorTypes or NCNames specifying a standard color or
+// 'transparent'.
+ColorType top, left, bottom, right;
+int count = list.size();
+