You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/10/08 16:03:32 UTC
[17/62] [abbrv] [partial] Merged Apache Flex 4.9.0 release branch
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GenericBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GenericBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GenericBridge.java
index b51e2d9..b063508 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GenericBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GenericBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -25,7 +26,7 @@ import org.w3c.dom.Element;
*
* @author <a href="mailto:vincent.hardy@apache.org">Vincent Hardy</a>
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: GenericBridge.java,v 1.3 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: GenericBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface GenericBridge extends Bridge {
@@ -34,8 +35,7 @@ public interface GenericBridge extends Bridge {
* For example, see the <tt>SVGTitleElementBridge</tt>.
*
* @param ctx the bridge context to use
- * @param e the element that describes the graphics node to build
+ * @param e the element being handled
*/
void handleElement(BridgeContext ctx, Element e);
-
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GraphicsNodeBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GraphicsNodeBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GraphicsNodeBridge.java
index cfcb7fc..f9509ef 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GraphicsNodeBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GraphicsNodeBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-2002 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -25,7 +26,7 @@ import org.w3c.dom.Element;
* according to an <tt>Element</tt>.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: GraphicsNodeBridge.java,v 1.11 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: GraphicsNodeBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface GraphicsNodeBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/InterruptedBridgeException.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/InterruptedBridgeException.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/InterruptedBridgeException.java
index e02422c..2d312ec 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/InterruptedBridgeException.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/InterruptedBridgeException.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -22,7 +23,7 @@ package org.apache.flex.forks.batik.bridge;
* current thread was interrupted.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: InterruptedBridgeException.java,v 1.4 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: InterruptedBridgeException.java 475477 2006-11-15 22:44:28Z cam $
*/
public class InterruptedBridgeException extends RuntimeException {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MarkerBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MarkerBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MarkerBridge.java
index 3ccd1e2..eb8f654 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MarkerBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MarkerBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2002 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -24,7 +25,7 @@ import org.w3c.dom.Element;
* Factory class for vending <tt>Marker</tt> objects.
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: MarkerBridge.java,v 1.5 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: MarkerBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface MarkerBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MaskBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MaskBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MaskBridge.java
index 7834564..bb13e0f 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MaskBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/MaskBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-2002 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -25,7 +26,7 @@ import org.w3c.dom.Element;
* Factory class for vending <tt>Mask</tt> objects.
*
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: MaskBridge.java,v 1.8 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: MaskBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface MaskBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Messages.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Messages.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Messages.java
index 3685ebd..34ff625 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Messages.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/Messages.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -26,7 +27,7 @@ import org.apache.flex.forks.batik.i18n.LocalizableSupport;
* This class manages the message for the bridge module.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: Messages.java,v 1.7 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: Messages.java 478160 2006-11-22 13:35:06Z dvholten $
*/
public class Messages {
@@ -38,7 +39,7 @@ public class Messages {
/**
* The error messages bundle class name.
*/
- protected final static String RESOURCES =
+ protected static final String RESOURCES =
"org.apache.flex.forks.batik.bridge.resources.Messages";
/**
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadExternalResourceSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadExternalResourceSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadExternalResourceSecurity.java
index 4851e51..3195181 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadExternalResourceSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadExternalResourceSecurity.java
@@ -1,10 +1,11 @@
/*
- Copyright 2002-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -23,7 +24,7 @@ package org.apache.flex.forks.batik.bridge;
* referenced from an SVG document.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: NoLoadExternalResourceSecurity.java,v 1.6 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: NoLoadExternalResourceSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class NoLoadExternalResourceSecurity implements ExternalResourceSecurity {
/**
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadScriptSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadScriptSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadScriptSecurity.java
index a90dada..a324fc6 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadScriptSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoLoadScriptSecurity.java
@@ -1,10 +1,11 @@
/*
- Copyright 2002-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -22,7 +23,7 @@ package org.apache.flex.forks.batik.bridge;
* does not allow scripts to be loaded.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: NoLoadScriptSecurity.java,v 1.6 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: NoLoadScriptSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class NoLoadScriptSecurity implements ScriptSecurity {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoRepaintRunnable.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoRepaintRunnable.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoRepaintRunnable.java
index c0155fe..7a2b0ff 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoRepaintRunnable.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/NoRepaintRunnable.java
@@ -1,10 +1,11 @@
/*
- Copyright 2002 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -22,7 +23,7 @@ package org.apache.flex.forks.batik.bridge;
* execution of this runnable.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: NoRepaintRunnable.java,v 1.3 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: NoRepaintRunnable.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface NoRepaintRunnable extends Runnable {
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintBridge.java
index 4c5f397..01378e7 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-2001,2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -26,7 +27,7 @@ import org.w3c.dom.Element;
* Bridge class for vending <tt>Paint</tt> objects.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: PaintBridge.java,v 1.7 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: PaintBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface PaintBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintServer.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintServer.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintServer.java
index 7e707b7..273d4cf 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintServer.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/PaintServer.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -24,7 +25,6 @@ import java.awt.Shape;
import java.awt.Stroke;
import org.apache.flex.forks.batik.css.engine.SVGCSSEngine;
-import org.apache.flex.forks.batik.css.engine.value.ListValue;
import org.apache.flex.forks.batik.css.engine.value.Value;
import org.apache.flex.forks.batik.css.engine.value.svg.ICCColor;
import org.apache.flex.forks.batik.ext.awt.color.ICCColorSpaceExt;
@@ -49,7 +49,7 @@ import org.w3c.dom.css.CSSValue;
* Paint using the ShapePainter interface.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: PaintServer.java,v 1.17 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: PaintServer.java 498740 2007-01-22 18:35:57Z dvholten $
*/
public abstract class PaintServer
implements SVGConstants, CSSConstants, ErrorConstants {
@@ -117,7 +117,7 @@ public abstract class PaintServer
Element markerElement = ctx.getReferencedElement(e, uri);
Bridge bridge = ctx.getBridge(markerElement);
if (bridge == null || !(bridge instanceof MarkerBridge)) {
- throw new BridgeException(e, ERR_CSS_URI_BAD_TARGET,
+ throw new BridgeException(ctx, e, ERR_CSS_URI_BAD_TARGET,
new Object[] {uri});
}
return ((MarkerBridge)bridge).createMarker(ctx, markerElement, e);
@@ -263,7 +263,8 @@ public abstract class PaintServer
ctx);
default:
- throw new Error(); // can't be reached
+ throw new IllegalArgumentException
+ ("Paint argument is not an appropriate CSS value");
}
} else { // List
Value v = paintDef.item(0);
@@ -283,7 +284,7 @@ public abstract class PaintServer
switch (v.getPrimitiveType()) {
case CSSPrimitiveValue.CSS_IDENT:
return null; // none
-
+
case CSSPrimitiveValue.CSS_RGBCOLOR:
if (paintDef.getLength() == 2) {
return convertColor(v, opacity);
@@ -293,12 +294,14 @@ public abstract class PaintServer
opacity, ctx);
}
default:
- throw new Error(); // can't be reached
+ throw new IllegalArgumentException
+ ("Paint argument is not an appropriate CSS value");
}
}
default:
// can't be reached
- throw new Error("Unallowed Value: " + v.getPrimitiveType());
+ throw new IllegalArgumentException
+ ("Paint argument is not an appropriate CSS value");
}
}
}
@@ -349,8 +352,9 @@ public abstract class PaintServer
Bridge bridge = ctx.getBridge(paintElement);
if (bridge == null || !(bridge instanceof PaintBridge)) {
- throw new BridgeException(paintedElement, ERR_CSS_URI_BAD_TARGET,
- new Object[] {uri});
+ throw new BridgeException
+ (ctx, paintedElement, ERR_CSS_URI_BAD_TARGET,
+ new Object[] {uri});
}
return ((PaintBridge)bridge).createPaint(ctx,
paintElement,
@@ -545,7 +549,7 @@ public abstract class PaintServer
*/
public static float convertStrokeMiterlimit(Value v) {
float miterlimit = v.getFloatValue();
- return (miterlimit < 1f) ? 1f : miterlimit;
+ return (miterlimit < 1.0f) ? 1.0f : miterlimit;
}
/**
@@ -562,7 +566,8 @@ public abstract class PaintServer
case 's':
return BasicStroke.CAP_SQUARE;
default:
- throw new Error(); // can't be reached
+ throw new IllegalArgumentException
+ ("Linecap argument is not an appropriate CSS value");
}
}
@@ -581,7 +586,8 @@ public abstract class PaintServer
case 'b':
return BasicStroke.JOIN_BEVEL;
default:
- throw new Error(); // can't be reached
+ throw new IllegalArgumentException
+ ("Linejoin argument is not an appropriate CSS value");
}
}
@@ -605,7 +611,8 @@ public abstract class PaintServer
f = (f > 255f) ? 255f : (f < 0f) ? 0f : f;
return Math.round(f);
default:
- throw new Error(); // can't be reached
+ throw new IllegalArgumentException
+ ("Color component argument is not an appropriate CSS value");
}
}
@@ -616,6 +623,6 @@ public abstract class PaintServer
*/
public static float convertOpacity(Value v) {
float r = v.getFloatValue();
- return (r < 0f) ? 0f : (r > 1f) ? 1f : r;
+ return (r < 0f) ? 0f : (r > 1.0f) ? 1.0f : r;
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedExternalResourceSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedExternalResourceSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedExternalResourceSecurity.java
index ec2fcf5..701fbe0 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedExternalResourceSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedExternalResourceSecurity.java
@@ -1,10 +1,11 @@
/*
- Copyright 2002 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -24,7 +25,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* external references.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: RelaxedExternalResourceSecurity.java,v 1.4 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: RelaxedExternalResourceSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class RelaxedExternalResourceSecurity implements ExternalResourceSecurity {
/**
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedScriptSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedScriptSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedScriptSecurity.java
index f41e118..d3ab7c3 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedScriptSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RelaxedScriptSecurity.java
@@ -1,10 +1,11 @@
/*
- Copyright 2002 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -27,7 +28,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* origin, not that it will run without security checks.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: RelaxedScriptSecurity.java,v 1.5 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: RelaxedScriptSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class RelaxedScriptSecurity implements ScriptSecurity {
/**
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RepaintManager.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RepaintManager.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RepaintManager.java
index ebc5ed8..7d3fd11 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RepaintManager.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/RepaintManager.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -35,11 +36,11 @@ import org.apache.flex.forks.batik.ext.awt.geom.RectListManager;
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
- * @version $Id: RepaintManager.java,v 1.18 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: RepaintManager.java 478160 2006-11-22 13:35:06Z dvholten $
*/
public class RepaintManager {
- final static int COPY_OVERHEAD = 10000;
- final static int COPY_LINE_OVERHEAD = 10;
+ static final int COPY_OVERHEAD = 10000;
+ static final int COPY_LINE_OVERHEAD = 10;
/**
* The renderer used to repaint the buffer.
@@ -52,13 +53,13 @@ public class RepaintManager {
public RepaintManager(ImageRenderer r) {
renderer = r;
}
-
+
/**
* Updates the rendering buffer.
* @param areas The areas of interest in renderer space units.
* @return the list of the rectangles to repaint.
*/
- public Collection updateRendering(Collection areas)
+ public Collection updateRendering(Collection areas)
throws InterruptedException {
renderer.flush(areas);
List rects = new ArrayList(areas.size());
@@ -74,9 +75,9 @@ public class RepaintManager {
int x1 = (int)Math.ceil(r2d.getX()+r2d.getWidth());
int y1 = (int)Math.ceil(r2d.getY()+r2d.getHeight());
// This rectangle must be outset one pixel to ensure
- // it includes the effects of anti-aliasing on object.s
+ // it includes the effects of anti-aliasing on objects.
Rectangle r = new Rectangle(x0-1, y0-1, x1-x0+3, y1-y0+3);
-
+
rects.add(r);
}
RectListManager devRLM =null;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAElementBridge.java
index 40101a9..8908094 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -19,24 +20,35 @@ package org.apache.flex.forks.batik.bridge;
import java.awt.Cursor;
+import java.util.Iterator;
+import java.util.List;
+
import org.apache.flex.forks.batik.dom.events.AbstractEvent;
-import org.apache.flex.forks.batik.dom.util.XLinkSupport;
+import org.apache.flex.forks.batik.dom.events.NodeEventTarget;
+import org.apache.flex.forks.batik.dom.svg.SVGOMAElement;
+import org.apache.flex.forks.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.flex.forks.batik.dom.svg.SVGOMDocument;
import org.apache.flex.forks.batik.gvt.GraphicsNode;
+import org.apache.flex.forks.batik.util.ParsedURL;
+import org.apache.flex.forks.batik.util.XMLConstants;
+
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
-import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.events.UIEvent;
-import org.w3c.flex.forks.dom.svg.SVGAElement;
+import org.w3c.dom.svg.SVGAElement;
/**
* Bridge class for the <a> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGAElementBridge.java,v 1.27 2004/08/18 07:12:32 vhardy Exp $
+ * @version $Id: SVGAElementBridge.java 582031 2007-10-05 00:01:09Z cam $
*/
public class SVGAElementBridge extends SVGGElementBridge {
+ protected AnchorListener al;
+ protected CursorMouseOverListener bl;
+ protected CursorMouseOutListener cl;
+
/**
* Constructs a new bridge for the <a> element.
*/
@@ -71,21 +83,61 @@ public class SVGAElementBridge extends SVGGElementBridge {
super.buildGraphicsNode(ctx, e, node);
if (ctx.isInteractive()) {
- EventTarget target = (EventTarget)e;
- EventListener l = new AnchorListener(ctx.getUserAgent());
- target.addEventListener(SVG_EVENT_CLICK, l, false);
- ctx.storeEventListener(target, SVG_EVENT_CLICK, l, false);
+ NodeEventTarget target = (NodeEventTarget)e;
+ CursorHolder ch = new CursorHolder(CursorManager.DEFAULT_CURSOR);
- l = new CursorMouseOverListener(ctx.getUserAgent());
- target.addEventListener(SVG_EVENT_MOUSEOVER, l, false);
- ctx.storeEventListener(target, SVG_EVENT_MOUSEOVER, l, false);
+ al = new AnchorListener(ctx.getUserAgent(), ch);
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+ al, false, null);
+ ctx.storeEventListenerNS
+ (target,
+ XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+ al, false);
- l = new CursorMouseOutListener(ctx.getUserAgent());
- target.addEventListener(SVG_EVENT_MOUSEOUT, l, false);
- ctx.storeEventListener(target, SVG_EVENT_MOUSEOUT, l, false);
+ bl = new CursorMouseOverListener(ctx.getUserAgent(), ch);
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+ bl, false, null);
+ ctx.storeEventListenerNS
+ (target,
+ XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+ bl, false);
+
+ cl = new CursorMouseOutListener(ctx.getUserAgent(), ch);
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+ cl, false, null);
+ ctx.storeEventListenerNS
+ (target,
+ XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+ cl, false);
}
}
+ public void dispose() {
+ NodeEventTarget target = (NodeEventTarget)e;
+ if (al != null) {
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_CLICK,
+ al, false);
+ al = null;
+ }
+ if (bl != null) {
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOVER,
+ bl, false);
+ bl = null;
+ }
+ if (cl != null) {
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, SVG_EVENT_MOUSEOUT,
+ cl, false);
+ cl = null;
+ }
+ super.dispose();
+ }
+
/**
* Returns true as the <a> element is a container.
*/
@@ -93,25 +145,93 @@ public class SVGAElementBridge extends SVGGElementBridge {
return true;
}
+ public static class CursorHolder {
+ Cursor cursor = null;
+
+ public CursorHolder(Cursor c) {
+ cursor = c;
+ }
+
+ public void holdCursor(Cursor c) {
+ cursor = c;
+ }
+ public Cursor getCursor() {
+ return cursor;
+ }
+ }
+
/**
* To handle a click on an anchor.
*/
public static class AnchorListener implements EventListener {
-
protected UserAgent userAgent;
+ protected CursorHolder holder;
- public AnchorListener(UserAgent ua) {
+ public AnchorListener(UserAgent ua, CursorHolder ch) {
userAgent = ua;
+ holder = ch;
}
public void handleEvent(Event evt) {
- if (AbstractEvent.getEventPreventDefault(evt))
- return;
+ if (!(evt instanceof AbstractEvent)) return;
+ final AbstractEvent ae = (AbstractEvent)evt;
+
+ List l = ae.getDefaultActions();
+ if (l != null) {
+ Iterator i = l.iterator();
+ while (i.hasNext()) {
+ Object o = i.next();
+ if (o instanceof AnchorDefaultActionable)
+ return; // only one anchor in default list...
+ }
+ }
+
+
SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
- Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
- userAgent.setSVGCursor(cursor);
+ ae.addDefaultAction(new AnchorDefaultActionable
+ (elt, userAgent, holder));
+ }
+ }
+
+
+ public static class AnchorDefaultActionable implements Runnable {
+
+ protected SVGOMAElement elt;
+ protected UserAgent userAgent;
+ protected CursorHolder holder;
+
+ public AnchorDefaultActionable(SVGAElement e,
+ UserAgent ua,
+ CursorHolder ch) {
+ elt = (SVGOMAElement) e;
+ userAgent = ua;
+ holder = ch;
+ }
+
+ public void run() {
+ userAgent.setSVGCursor(holder.getCursor());
+ String href = elt.getHref().getAnimVal();
+ ParsedURL purl = new ParsedURL(elt.getBaseURI(), href);
+ SVGOMDocument doc = (SVGOMDocument) elt.getOwnerDocument();
+ ParsedURL durl = doc.getParsedURL();
+ if (purl.sameFile(durl)) {
+ String frag = purl.getRef();
+ if (frag != null && frag.length() != 0) {
+ Element refElt = doc.getElementById(frag);
+ if (refElt instanceof SVGOMAnimationElement) {
+ SVGOMAnimationElement aelt =
+ (SVGOMAnimationElement) refElt;
+ float t = aelt.getHyperlinkBeginTime();
+ if (Float.isNaN(t)) {
+ aelt.beginElement();
+ } else {
+ doc.getRootElement().setCurrentTime(t);
+ }
+ return;
+ }
+ }
+ }
userAgent.openLink(elt);
- evt.stopPropagation();
}
}
@@ -121,15 +241,53 @@ public class SVGAElementBridge extends SVGGElementBridge {
public static class CursorMouseOverListener implements EventListener {
protected UserAgent userAgent;
+ protected CursorHolder holder;
- public CursorMouseOverListener(UserAgent ua) {
+ public CursorMouseOverListener(UserAgent ua, CursorHolder ch) {
userAgent = ua;
+ holder = ch;
}
public void handleEvent(Event evt) {
- if (AbstractEvent.getEventPreventDefault(evt))
- return;
- //
+ if (!(evt instanceof AbstractEvent)) return;
+ final AbstractEvent ae = (AbstractEvent)evt;
+
+ List l = ae.getDefaultActions();
+ if (l != null) {
+ Iterator i = l.iterator();
+ while (i.hasNext()) {
+ Object o = i.next();
+ if (o instanceof MouseOverDefaultActionable)
+ return; // only one anchor in default list...
+ }
+ }
+
+ Element target = (Element)ae.getTarget();
+ SVGAElement elt = (SVGAElement)ae.getCurrentTarget();
+
+ ae.addDefaultAction(new MouseOverDefaultActionable
+ (target, elt, userAgent, holder));
+ }
+ }
+
+ public static class MouseOverDefaultActionable implements Runnable {
+
+ protected Element target;
+ protected SVGAElement elt;
+ protected UserAgent userAgent;
+ protected CursorHolder holder;
+
+ public MouseOverDefaultActionable(Element t,
+ SVGAElement e,
+ UserAgent ua,
+ CursorHolder ch) {
+ target = t;
+ elt = e;
+ userAgent = ua;
+ holder = ch;
+ }
+
+ public void run() {
// Only modify the cursor if the target's cursor property is
// 'auto'. Note that we do not need to check the value of
// anchor element as the target's cursor value is resulting
@@ -147,9 +305,8 @@ public class SVGAElementBridge extends SVGGElementBridge {
// The cursor on the inside rect will be set to the hand cursor and
// not the wait cursor
//
- Element target = (Element)evt.getTarget();
-
if (CSSUtilities.isAutoCursor(target)) {
+ holder.holdCursor(CursorManager.DEFAULT_CURSOR);
// The target's cursor value is 'auto': use the hand cursor
userAgent.setSVGCursor(CursorManager.ANCHOR_CURSOR);
}
@@ -157,10 +314,8 @@ public class SVGAElementBridge extends SVGGElementBridge {
//
// In all cases, display the href in the userAgent
//
-
- SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
if (elt != null) {
- String href = XLinkSupport.getXLinkHref(elt);
+ String href = elt.getHref().getAnimVal();
userAgent.displayMessage(href);
}
}
@@ -172,19 +327,52 @@ public class SVGAElementBridge extends SVGGElementBridge {
public static class CursorMouseOutListener implements EventListener {
protected UserAgent userAgent;
+ protected CursorHolder holder;
- public CursorMouseOutListener(UserAgent ua) {
+ public CursorMouseOutListener(UserAgent ua, CursorHolder ch) {
userAgent = ua;
+ holder = ch;
}
public void handleEvent(Event evt) {
- if (AbstractEvent.getEventPreventDefault(evt))
- return;
+ if (!(evt instanceof AbstractEvent)) return;
+ final AbstractEvent ae = (AbstractEvent)evt;
+
+ List l = ae.getDefaultActions();
+ if (l != null) {
+ Iterator i = l.iterator();
+ while (i.hasNext()) {
+ Object o = i.next();
+ if (o instanceof MouseOutDefaultActionable)
+ return; // only one anchor in default list...
+ }
+ }
+
+ SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
+ ae.addDefaultAction(new MouseOutDefaultActionable
+ (elt, userAgent, holder));
+ }
+ }
+
+ public static class MouseOutDefaultActionable implements Runnable {
+
+ protected SVGAElement elt;
+ protected UserAgent userAgent;
+ protected CursorHolder holder;
+
+ public MouseOutDefaultActionable(SVGAElement e,
+ UserAgent ua,
+ CursorHolder ch) {
+ elt = e;
+ userAgent = ua;
+ holder = ch;
+ }
+
+ public void run() {
// No need to set the cursor on out events: this is taken care of
- // by the BridgeContext
+ // by the BridgeContext(?)
// Hide the href in the userAgent
- SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
if (elt != null) {
userAgent.displayMessage("");
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphElementBridge.java
index 67e7070..bb9b795 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphElementBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphElementBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -17,27 +18,24 @@
*/
package org.apache.flex.forks.batik.bridge;
-import java.awt.Paint;
-import java.awt.Stroke;
-import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
+import org.apache.flex.forks.batik.dom.AbstractNode;
import org.apache.flex.forks.batik.dom.svg.SVGOMDocument;
-import org.apache.flex.forks.batik.dom.svg.XMLBaseSupport;
import org.apache.flex.forks.batik.dom.util.XLinkSupport;
import org.apache.flex.forks.batik.gvt.font.Glyph;
import org.apache.flex.forks.batik.gvt.text.GVTAttributedCharacterIterator;
import org.apache.flex.forks.batik.gvt.text.TextPaintInfo;
+import org.apache.flex.forks.batik.util.XMLConstants;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-
/**
* Bridge class for the <altGlyph> element.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGAltGlyphElementBridge.java,v 1.18 2005/03/03 01:19:52 deweese Exp $
+ * @version $Id: SVGAltGlyphElementBridge.java 475685 2006-11-16 11:16:05Z cam $
*/
public class SVGAltGlyphElementBridge extends AbstractSVGBridge
implements ErrorConstants {
@@ -126,10 +124,10 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
if (!isLocal) {
// need to attach the imported element to the document and
// then compute the styles and uris
- String base = XMLBaseSupport.getCascadedXMLBase(altGlyphElement);
+ String base = AbstractNode.getBaseURI(altGlyphElement);
Element g = document.createElementNS(SVG_NAMESPACE_URI, SVG_G_TAG);
g.appendChild(localRefElement);
- g.setAttributeNS(XMLBaseSupport.XML_NAMESPACE_URI,
+ g.setAttributeNS(XMLConstants.XML_NAMESPACE_URI,
"xml:base",
base);
CSSUtilities.computeStyleAndURIs(refElement,
@@ -156,7 +154,7 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
NodeList glyphRefNodes
= localRefElement.getElementsByTagNameNS(SVG_NAMESPACE_URI,
- SVG_GLYPH_REF_TAG);
+ SVG_GLYPH_REF_TAG);
int numGlyphRefNodes = glyphRefNodes.getLength();
Glyph[] glyphArray = new Glyph[numGlyphRefNodes];
for (int i = 0; i < numGlyphRefNodes; i++) {
@@ -178,7 +176,7 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
NodeList altGlyphItemNodes
= localRefElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_ALT_GLYPH_ITEM_TAG);
+ (SVG_NAMESPACE_URI, SVG_ALT_GLYPH_ITEM_TAG);
int numAltGlyphItemNodes = altGlyphItemNodes.getLength();
if (numAltGlyphItemNodes > 0) {
boolean foundMatchingGlyph = false;
@@ -193,7 +191,7 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
Element altGlyphItemElement = (Element)altGlyphItemNodes.item(i);
NodeList altGlyphRefNodes
= altGlyphItemElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_GLYPH_REF_TAG);
+ (SVG_NAMESPACE_URI, SVG_GLYPH_REF_TAG);
int numAltGlyphRefNodes = altGlyphRefNodes.getLength();
glyphArray = new Glyph[numAltGlyphRefNodes];
@@ -296,7 +294,7 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
localFontElement = (Element)localGlyphElement.getParentNode();
NodeList fontFaceElements
= localFontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
+ (SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
if (fontFaceElements.getLength() > 0) {
localFontFaceElement = (Element)fontFaceElements.item(0);
}
@@ -305,10 +303,10 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
// import the whole font
localFontElement = (Element)document.importNode
(refGlyphElement.getParentNode(), true);
- String base = XMLBaseSupport.getCascadedXMLBase(altGlyphElement);
+ String base = AbstractNode.getBaseURI(altGlyphElement);
Element g = document.createElementNS(SVG_NAMESPACE_URI, SVG_G_TAG);
g.appendChild(localFontElement);
- g.setAttributeNS(XMLBaseSupport.XML_NAMESPACE_URI,
+ g.setAttributeNS(XMLConstants.XML_NAMESPACE_URI,
"xml:base",
base);
CSSUtilities.computeStyleAndURIs(
@@ -319,7 +317,7 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
String glyphId = refGlyphElement.getAttributeNS
(null, SVG_ID_ATTRIBUTE);
NodeList glyphElements = localFontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_GLYPH_TAG);
+ (SVG_NAMESPACE_URI, SVG_GLYPH_TAG);
for (int i = 0; i < glyphElements.getLength(); i++) {
Element glyphElem = (Element)glyphElements.item(i);
if (glyphElem.getAttributeNS(null, SVG_ID_ATTRIBUTE).equals(glyphId)) {
@@ -330,7 +328,7 @@ public class SVGAltGlyphElementBridge extends AbstractSVGBridge
// get the local font-face element
NodeList fontFaceElements
= localFontElement.getElementsByTagNameNS
- (SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
+ (SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
if (fontFaceElements.getLength() > 0) {
localFontFaceElement = (Element)fontFaceElements.item(0);
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphHandler.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphHandler.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphHandler.java
index 874da24..3c54a17 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphHandler.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAltGlyphHandler.java
@@ -1,10 +1,11 @@
/*
- Copyright 2001-2003 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@@ -32,7 +33,7 @@ import org.w3c.dom.Element;
* GVTGlyphVector for the altGlyph element.
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: SVGAltGlyphHandler.java,v 1.10 2005/03/03 01:19:52 deweese Exp $
+ * @version $Id: SVGAltGlyphHandler.java 475477 2006-11-15 22:44:28Z cam $
*/
public class SVGAltGlyphHandler implements AltGlyphHandler, SVGConstants {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateColorElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateColorElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateColorElementBridge.java
new file mode 100644
index 0000000..d2df07e
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateColorElementBridge.java
@@ -0,0 +1,91 @@
+/*
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.bridge;
+
+import org.apache.flex.forks.batik.anim.AbstractAnimation;
+import org.apache.flex.forks.batik.dom.anim.AnimationTarget;
+import org.apache.flex.forks.batik.anim.ColorAnimation;
+import org.apache.flex.forks.batik.anim.values.AnimatableColorValue;
+import org.apache.flex.forks.batik.anim.values.AnimatablePaintValue;
+import org.apache.flex.forks.batik.anim.values.AnimatableValue;
+import org.apache.flex.forks.batik.util.SVGTypes;
+
+/**
+ * Bridge class for the 'animateColor' animation element.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: SVGAnimateColorElementBridge.java 475477 2006-11-15 22:44:28Z cam $
+ */
+public class SVGAnimateColorElementBridge extends SVGAnimateElementBridge {
+
+ /**
+ * Returns 'animateColor'.
+ */
+ public String getLocalName() {
+ return SVG_ANIMATE_COLOR_TAG;
+ }
+
+ /**
+ * Returns a new instance of this bridge.
+ */
+ public Bridge getInstance() {
+ return new SVGAnimateColorElementBridge();
+ }
+
+ /**
+ * Creates the animation object for the animation element.
+ */
+ protected AbstractAnimation createAnimation(AnimationTarget target) {
+ AnimatableValue from = parseAnimatableValue(SVG_FROM_ATTRIBUTE);
+ AnimatableValue to = parseAnimatableValue(SVG_TO_ATTRIBUTE);
+ AnimatableValue by = parseAnimatableValue(SVG_BY_ATTRIBUTE);
+ return new ColorAnimation(timedElement,
+ this,
+ parseCalcMode(),
+ parseKeyTimes(),
+ parseKeySplines(),
+ parseAdditive(),
+ parseAccumulate(),
+ parseValues(),
+ from,
+ to,
+ by);
+ }
+
+ /**
+ * Returns whether the animation element being handled by this bridge can
+ * animate attributes of the specified type.
+ * @param type one of the TYPE_ constants defined in {@link SVGTypes}.
+ */
+ protected boolean canAnimateType(int type) {
+ return type == SVGTypes.TYPE_COLOR || type == SVGTypes.TYPE_PAINT;
+ }
+
+ /**
+ * Returns whether the specified {@link AnimatableValue} is of a type allowed
+ * by this animation.
+ */
+ protected boolean checkValueType(AnimatableValue v) {
+ if (v instanceof AnimatablePaintValue) {
+ return ((AnimatablePaintValue) v).getPaintType()
+ == AnimatablePaintValue.PAINT_COLOR;
+ }
+ return v instanceof AnimatableColorValue;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateElementBridge.java
new file mode 100644
index 0000000..84f6a5a
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateElementBridge.java
@@ -0,0 +1,327 @@
+/*
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.bridge;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.flex.forks.batik.anim.AbstractAnimation;
+import org.apache.flex.forks.batik.anim.AnimationEngine;
+import org.apache.flex.forks.batik.dom.anim.AnimationTarget;
+import org.apache.flex.forks.batik.anim.SimpleAnimation;
+import org.apache.flex.forks.batik.anim.values.AnimatableValue;
+import org.apache.flex.forks.batik.util.SMILConstants;
+
+/**
+ * Bridge class for the 'animate' animation element.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: SVGAnimateElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
+ */
+public class SVGAnimateElementBridge extends SVGAnimationElementBridge {
+
+ /**
+ * Returns 'animate'.
+ */
+ public String getLocalName() {
+ return SVG_ANIMATE_TAG;
+ }
+
+ /**
+ * Returns a new instance of this bridge.
+ */
+ public Bridge getInstance() {
+ return new SVGAnimateElementBridge();
+ }
+
+ /**
+ * Creates the animation object for the animation element.
+ */
+ protected AbstractAnimation createAnimation(AnimationTarget target) {
+ AnimatableValue from = parseAnimatableValue(SVG_FROM_ATTRIBUTE);
+ AnimatableValue to = parseAnimatableValue(SVG_TO_ATTRIBUTE);
+ AnimatableValue by = parseAnimatableValue(SVG_BY_ATTRIBUTE);
+ return new SimpleAnimation(timedElement,
+ this,
+ parseCalcMode(),
+ parseKeyTimes(),
+ parseKeySplines(),
+ parseAdditive(),
+ parseAccumulate(),
+ parseValues(),
+ from,
+ to,
+ by);
+ }
+
+ /**
+ * Returns the parsed 'calcMode' attribute from the animation element.
+ */
+ protected int parseCalcMode() {
+ // If the attribute being animated has only non-additive values, take
+ // the animation as having calcMode="discrete".
+ if (animationType == AnimationEngine.ANIM_TYPE_CSS
+ && !targetElement.isPropertyAdditive(attributeLocalName)
+ || animationType == AnimationEngine.ANIM_TYPE_XML
+ && !targetElement.isAttributeAdditive(attributeNamespaceURI,
+ attributeLocalName)) {
+ return SimpleAnimation.CALC_MODE_DISCRETE;
+ }
+
+ String calcModeString = element.getAttributeNS(null,
+ SVG_CALC_MODE_ATTRIBUTE);
+ if (calcModeString.length() == 0) {
+ return getDefaultCalcMode();
+ } else if (calcModeString.equals(SMILConstants.SMIL_LINEAR_VALUE)) {
+ return SimpleAnimation.CALC_MODE_LINEAR;
+ } else if (calcModeString.equals(SMILConstants.SMIL_DISCRETE_VALUE)) {
+ return SimpleAnimation.CALC_MODE_DISCRETE;
+ } else if (calcModeString.equals(SMILConstants.SMIL_PACED_VALUE)) {
+ return SimpleAnimation.CALC_MODE_PACED;
+ } else if (calcModeString.equals(SMILConstants.SMIL_SPLINE_VALUE)) {
+ return SimpleAnimation.CALC_MODE_SPLINE;
+ }
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_CALC_MODE_ATTRIBUTE, calcModeString });
+ }
+
+ /**
+ * Returns the parsed 'additive' attribute from the animation element.
+ */
+ protected boolean parseAdditive() {
+ String additiveString = element.getAttributeNS(null,
+ SVG_ADDITIVE_ATTRIBUTE);
+ if (additiveString.length() == 0
+ || additiveString.equals(SMILConstants.SMIL_REPLACE_VALUE)) {
+ return false;
+ } else if (additiveString.equals(SMILConstants.SMIL_SUM_VALUE)) {
+ return true;
+ }
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_ADDITIVE_ATTRIBUTE, additiveString });
+ }
+
+ /**
+ * Returns the parsed 'accumulate' attribute from the animation element.
+ */
+ protected boolean parseAccumulate() {
+ String accumulateString =
+ element.getAttributeNS(null, SVG_ACCUMULATE_ATTRIBUTE);
+ if (accumulateString.length() == 0 ||
+ accumulateString.equals(SMILConstants.SMIL_NONE_VALUE)) {
+ return false;
+ } else if (accumulateString.equals(SMILConstants.SMIL_SUM_VALUE)) {
+ return true;
+ }
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_ACCUMULATE_ATTRIBUTE, accumulateString });
+ }
+
+ /**
+ * Returns the parsed 'values' attribute from the animation element.
+ */
+ protected AnimatableValue[] parseValues() {
+ boolean isCSS = animationType == AnimationEngine.ANIM_TYPE_CSS;
+ String valuesString = element.getAttributeNS(null,
+ SVG_VALUES_ATTRIBUTE);
+ int len = valuesString.length();
+ if (len == 0) {
+ return null;
+ }
+ ArrayList values = new ArrayList(7);
+ int i = 0, start = 0, end;
+ char c;
+outer: while (i < len) {
+ while (valuesString.charAt(i) == ' ') {
+ i++;
+ if (i == len) {
+ break outer;
+ }
+ }
+ start = i++;
+ if (i != len) {
+ c = valuesString.charAt(i);
+ while (c != ';') {
+ i++;
+ if (i == len) {
+ break;
+ }
+ c = valuesString.charAt(i);
+ }
+ }
+ end = i++;
+ AnimatableValue val = eng.parseAnimatableValue
+ (element, animationTarget, attributeNamespaceURI,
+ attributeLocalName, isCSS, valuesString.substring(start, end));
+ if (!checkValueType(val)) {
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_VALUES_ATTRIBUTE, valuesString });
+ }
+ values.add(val);
+ }
+ AnimatableValue[] ret = new AnimatableValue[values.size()];
+ return (AnimatableValue[]) values.toArray(ret);
+ }
+
+ /**
+ * Returns the parsed 'keyTimes' attribute from the animation element.
+ */
+ protected float[] parseKeyTimes() {
+ String keyTimesString =
+ element.getAttributeNS(null, SVG_KEY_TIMES_ATTRIBUTE);
+ int len = keyTimesString.length();
+ if (len == 0) {
+ return null;
+ }
+ ArrayList keyTimes = new ArrayList(7);
+ int i = 0, start = 0, end;
+ char c;
+outer: while (i < len) {
+ while (keyTimesString.charAt(i) == ' ') {
+ i++;
+ if (i == len) {
+ break outer;
+ }
+ }
+ start = i++;
+ if (i != len) {
+ c = keyTimesString.charAt(i);
+ while (c != ' ' && c != ';') {
+ i++;
+ if (i == len) {
+ break;
+ }
+ c = keyTimesString.charAt(i);
+ }
+ }
+ end = i++;
+ try {
+ float keyTime =
+ Float.parseFloat(keyTimesString.substring(start, end));
+ keyTimes.add(new Float(keyTime));
+ } catch (NumberFormatException nfEx ) {
+ throw new BridgeException
+ (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_KEY_TIMES_ATTRIBUTE, keyTimesString });
+ }
+ }
+ len = keyTimes.size();
+ float[] ret = new float[len];
+ for (int j = 0; j < len; j++) {
+ ret[j] = ((Float) keyTimes.get(j)).floatValue();
+ }
+ return ret;
+ }
+
+ /**
+ * Returns the parsed 'keySplines' attribute from the animation element.
+ */
+ protected float[] parseKeySplines() {
+ String keySplinesString =
+ element.getAttributeNS(null, SVG_KEY_SPLINES_ATTRIBUTE);
+ int len = keySplinesString.length();
+ if (len == 0) {
+ return null;
+ }
+ List keySplines = new ArrayList(7);
+ int count = 0, i = 0, start = 0, end;
+ char c;
+outer: while (i < len) {
+ while (keySplinesString.charAt(i) == ' ') {
+ i++;
+ if (i == len) {
+ break outer;
+ }
+ }
+ start = i++;
+ if (i != len) {
+ c = keySplinesString.charAt(i);
+ while (c != ' ' && c != ',' && c != ';') {
+ i++;
+ if (i == len) {
+ break;
+ }
+ c = keySplinesString.charAt(i);
+ }
+ end = i++;
+ if (c == ' ') {
+ do {
+ if (i == len) {
+ break;
+ }
+ c = keySplinesString.charAt(i++);
+ } while (c == ' ');
+ if (c != ';' && c != ',') {
+ i--;
+ }
+ }
+ if (c == ';') {
+ if (count == 3) {
+ count = 0;
+ } else {
+ throw new BridgeException
+ (ctx, element,
+ ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_KEY_SPLINES_ATTRIBUTE,
+ keySplinesString });
+ }
+ } else {
+ count++;
+ }
+ } else {
+ end = i++;
+ }
+ try {
+ float keySplineValue =
+ Float.parseFloat(keySplinesString.substring(start, end));
+ keySplines.add(new Float(keySplineValue));
+ } catch (NumberFormatException nfEx ) {
+ throw new BridgeException
+ (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_KEY_SPLINES_ATTRIBUTE, keySplinesString });
+ }
+ }
+ len = keySplines.size();
+ float[] ret = new float[len];
+ for (int j = 0; j < len; j++) {
+ ret[j] = ((Float) keySplines.get(j)).floatValue();
+ }
+ return ret;
+ }
+
+ /**
+ * Returns the calcMode that the animation defaults to if none is specified.
+ */
+ protected int getDefaultCalcMode() {
+ return SimpleAnimation.CALC_MODE_LINEAR;
+ }
+
+ /**
+ * Returns whether the animation element being handled by this bridge can
+ * animate attributes of the specified type.
+ * @param type one of the TYPE_ constants defined in {@link org.apache.flex.forks.batik.util.SVGTypes}.
+ */
+ protected boolean canAnimateType(int type) {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateMotionElementBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateMotionElementBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateMotionElementBridge.java
new file mode 100644
index 0000000..bbfa601
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/SVGAnimateMotionElementBridge.java
@@ -0,0 +1,339 @@
+/*
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+package org.apache.flex.forks.batik.bridge;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.flex.forks.batik.anim.AbstractAnimation;
+import org.apache.flex.forks.batik.anim.AnimationEngine;
+import org.apache.flex.forks.batik.dom.anim.AnimationTarget;
+import org.apache.flex.forks.batik.anim.MotionAnimation;
+import org.apache.flex.forks.batik.anim.values.AnimatableMotionPointValue;
+import org.apache.flex.forks.batik.anim.values.AnimatableValue;
+import org.apache.flex.forks.batik.ext.awt.geom.ExtendedGeneralPath;
+import org.apache.flex.forks.batik.dom.svg.SVGAnimatedPathDataSupport;
+import org.apache.flex.forks.batik.dom.svg.SVGOMElement;
+import org.apache.flex.forks.batik.dom.svg.SVGOMPathElement;
+import org.apache.flex.forks.batik.dom.util.XLinkSupport;
+import org.apache.flex.forks.batik.parser.AWTPathProducer;
+import org.apache.flex.forks.batik.parser.AngleHandler;
+import org.apache.flex.forks.batik.parser.AngleParser;
+import org.apache.flex.forks.batik.parser.LengthArrayProducer;
+import org.apache.flex.forks.batik.parser.LengthPairListParser;
+import org.apache.flex.forks.batik.parser.PathParser;
+import org.apache.flex.forks.batik.parser.ParseException;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.svg.SVGAngle;
+
+/**
+ * Bridge class for the 'animateMotion' animation element.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: SVGAnimateMotionElementBridge.java 501922 2007-01-31 17:47:47Z dvholten $
+ */
+public class SVGAnimateMotionElementBridge extends SVGAnimateElementBridge {
+
+ /**
+ * Returns 'animateMotion'.
+ */
+ public String getLocalName() {
+ return SVG_ANIMATE_MOTION_TAG;
+ }
+
+ /**
+ * Returns a new instance of this bridge.
+ */
+ public Bridge getInstance() {
+ return new SVGAnimateMotionElementBridge();
+ }
+
+ /**
+ * Creates the animation object for the animation element.
+ */
+ protected AbstractAnimation createAnimation(AnimationTarget target) {
+ animationType = AnimationEngine.ANIM_TYPE_OTHER;
+ attributeLocalName = "motion";
+
+ AnimatableValue from = parseLengthPair(SVG_FROM_ATTRIBUTE);
+ AnimatableValue to = parseLengthPair(SVG_TO_ATTRIBUTE);
+ AnimatableValue by = parseLengthPair(SVG_BY_ATTRIBUTE);
+
+ boolean rotateAuto = false, rotateAutoReverse = false;
+ float rotateAngle = 0;
+ short rotateAngleUnit = SVGAngle.SVG_ANGLETYPE_UNKNOWN;
+ String rotateString = element.getAttributeNS(null,
+ SVG_ROTATE_ATTRIBUTE);
+ if (rotateString.length() != 0) {
+ if (rotateString.equals("auto")) {
+ rotateAuto = true;
+ } else if (rotateString.equals("auto-reverse")) {
+ rotateAuto = true;
+ rotateAutoReverse = true;
+ } else {
+ class Handler implements AngleHandler {
+ float theAngle;
+ short theUnit = SVGAngle.SVG_ANGLETYPE_UNSPECIFIED;
+ public void startAngle() throws ParseException {
+ }
+ public void angleValue(float v) throws ParseException {
+ theAngle = v;
+ }
+ public void deg() throws ParseException {
+ theUnit = SVGAngle.SVG_ANGLETYPE_DEG;
+ }
+ public void grad() throws ParseException {
+ theUnit = SVGAngle.SVG_ANGLETYPE_GRAD;
+ }
+ public void rad() throws ParseException {
+ theUnit = SVGAngle.SVG_ANGLETYPE_RAD;
+ }
+ public void endAngle() throws ParseException {
+ }
+ }
+ AngleParser ap = new AngleParser();
+ Handler h = new Handler();
+ ap.setAngleHandler(h);
+ try {
+ ap.parse(rotateString);
+ } catch (ParseException pEx ) {
+ throw new BridgeException
+ (ctx, element,
+ pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_ROTATE_ATTRIBUTE, rotateString });
+ }
+ rotateAngle = h.theAngle;
+ rotateAngleUnit = h.theUnit;
+ }
+ }
+ return new MotionAnimation(timedElement,
+ this,
+ parseCalcMode(),
+ parseKeyTimes(),
+ parseKeySplines(),
+ parseAdditive(),
+ parseAccumulate(),
+ parseValues(),
+ from,
+ to,
+ by,
+ parsePath(),
+ parseKeyPoints(),
+ rotateAuto,
+ rotateAutoReverse,
+ rotateAngle,
+ rotateAngleUnit);
+ }
+
+ /**
+ * Returns the parsed 'path' attribute (or the path from a referencing
+ * 'mpath') from the animation element.
+ */
+ protected ExtendedGeneralPath parsePath() {
+ Node n = element.getFirstChild();
+ while (n != null) {
+ if (n.getNodeType() == Node.ELEMENT_NODE
+ && SVG_NAMESPACE_URI.equals(n.getNamespaceURI())
+ && SVG_MPATH_TAG.equals(n.getLocalName())) {
+ String uri = XLinkSupport.getXLinkHref((Element) n);
+ Element path = ctx.getReferencedElement(element, uri);
+ if (!SVG_NAMESPACE_URI.equals(path.getNamespaceURI())
+ || !SVG_PATH_TAG.equals(path.getLocalName())) {
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET,
+ new Object[] { uri });
+ }
+ SVGOMPathElement pathElt = (SVGOMPathElement) path;
+ AWTPathProducer app = new AWTPathProducer();
+ SVGAnimatedPathDataSupport.handlePathSegList
+ (pathElt.getPathSegList(), app);
+ return (ExtendedGeneralPath) app.getShape();
+ }
+ n = n.getNextSibling();
+ }
+ String pathString = element.getAttributeNS(null, SVG_PATH_ATTRIBUTE);
+ if (pathString.length() == 0) {
+ return null;
+ }
+ try {
+ AWTPathProducer app = new AWTPathProducer();
+ PathParser pp = new PathParser();
+ pp.setPathHandler(app);
+ pp.parse(pathString);
+ return (ExtendedGeneralPath) app.getShape();
+ } catch (ParseException pEx ) {
+ throw new BridgeException
+ (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_PATH_ATTRIBUTE, pathString });
+ }
+ }
+
+ /**
+ * Returns the parsed 'keyPoints' attribute from the animation element.
+ */
+ protected float[] parseKeyPoints() {
+ String keyPointsString =
+ element.getAttributeNS(null, SVG_KEY_POINTS_ATTRIBUTE);
+ int len = keyPointsString.length();
+ if (len == 0) {
+ return null;
+ }
+ List keyPoints = new ArrayList(7);
+ int i = 0, start = 0, end;
+ char c;
+outer: while (i < len) {
+ while (keyPointsString.charAt(i) == ' ') {
+ i++;
+ if (i == len) {
+ break outer;
+ }
+ }
+ start = i++;
+ if (i != len) {
+ c = keyPointsString.charAt(i);
+ while (c != ' ' && c != ';' && c != ',') {
+ i++;
+ if (i == len) {
+ break;
+ }
+ c = keyPointsString.charAt(i);
+ }
+ }
+ end = i++;
+ try {
+ float keyPointCoord =
+ Float.parseFloat(keyPointsString.substring(start, end));
+ keyPoints.add(new Float(keyPointCoord));
+ } catch (NumberFormatException nfEx ) {
+ throw new BridgeException
+ (ctx, element, nfEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_KEY_POINTS_ATTRIBUTE, keyPointsString });
+ }
+ }
+ len = keyPoints.size();
+ float[] ret = new float[len];
+ for (int j = 0; j < len; j++) {
+ ret[j] = ((Float) keyPoints.get(j)).floatValue();
+ }
+ return ret;
+ }
+
+ /**
+ * Returns the calcMode that the animation defaults to if none is specified.
+ */
+ protected int getDefaultCalcMode() {
+ return MotionAnimation.CALC_MODE_PACED;
+ }
+
+ /**
+ * Returns the parsed 'values' attribute from the animation element.
+ */
+ protected AnimatableValue[] parseValues() {
+ String valuesString = element.getAttributeNS(null,
+ SVG_VALUES_ATTRIBUTE);
+ int len = valuesString.length();
+ if (len == 0) {
+ return null;
+ }
+ return parseValues(valuesString);
+ }
+
+ protected AnimatableValue[] parseValues(String s) {
+ try {
+ LengthPairListParser lplp = new LengthPairListParser();
+ LengthArrayProducer lap = new LengthArrayProducer();
+ lplp.setLengthListHandler(lap);
+ lplp.parse(s);
+ short[] types = lap.getLengthTypeArray();
+ float[] values = lap.getLengthValueArray();
+ AnimatableValue[] ret = new AnimatableValue[types.length / 2];
+ for (int i = 0; i < types.length; i += 2) {
+ float x = animationTarget.svgToUserSpace
+ (values[i], types[i], AnimationTarget.PERCENTAGE_VIEWPORT_WIDTH);
+ float y = animationTarget.svgToUserSpace
+ (values[i + 1], types[i + 1], AnimationTarget.PERCENTAGE_VIEWPORT_HEIGHT);
+ ret[i / 2] = new AnimatableMotionPointValue(animationTarget, x, y, 0);
+ }
+ return ret;
+ } catch (ParseException pEx ) {
+ throw new BridgeException
+ (ctx, element, pEx, ErrorConstants.ERR_ATTRIBUTE_VALUE_MALFORMED,
+ new Object[] { SVG_VALUES_ATTRIBUTE, s });
+ }
+ }
+
+ /**
+ * Parses a single comma-separated length pair.
+ */
+ protected AnimatableValue parseLengthPair(String ln) {
+ String s = element.getAttributeNS(null, ln);
+ if (s.length() == 0) {
+ return null;
+ }
+ return parseValues(s)[0];
+ }
+
+ // AnimatableElement /////////////////////////////////////////////////////
+
+ /**
+ * Returns the underlying value of the animated attribute. Used for
+ * composition of additive animations.
+ */
+ public AnimatableValue getUnderlyingValue() {
+ return new AnimatableMotionPointValue(animationTarget, 0f, 0f, 0f);
+ }
+
+ /**
+ * Parses the animation element's target attributes and adds it to the
+ * document's AnimationEngine.
+ */
+ protected void initializeAnimation() {
+ // Determine the target element.
+ String uri = XLinkSupport.getXLinkHref(element);
+ Node t;
+ if (uri.length() == 0) {
+ t = element.getParentNode();
+ } else {
+ t = ctx.getReferencedElement(element, uri);
+ if (t.getOwnerDocument() != element.getOwnerDocument()) {
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET,
+ new Object[] { uri });
+ }
+ }
+ animationTarget = null;
+ if (t instanceof SVGOMElement) {
+ targetElement = (SVGOMElement) t;
+ animationTarget = targetElement;
+ }
+ if (animationTarget == null) {
+ throw new BridgeException
+ (ctx, element, ErrorConstants.ERR_URI_BAD_TARGET,
+ new Object[] { uri });
+ }
+
+ // Add the animation.
+ timedElement = createTimedElement();
+ animation = createAnimation(animationTarget);
+ eng.addAnimation(animationTarget, AnimationEngine.ANIM_TYPE_OTHER,
+ attributeNamespaceURI, attributeLocalName, animation);
+ }
+}