You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by kl...@apache.org on 2001/08/05 17:45:35 UTC
cvs commit: xml-fop/src/org/apache/fop/layout BorderAndPadding.java
klease 01/08/05 08:45:35
Modified: src/org/apache/fop/layout BorderAndPadding.java
Log:
Add clone method
Revision Changes Path
1.5 +34 -4 xml-fop/src/org/apache/fop/layout/BorderAndPadding.java
Index: BorderAndPadding.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/BorderAndPadding.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BorderAndPadding.java 2001/07/30 20:29:27 1.4
+++ BorderAndPadding.java 2001/08/05 15:45:35 1.5
@@ -1,5 +1,5 @@
/*
- * $Id: BorderAndPadding.java,v 1.4 2001/07/30 20:29:27 tore Exp $
+ * $Id: BorderAndPadding.java,v 1.5 2001/08/05 15:45:35 klease Exp $
* 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.
@@ -10,14 +10,14 @@
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.CondLength;
-public class BorderAndPadding {
+public class BorderAndPadding implements Cloneable {
public static final int TOP = 0;
public static final int RIGHT = 1;
public static final int BOTTOM = 2;
public static final int LEFT = 3;
- private static class ResolvedCondLength {
+ private static class ResolvedCondLength implements Cloneable {
int iLength; // Resolved length value
boolean bDiscard;
@@ -26,9 +26,33 @@
iLength = length.mvalue();
}
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ }
+
+ /**
+ * Return a full copy of the BorderAndPadding information. This clones all
+ * padding and border information.
+ * @return The copy.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ BorderAndPadding bp = (BorderAndPadding) super.clone();
+ bp.padding = (ResolvedCondLength[])padding.clone();
+ bp.borderInfo = (BorderInfo[])borderInfo.clone();
+ for (int i=0; i<padding.length; i++) {
+ if (padding[i] != null) {
+ bp.padding[i]=(ResolvedCondLength)padding[i].clone();
+ }
+ if (borderInfo[i] != null) {
+ bp.borderInfo[i]=(BorderInfo)borderInfo[i].clone();
+ }
+ }
+ return bp;
}
- public static class BorderInfo {
+ public static class BorderInfo implements Cloneable {
private int mStyle; // Enum for border style
private ColorType mColor; // Border color
private ResolvedCondLength mWidth;
@@ -39,6 +63,12 @@
mColor = color;
}
+ public Object clone() throws CloneNotSupportedException {
+ BorderInfo bi = (BorderInfo) super.clone();
+ bi.mWidth = (ResolvedCondLength)mWidth.clone();
+ // do we need to clone the Color too???
+ return bi;
+ }
}
private BorderInfo[] borderInfo = new BorderInfo[4];
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org