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:33 UTC
[18/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/CSSFontFace.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSFontFace.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSFontFace.java
index 760cf92..e210231 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSFontFace.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSFontFace.java
@@ -1,10 +1,11 @@
/*
- Copyright 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
@@ -36,7 +37,7 @@ import org.w3c.dom.css.CSSPrimitiveValue;
* This class represents a <font-face> element or @font-face rule
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: CSSFontFace.java,v 1.4 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: CSSFontFace.java 475477 2006-11-15 22:44:28Z cam $
*/
public class CSSFontFace extends FontFace implements SVGConstants {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSUtilities.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSUtilities.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSUtilities.java
index 46b1dfd..616e259 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSUtilities.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CSSUtilities.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
@@ -50,7 +51,7 @@ import org.w3c.dom.css.CSSValue;
* concrete objects regarding to CSS properties.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: CSSUtilities.java,v 1.51 2004/08/20 19:29:46 deweese Exp $
+ * @version $Id: CSSUtilities.java 498740 2007-01-22 18:35:57Z dvholten $
*/
public abstract class CSSUtilities
implements CSSConstants, ErrorConstants, XMLConstants {
@@ -78,7 +79,7 @@ public abstract class CSSUtilities
public static Value getComputedStyle(Element e, int property) {
CSSEngine engine = getCSSEngine(e);
if (engine == null) return null;
- return engine.getComputedStyle((CSSStylableElement)e,
+ return engine.getComputedStyle((CSSStylableElement)e,
null, property);
}
@@ -115,7 +116,8 @@ public abstract class CSSUtilities
case 's':
return GraphicsNode.VISIBLE_STROKE;
default:
- throw new Error(); // can't be reached
+ // can't be reached
+ throw new IllegalStateException("unexpected event, must be one of (p,f,s) is:" + s.charAt(7) );
}
}
case 'p':
@@ -129,7 +131,8 @@ public abstract class CSSUtilities
case 'n':
return GraphicsNode.NONE;
default:
- throw new Error(); // can't be reached
+ // can't be reached
+ throw new IllegalStateException("unexpected event, must be one of (v,p,f,s,a,n) is:" + s.charAt(0) );
}
}
@@ -162,7 +165,7 @@ public abstract class CSSUtilities
return new Rectangle2D.Float(x, y, w, h);
default:
- throw new InternalError(); // Cannot happen
+ throw new IllegalStateException("Unexpected length:" + length ); // Cannot happen
}
}
@@ -209,8 +212,8 @@ public abstract class CSSUtilities
* Checks if the cursor property on the input element is set to auto
*/
public static boolean isAutoCursor(Element e) {
- Value cursorValue =
- CSSUtilities.getComputedStyle(e,
+ Value cursorValue =
+ CSSUtilities.getComputedStyle(e,
SVGCSSEngine.CURSOR_INDEX);
boolean isAuto = false;
@@ -229,9 +232,9 @@ public abstract class CSSUtilities
cursorValue.getLength() == 1) {
Value lValue = cursorValue.item(0);
if (lValue != null
- &&
+ &&
lValue.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE
- &&
+ &&
lValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT
&&
lValue.getStringValue().charAt(0) == 'a') {
@@ -306,7 +309,7 @@ public abstract class CSSUtilities
if (hints == null)
hints = new RenderingHints(null);
-
+
switch(s.charAt(0)) {
case 'o': // optimizeSpeed
hints.put(RenderingHints.KEY_RENDERING,
@@ -555,6 +558,9 @@ public abstract class CSSUtilities
* @param e the element
*/
public static boolean convertDisplay(Element e) {
+ if (!(e instanceof CSSStylableElement)) {
+ return true;
+ }
Value v = getComputedStyle(e, SVGCSSEngine.DISPLAY_INDEX);
return v.getStringValue().charAt(0) != 'n';
}
@@ -578,7 +584,7 @@ public abstract class CSSUtilities
// 'opacity'
/////////////////////////////////////////////////////////////////////////
- public final static Composite TRANSPARENT =
+ public static final Composite TRANSPARENT =
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0);
/**
@@ -592,7 +598,7 @@ public abstract class CSSUtilities
float f = v.getFloatValue();
if (f <= 0f) {
return TRANSPARENT;
- } else if (f >= 1f) {
+ } else if (f >= 1.0f) {
return AlphaComposite.SrcOver;
} else {
return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, f);
@@ -626,7 +632,8 @@ public abstract class CSSUtilities
*/
public static float[] convertClip(Element e) {
Value v = getComputedStyle(e, SVGCSSEngine.CLIP_INDEX);
- switch (v.getPrimitiveType()) {
+ int primitiveType = v.getPrimitiveType();
+ switch ( primitiveType ) {
case CSSPrimitiveValue.CSS_RECT:
float [] off = new float[4];
off[0] = v.getTop().getFloatValue();
@@ -637,7 +644,8 @@ public abstract class CSSUtilities
case CSSPrimitiveValue.CSS_IDENT:
return null; // 'auto' means no offsets
default:
- throw new Error(); // can't be reached
+ // can't be reached
+ throw new IllegalStateException("Unexpected primitiveType:" + primitiveType );
}
}
@@ -659,7 +667,8 @@ public abstract class CSSUtilities
GraphicsNode filteredNode,
BridgeContext ctx) {
Value v = getComputedStyle(filteredElement, SVGCSSEngine.FILTER_INDEX);
- switch (v.getPrimitiveType()) {
+ int primitiveType = v.getPrimitiveType();
+ switch ( primitiveType ) {
case CSSPrimitiveValue.CSS_IDENT:
return null; // 'filter:none'
@@ -668,7 +677,7 @@ public abstract class CSSUtilities
Element filter = ctx.getReferencedElement(filteredElement, uri);
Bridge bridge = ctx.getBridge(filter);
if (bridge == null || !(bridge instanceof FilterBridge)) {
- throw new BridgeException(filteredElement,
+ throw new BridgeException(ctx, filteredElement,
ERR_CSS_URI_BAD_TARGET,
new Object[] {uri});
}
@@ -677,8 +686,8 @@ public abstract class CSSUtilities
filteredElement,
filteredNode);
default:
- throw new InternalError(); // can't be reached
-
+ throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached
+
}
}
@@ -700,7 +709,8 @@ public abstract class CSSUtilities
BridgeContext ctx) {
Value v = getComputedStyle(clippedElement,
SVGCSSEngine.CLIP_PATH_INDEX);
- switch (v.getPrimitiveType()) {
+ int primitiveType = v.getPrimitiveType();
+ switch ( primitiveType ) {
case CSSPrimitiveValue.CSS_IDENT:
return null; // 'clip-path:none'
@@ -709,7 +719,7 @@ public abstract class CSSUtilities
Element cp = ctx.getReferencedElement(clippedElement, uri);
Bridge bridge = ctx.getBridge(cp);
if (bridge == null || !(bridge instanceof ClipBridge)) {
- throw new BridgeException(clippedElement,
+ throw new BridgeException(ctx, clippedElement,
ERR_CSS_URI_BAD_TARGET,
new Object[] {uri});
}
@@ -718,8 +728,7 @@ public abstract class CSSUtilities
clippedElement,
clippedNode);
default:
- throw new InternalError(); // can't be reached
-
+ throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached
}
}
@@ -753,7 +762,8 @@ public abstract class CSSUtilities
GraphicsNode maskedNode,
BridgeContext ctx) {
Value v = getComputedStyle(maskedElement, SVGCSSEngine.MASK_INDEX);
- switch (v.getPrimitiveType()) {
+ int primitiveType = v.getPrimitiveType();
+ switch ( primitiveType ) {
case CSSPrimitiveValue.CSS_IDENT:
return null; // 'mask:none'
@@ -762,7 +772,7 @@ public abstract class CSSUtilities
Element m = ctx.getReferencedElement(maskedElement, uri);
Bridge bridge = ctx.getBridge(m);
if (bridge == null || !(bridge instanceof MaskBridge)) {
- throw new BridgeException(maskedElement,
+ throw new BridgeException(ctx, maskedElement,
ERR_CSS_URI_BAD_TARGET,
new Object[] {uri});
}
@@ -771,8 +781,7 @@ public abstract class CSSUtilities
maskedElement,
maskedNode);
default:
- throw new InternalError(); // can't be reached
-
+ throw new IllegalStateException("Unexpected primitive type:" + primitiveType ); // can't be reached
}
}
@@ -875,12 +884,12 @@ public abstract class CSSUtilities
public static void computeStyleAndURIs(Element refElement,
Element localRefElement,
String uri) {
- // Pull fragement id off first...
+ // Pull fragement id off first...
int idx = uri.indexOf('#');
if (idx != -1)
uri = uri.substring(0,idx);
- // Only set xml:base if we have a real URL.
+ // Only set xml:base if we have a real URL.
if (uri.length() != 0)
localRefElement.setAttributeNS(XML_NAMESPACE_URI,
"base",
@@ -888,7 +897,7 @@ public abstract class CSSUtilities
CSSEngine engine = CSSUtilities.getCSSEngine(localRefElement);
CSSEngine refEngine = CSSUtilities.getCSSEngine(refElement);
-
+
engine.importCascadedStyleMaps(refElement, refEngine, localRefElement);
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ClipBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ClipBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ClipBridge.java
index 74975af..8f9a3b9 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ClipBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ClipBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-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
@@ -27,7 +28,7 @@ import org.w3c.dom.Element;
*
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: ClipBridge.java,v 1.11 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: ClipBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface ClipBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CursorManager.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CursorManager.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CursorManager.java
index bd71fc8..805aa41 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CursorManager.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/CursorManager.java
@@ -1,10 +1,11 @@
/*
- Copyright 2002-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
@@ -36,31 +37,33 @@ import java.util.Map;
import org.apache.flex.forks.batik.css.engine.SVGCSSEngine;
import org.apache.flex.forks.batik.css.engine.value.Value;
-import org.apache.flex.forks.batik.dom.svg.XMLBaseSupport;
+import org.apache.flex.forks.batik.dom.AbstractNode;
import org.apache.flex.forks.batik.dom.util.XLinkSupport;
import org.apache.flex.forks.batik.ext.awt.image.PadMode;
import org.apache.flex.forks.batik.ext.awt.image.renderable.AffineRable8Bit;
import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
import org.apache.flex.forks.batik.ext.awt.image.renderable.PadRable8Bit;
+import org.apache.flex.forks.batik.ext.awt.image.spi.BrokenLinkProvider;
import org.apache.flex.forks.batik.ext.awt.image.spi.ImageTagRegistry;
import org.apache.flex.forks.batik.gvt.GraphicsNode;
import org.apache.flex.forks.batik.util.ParsedURL;
+import org.apache.flex.forks.batik.util.Platform;
import org.apache.flex.forks.batik.util.SVGConstants;
import org.apache.flex.forks.batik.util.SoftReferenceCache;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.css.CSSPrimitiveValue;
import org.w3c.dom.css.CSSValue;
-import org.w3c.flex.forks.dom.svg.SVGDocument;
-import org.w3c.flex.forks.dom.svg.SVGPreserveAspectRatio;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGPreserveAspectRatio;
/**
- * The CursorManager class is a helper class which preloads the cursors
+ * The CursorManager class is a helper class which preloads the cursors
* corresponding to the SVG built in cursors.
*
* @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
- * @version $Id: CursorManager.java,v 1.17 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: CursorManager.java 594367 2007-11-13 00:40:53Z cam $
*/
public class CursorManager implements SVGConstants, ErrorConstants {
/**
@@ -71,7 +74,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
/**
* Default cursor when value is not found
*/
- public static final Cursor DEFAULT_CURSOR
+ public static final Cursor DEFAULT_CURSOR
= Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
/**
@@ -96,6 +99,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
* Static initialization of the cursorMap
*/
static {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
cursorMap = new Hashtable();
cursorMap.put(SVG_CROSSHAIR_VALUE,
Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
@@ -103,8 +107,6 @@ public class CursorManager implements SVGConstants, ErrorConstants {
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
cursorMap.put(SVG_POINTER_VALUE,
Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- cursorMap.put(SVG_MOVE_VALUE,
- Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
cursorMap.put(SVG_E_RESIZE_VALUE,
Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
cursorMap.put(SVG_NE_RESIZE_VALUE,
@@ -125,9 +127,27 @@ public class CursorManager implements SVGConstants, ErrorConstants {
Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
cursorMap.put(SVG_WAIT_VALUE,
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- cursorMap.put(SVG_HELP_VALUE,
- Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-
+ Cursor moveCursor = Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR);
+ if (Platform.isOSX) {
+ try {
+ Image img = toolkit.createImage
+ (CursorManager.class.getResource("resources/move.gif"));
+ moveCursor = toolkit.createCustomCursor
+ (img, new Point(11, 11), "move");
+ } catch (Exception ex) {
+ }
+ }
+ cursorMap.put(SVG_MOVE_VALUE, moveCursor);
+ Cursor helpCursor;
+ try {
+ Image img = toolkit.createImage
+ (CursorManager.class.getResource("resources/help.gif"));
+ helpCursor = toolkit.createCustomCursor
+ (img, new Point(1, 3), "help");
+ } catch (Exception ex) {
+ helpCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
+ }
+ cursorMap.put(SVG_HELP_VALUE, helpCursor);
}
/**
@@ -158,8 +178,6 @@ public class CursorManager implements SVGConstants, ErrorConstants {
return (Cursor)cursorMap.get(cursorName);
}
-
-
/**
* Returns the Cursor corresponding to the input element's cursor property
*
@@ -175,16 +193,16 @@ public class CursorManager implements SVGConstants, ErrorConstants {
if (cursorValue.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE
&&
cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
- // Single Value : should be one of the predefined cursors or
+ // Single Value : should be one of the predefined cursors or
// 'inherit'
cursorStr = cursorValue.getStringValue();
return convertBuiltInCursor(e, cursorStr);
- } else if (cursorValue.getCssValueType() ==
+ } else if (cursorValue.getCssValueType() ==
CSSValue.CSS_VALUE_LIST) {
int nValues = cursorValue.getLength();
if (nValues == 1) {
cursorValue = cursorValue.item(0);
- if (cursorValue.getPrimitiveType() ==
+ if (cursorValue.getPrimitiveType() ==
CSSPrimitiveValue.CSS_IDENT) {
cursorStr = cursorValue.getStringValue();
return convertBuiltInCursor(e, cursorStr);
@@ -197,18 +215,18 @@ public class CursorManager implements SVGConstants, ErrorConstants {
return convertSVGCursor(e, cursorValue);
}
}
- }
-
+ }
+
return convertBuiltInCursor(e, cursorStr);
}
-
+
public Cursor convertBuiltInCursor(Element e, String cursorStr) {
Cursor cursor = null;
// The CSS engine guarantees an non null, non empty string
// as the computed value for cursor. Therefore, the following
// test is safe.
- if (cursorStr.charAt(0) == 'a') {
+ if (cursorStr.charAt(0) == 'a') {
//
// Handle 'auto' value.
//
@@ -248,7 +266,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
SVGConstants.SVG_TREF_TAG.equals(tag) ) {
cursor = CursorManager.TEXT_CURSOR;
} else if (SVGConstants.SVG_IMAGE_TAG.equals(tag)) {
- // Do not change the cursor
+ // Do not change the cursor
return null;
} else {
cursor = CursorManager.DEFAULT_CURSOR;
@@ -260,13 +278,13 @@ public class CursorManager implements SVGConstants, ErrorConstants {
// Specific, logical cursor
cursor = CursorManager.getPredefinedCursor(cursorStr);
}
-
+
return cursor;
}
-
+
/**
- * Returns a cursor for the given value list. Note that the
+ * Returns a cursor for the given value list. Note that the
* code assumes that the input value has at least two entries.
* So the caller should check that before calling the method.
* For example, CSSUtilities.convertCursor performs that check.
@@ -278,7 +296,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
Value cursorValue = l.item(i);
if (cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) {
String uri = cursorValue.getStringValue();
-
+
// If the uri does not resolve to a cursor element,
// then, this is not a type of cursor uri we can handle:
// go to the next or default to logical cursor
@@ -292,7 +310,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
throw be;
}
}
-
+
if (cursorElement != null) {
// We go an element, check it is of type cursor
String cursorNS = cursorElement.getNamespaceURI();
@@ -300,14 +318,14 @@ public class CursorManager implements SVGConstants, ErrorConstants {
SVGConstants.SVG_CURSOR_TAG.equals
(cursorElement.getLocalName())) {
Cursor c = convertSVGCursorElement(cursorElement);
- if (c != null) {
+ if (c != null) {
return c;
}
}
}
}
}
-
+
// If we got to that point, it means that no cursorElement
// produced a valid cursor, i.e., either a format we support
// or a valid referenced image (no broken image).
@@ -317,7 +335,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
if (cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
cursorStr = cursorValue.getStringValue();
}
-
+
return convertBuiltInCursor(e, cursorStr);
}
@@ -329,11 +347,11 @@ public class CursorManager implements SVGConstants, ErrorConstants {
// Try to handle its image.
String uriStr = XLinkSupport.getXLinkHref(cursorElement);
if (uriStr.length() == 0) {
- throw new BridgeException(cursorElement, ERR_ATTRIBUTE_MISSING,
+ throw new BridgeException(ctx, cursorElement, ERR_ATTRIBUTE_MISSING,
new Object[] {"xlink:href"});
}
- String baseURI = XMLBaseSupport.getCascadedXMLBase(cursorElement);
+ String baseURI = AbstractNode.getBaseURI(cursorElement);
ParsedURL purl;
if (baseURI == null) {
purl = new ParsedURL(uriStr);
@@ -344,7 +362,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
//
// Convert the cursor's hot spot
//
- UnitProcessor.Context uctx
+ UnitProcessor.Context uctx
= UnitProcessor.createContext(ctx, cursorElement);
String s = cursorElement.getAttributeNS(null, SVG_X_ATTRIBUTE);
@@ -370,22 +388,22 @@ public class CursorManager implements SVGConstants, ErrorConstants {
if (cachedCursor != null) {
return cachedCursor;
- }
-
+ }
+
//
- // Load image into Filter f and transform hotSpot to
+ // Load image into Filter f and transform hotSpot to
// cursor space.
//
Point2D.Float hotSpot = new Point2D.Float(x, y);
- Filter f = cursorHrefToFilter(cursorElement,
- purl,
+ Filter f = cursorHrefToFilter(cursorElement,
+ purl,
hotSpot);
if (f == null) {
cursorCache.clearCursor(desc);
return null;
}
-
- // The returned Filter is guaranteed to create a
+
+ // The returned Filter is guaranteed to create a
// default rendering of the desired size
Rectangle cursorSize = f.getBounds2D().getBounds();
RenderedImage ri = f.createScaledRendering(cursorSize.width,
@@ -410,23 +428,23 @@ public class CursorManager implements SVGConstants, ErrorConstants {
// The cursor image is now into 'img'
//
Cursor c = Toolkit.getDefaultToolkit()
- .createCustomCursor(img,
+ .createCustomCursor(img,
new Point(Math.round(hotSpot.x),
Math.round(hotSpot.y)),
purl.toString());
cursorCache.putCursor(desc, c);
- return c;
+ return c;
}
/**
- * Converts the input ParsedURL into a Filter and transforms the
+ * Converts the input ParsedURL into a Filter and transforms the
* input hotSpot point (in image space) to cursor space
*/
- protected Filter cursorHrefToFilter(Element cursorElement,
+ protected Filter cursorHrefToFilter(Element cursorElement,
ParsedURL purl,
Point2D hotSpot) {
-
+
AffineRable8Bit f = null;
String uriStr = purl.toString();
Dimension cursorSize = null;
@@ -434,30 +452,30 @@ public class CursorManager implements SVGConstants, ErrorConstants {
// Try to load as an SVG Document
DocumentLoader loader = ctx.getDocumentLoader();
SVGDocument svgDoc = (SVGDocument)cursorElement.getOwnerDocument();
- URIResolver resolver = new URIResolver(svgDoc, loader);
+ URIResolver resolver = ctx.createURIResolver(svgDoc, loader);
try {
Element rootElement = null;
Node n = resolver.getNode(uriStr, cursorElement);
if (n.getNodeType() == Node.DOCUMENT_NODE) {
SVGDocument doc = (SVGDocument)n;
// FIXX: really should be subCtx here.
- ctx.initializeDocument(doc);
+ ctx.initializeDocument(doc);
rootElement = doc.getRootElement();
} else {
- throw new BridgeException
- (cursorElement, ERR_URI_IMAGE_INVALID,
+ throw new BridgeException
+ (ctx, cursorElement, ERR_URI_IMAGE_INVALID,
new Object[] {uriStr});
}
GraphicsNode node = ctx.getGVTBuilder().build(ctx, rootElement);
//
- // The cursorSize define the viewport into which the
- // cursor is displayed. That viewport is platform
+ // The cursorSize define the viewport into which the
+ // cursor is displayed. That viewport is platform
// dependant and is not defined by the SVG content.
//
float width = DEFAULT_PREFERRED_WIDTH;
float height = DEFAULT_PREFERRED_HEIGHT;
- UnitProcessor.Context uctx
+ UnitProcessor.Context uctx
= UnitProcessor.createContext(ctx, rootElement);
String s = rootElement.getAttribute(SVG_WIDTH_ATTRIBUTE);
@@ -465,31 +483,29 @@ public class CursorManager implements SVGConstants, ErrorConstants {
width = UnitProcessor.svgHorizontalLengthToUserSpace
(s, SVG_WIDTH_ATTRIBUTE, uctx);
}
-
+
s = rootElement.getAttribute(SVG_HEIGHT_ATTRIBUTE);
if (s.length() != 0) {
height = UnitProcessor.svgVerticalLengthToUserSpace
(s, SVG_HEIGHT_ATTRIBUTE, uctx);
}
- cursorSize
+ cursorSize
= Toolkit.getDefaultToolkit().getBestCursorSize
(Math.round(width), Math.round(height));
-
+
// Handle the viewBox transform
- AffineTransform at
- = ViewBox.getPreserveAspectRatioTransform(rootElement,
- cursorSize.width,
- cursorSize.height);
+ AffineTransform at = ViewBox.getPreserveAspectRatioTransform
+ (rootElement, cursorSize.width, cursorSize.height, ctx);
Filter filter = node.getGraphicsNodeRable(true);
f = new AffineRable8Bit(filter, at);
} catch (BridgeException ex) {
throw ex;
} catch (SecurityException ex) {
- throw new BridgeException(cursorElement, ERR_URI_UNSECURE,
+ throw new BridgeException(ctx, cursorElement, ex, ERR_URI_UNSECURE,
new Object[] {uriStr});
} catch (Exception ex) {
- /* Nothing to do */
+ /* Nothing to do */
}
@@ -503,19 +519,18 @@ public class CursorManager implements SVGConstants, ErrorConstants {
}
// Check if we got a broken image
- if (filter.getProperty
- (SVGBrokenLinkProvider.SVG_BROKEN_LINK_DOCUMENT_PROPERTY) != null) {
+ if (BrokenLinkProvider.hasBrokenLinkProperty(filter)) {
return null;
- }
-
+ }
+
Rectangle preferredSize = filter.getBounds2D().getBounds();
cursorSize = Toolkit.getDefaultToolkit().getBestCursorSize
(preferredSize.width, preferredSize.height);
-
+
if (preferredSize != null && preferredSize.width >0
&& preferredSize.height > 0 ) {
AffineTransform at = new AffineTransform();
- if (preferredSize.width > cursorSize.width
+ if (preferredSize.width > cursorSize.width
||
preferredSize.height > cursorSize.height) {
at = ViewBox.getPreserveAspectRatioTransform
@@ -524,7 +539,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
true,
cursorSize.width,
cursorSize.height);
- }
+ }
f = new AffineRable8Bit(filter, at);
} else {
// Invalid Size
@@ -542,15 +557,15 @@ public class CursorManager implements SVGConstants, ErrorConstants {
//
// In all cases, clip to the cursor boundaries
//
- Rectangle cursorViewport
+ Rectangle cursorViewport
= new Rectangle(0, 0, cursorSize.width, cursorSize.height);
- PadRable8Bit cursorImage
+ PadRable8Bit cursorImage
= new PadRable8Bit(f, cursorViewport,
PadMode.ZERO_PAD);
return cursorImage;
-
+
}
@@ -590,25 +605,25 @@ public class CursorManager implements SVGConstants, ErrorConstants {
this.y = y;
// Desc is used for hascode as well as for toString()
- this.desc = this.getClass().getName() +
+ this.desc = this.getClass().getName() +
"\n\t:[" + this.purl + "]\n\t:[" + x + "]:[" + y + "]";
}
public boolean equals(Object obj) {
- if (obj == null
+ if (obj == null
||
!(obj instanceof CursorDescriptor)) {
return false;
}
CursorDescriptor desc = (CursorDescriptor)obj;
- boolean isEqual =
+ boolean isEqual =
this.purl.equals(desc.purl)
&&
this.x == desc.x
&&
this.y == desc.y;
-
+
return isEqual;
}
@@ -622,7 +637,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
}
/**
- * Simple extension of the SoftReferenceCache that
+ * Simple extension of the SoftReferenceCache that
* offers typed interface (Kind of needed as SoftReferenceCache
* mostly has protected methods).
*/
@@ -634,7 +649,7 @@ public class CursorManager implements SVGConstants, ErrorConstants {
return (Cursor)requestImpl(desc);
}
- public void putCursor(CursorDescriptor desc,
+ public void putCursor(CursorDescriptor desc,
Cursor cursor) {
putImpl(desc, cursor);
}
@@ -643,7 +658,4 @@ public class CursorManager implements SVGConstants, ErrorConstants {
clearImpl(desc);
}
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultExternalResourceSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultExternalResourceSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultExternalResourceSecurity.java
index 577ebfb..8ada370 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultExternalResourceSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultExternalResourceSecurity.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
@@ -25,7 +26,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* come from the same server as the document they are referenced from.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: DefaultExternalResourceSecurity.java,v 1.5 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: DefaultExternalResourceSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class DefaultExternalResourceSecurity implements ExternalResourceSecurity {
public static final String DATA_PROTOCOL = "data";
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultScriptSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultScriptSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultScriptSecurity.java
index f37b70f..9ec104f 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultScriptSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DefaultScriptSecurity.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
@@ -25,7 +26,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* come from the same server as the document they are included into.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: DefaultScriptSecurity.java,v 1.6 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: DefaultScriptSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class DefaultScriptSecurity implements ScriptSecurity {
public static final String DATA_PROTOCOL = "data";
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentBridge.java
new file mode 100644
index 0000000..e45852c
--- /dev/null
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentBridge.java
@@ -0,0 +1,56 @@
+/*
+
+ 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.gvt.RootGraphicsNode;
+
+import org.w3c.dom.Document;
+
+/**
+ * Interface for bridge classes that operate on Document nodes.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id: DocumentBridge.java 582434 2007-10-06 02:11:51Z cam $
+ */
+public interface DocumentBridge extends Bridge {
+
+ /**
+ * Creates a <tt>GraphicsNode</tt> according to the specified parameters.
+ * This is called before children have been added to the
+ * returned GraphicsNode (obviously since you construct and return it).
+ *
+ * @param ctx the bridge context to use
+ * @param doc the document node that describes the graphics node to build
+ * @return a graphics node that represents the specified document node
+ */
+ RootGraphicsNode createGraphicsNode(BridgeContext ctx, Document doc);
+
+ /**
+ * Builds using the specified BridgeContext and element, the
+ * specified graphics node. This is called after all the children
+ * of the node have been constructed and added, so it is safe to
+ * do work that depends on being able to see your children nodes
+ * in this method.
+ *
+ * @param ctx the bridge context to use
+ * @param doc the document node that describes the graphics node to build
+ * @param node the graphics node to build
+ */
+ void buildGraphicsNode(BridgeContext ctx, Document doc, RootGraphicsNode node);
+}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentJarClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentJarClassLoader.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentJarClassLoader.java
index 6c11869..b6aa7d9 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentJarClassLoader.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentJarClassLoader.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
@@ -36,7 +37,7 @@ import java.util.Enumeration;
* the document referencing them.
*
* @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a>
- * @version $Id: DocumentJarClassLoader.java,v 1.5 2004/10/30 16:54:53 deweese Exp $
+ * @version $Id: DocumentJarClassLoader.java 475685 2006-11-16 11:16:05Z cam $
*/
public class DocumentJarClassLoader extends URLClassLoader {
/**
@@ -77,12 +78,12 @@ public class DocumentJarClassLoader extends URLClassLoader {
{
// First, get the permissions which may be granted
// through the policy file(s)
- Policy p = Policy.getPolicy();
+ Policy p = Policy.getPolicy();
- PermissionCollection pc = null;
- if (p != null) {
- pc = p.getPermissions(codesource);
- }
+ PermissionCollection pc = null;
+ if (p != null) {
+ pc = p.getPermissions(codesource);
+ }
// Now, add permissions if the documentCodeSource is not null
if (documentCodeSource != null){
@@ -99,6 +100,6 @@ public class DocumentJarClassLoader extends URLClassLoader {
}
}
- return pc;
+ return pc;
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentLoader.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentLoader.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentLoader.java
index 06770fb..b32f47f 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentLoader.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DocumentLoader.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-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
@@ -28,14 +29,14 @@ import org.apache.flex.forks.batik.util.CleanerThread;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.flex.forks.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGDocument;
/**
* This class is responsible on loading an SVG document and
* maintaining a cache.
*
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: DocumentLoader.java,v 1.23 2005/01/03 10:48:05 deweese Exp $
+ * @version $Id: DocumentLoader.java 475685 2006-11-16 11:16:05Z cam $
*/
public class DocumentLoader {
@@ -71,7 +72,7 @@ public class DocumentLoader {
this.userAgent = userAgent;
documentFactory = new SAXSVGDocumentFactory
(userAgent.getXMLParserClassName(), true);
- documentFactory.setValidating(userAgent.isXMLParserValidating());
+ documentFactory.setValidating(userAgent.isXMLParserValidating());
}
public Document checkCache(String uri) {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DynamicGVTBuilder.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DynamicGVTBuilder.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DynamicGVTBuilder.java
index f5e857d..3b4b69e 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DynamicGVTBuilder.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/DynamicGVTBuilder.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
@@ -21,7 +22,7 @@ package org.apache.flex.forks.batik.bridge;
* This class is responsible for creating a GVT tree using an SVG DOM tree.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: DynamicGVTBuilder.java,v 1.4 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: DynamicGVTBuilder.java 475477 2006-11-15 22:44:28Z cam $
*/
public class DynamicGVTBuilder extends GVTBuilder {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededExternalResourceSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededExternalResourceSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededExternalResourceSecurity.java
index f53786d..bc4eb75 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededExternalResourceSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededExternalResourceSecurity.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
@@ -25,7 +26,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* embeded with the data protocol.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: EmbededExternalResourceSecurity.java,v 1.4 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: EmbededExternalResourceSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class EmbededExternalResourceSecurity implements ExternalResourceSecurity {
public static final String DATA_PROTOCOL = "data";
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededScriptSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededScriptSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededScriptSecurity.java
index 6df8c80..42af0c1 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededScriptSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/EmbededScriptSecurity.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
@@ -26,7 +27,7 @@ import org.apache.flex.forks.batik.util.ParsedURL;
* embeded with the data protocol.
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: EmbededScriptSecurity.java,v 1.4 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: EmbededScriptSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public class EmbededScriptSecurity implements ScriptSecurity {
public static final String DATA_PROTOCOL = "data";
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ErrorConstants.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ErrorConstants.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ErrorConstants.java
index 520d9bf..16cf2c7 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ErrorConstants.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ErrorConstants.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
@@ -21,7 +22,7 @@ package org.apache.flex.forks.batik.bridge;
* The error code.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: ErrorConstants.java,v 1.8 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: ErrorConstants.java 478160 2006-11-22 13:35:06Z dvholten $
*/
public interface ErrorConstants {
@@ -31,7 +32,7 @@ public interface ErrorConstants {
* {0} = the name of the attribute
* </pre>
*/
- public static final String ERR_ATTRIBUTE_MISSING
+ String ERR_ATTRIBUTE_MISSING
= "attribute.missing";
/**
@@ -41,7 +42,7 @@ public interface ErrorConstants {
* {1} = the wrong value
* </pre>
*/
- public static final String ERR_ATTRIBUTE_VALUE_MALFORMED
+ String ERR_ATTRIBUTE_VALUE_MALFORMED
= "attribute.malformed";
/**
@@ -50,7 +51,7 @@ public interface ErrorConstants {
* {0} = the name of the attribute
* </pre>
*/
- public static final String ERR_LENGTH_NEGATIVE
+ String ERR_LENGTH_NEGATIVE
= "length.negative";
/**
@@ -59,7 +60,7 @@ public interface ErrorConstants {
* {0} = property
* </pre>
*/
- public static final String ERR_CSS_LENGTH_NEGATIVE
+ String ERR_CSS_LENGTH_NEGATIVE
= "css.length.negative";
/**
@@ -69,7 +70,7 @@ public interface ErrorConstants {
* {0} = the uri
* </pre>
*/
- public static final String ERR_CSS_URI_BAD_TARGET
+ String ERR_CSS_URI_BAD_TARGET
= "css.uri.badTarget";
/**
@@ -78,7 +79,7 @@ public interface ErrorConstants {
* {0} = the uri
* </pre>
*/
- public static final String ERR_URI_BAD_TARGET
+ String ERR_URI_BAD_TARGET
= "uri.badTarget";
/**
@@ -88,14 +89,14 @@ public interface ErrorConstants {
* {0} = the uri
* </pre>
*/
- public static final String ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES
+ String ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES
= "xlink.href.circularDependencies";
/**
* The error code when the bridge try to load a URI
* {0} = the uri
*/
- public static final String ERR_URI_MALFORMED
+ String ERR_URI_MALFORMED
= "uri.malformed";
/**
@@ -105,7 +106,7 @@ public interface ErrorConstants {
* {0} = the uri
* </pre>
*/
- public static final String ERR_URI_IO
+ String ERR_URI_IO
= "uri.io";
/**
@@ -113,7 +114,7 @@ public interface ErrorConstants {
* while loading a URI
* {0} = the uri
*/
- public static final String ERR_URI_UNSECURE
+ String ERR_URI_UNSECURE
= "uri.unsecure";
/**
@@ -123,7 +124,7 @@ public interface ErrorConstants {
* {0} = the uri
* </pre>
*/
- public static final String ERR_URI_REFERENCE_A_DOCUMENT
+ String ERR_URI_REFERENCE_A_DOCUMENT
= "uri.referenceDocument";
/**
@@ -133,12 +134,25 @@ public interface ErrorConstants {
* {0} = the uri
* </pre>
*/
- public static final String ERR_URI_IMAGE_INVALID
- = "uri.image.invalid";
+ String ERR_URI_IMAGE_INVALID = "uri.image.invalid";
+
+ /**
+ * The error code when the bridge tries to read an image and the image
+ * url can't be opened or the contents aren't usable.
+ * <pre>
+ * {0} = the uri
+ * {1} = the reason it can't be opened.
+ * </pre>
+ */
+ String ERR_URI_IMAGE_BROKEN = "uri.image.broken";
/**
- * The resource that contains the title for the Broken Link message
+ * The error code when the bridge tries to read an image and the image
+ * url can't be opened:
+ * <pre>
+ * {0} = the reason it can't be opened.
+ * </pre>
*/
- public static final String MSG_BROKEN_LINK_TITLE
- = "broken.link.title";
+ String URI_IMAGE_ERROR = "uri.image.error";
+
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ExternalResourceSecurity.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ExternalResourceSecurity.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ExternalResourceSecurity.java
index 8dbb7a6..4097cfc 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ExternalResourceSecurity.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ExternalResourceSecurity.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
@@ -23,7 +24,7 @@ package org.apache.flex.forks.batik.bridge;
*
*
* @author <a href="mailto:vhardy@apache.org">Vincent Hardy</a>
- * @version $Id: ExternalResourceSecurity.java,v 1.4 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: ExternalResourceSecurity.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface ExternalResourceSecurity {
/**
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterBridge.java
index 701f1ee..333ac1f 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-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;
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: FilterBridge.java,v 1.10 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: FilterBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface FilterBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterPrimitiveBridge.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterPrimitiveBridge.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterPrimitiveBridge.java
index 1facf26..911ad7b 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterPrimitiveBridge.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FilterPrimitiveBridge.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-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
@@ -29,7 +30,7 @@ import org.w3c.dom.Element;
* a filter primitive.
*
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: FilterPrimitiveBridge.java,v 1.8 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: FilterPrimitiveBridge.java 475477 2006-11-15 22:44:28Z cam $
*/
public interface FilterPrimitiveBridge extends Bridge {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FocusManager.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FocusManager.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FocusManager.java
index 3893388..6a185ec 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FocusManager.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FocusManager.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
@@ -17,6 +18,10 @@
*/
package org.apache.flex.forks.batik.bridge;
+import org.apache.flex.forks.batik.dom.events.DOMUIEvent;
+import org.apache.flex.forks.batik.dom.events.NodeEventTarget;
+import org.apache.flex.forks.batik.util.XMLConstants;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.events.DocumentEvent;
@@ -24,13 +29,12 @@ import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.MouseEvent;
-import org.w3c.dom.events.UIEvent;
/**
* A class that manages focus on elements.
*
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: FocusManager.java,v 1.7 2004/08/18 07:12:31 vhardy Exp $
+ * @version $Id: FocusManager.java 475477 2006-11-15 22:44:28Z cam $
*/
public class FocusManager {
@@ -76,22 +80,67 @@ public class FocusManager {
*/
public FocusManager(Document doc) {
document = doc;
- EventTarget target = (EventTarget)doc;
-
- mouseclickListener = new MouseClickTacker();
- target.addEventListener("click", mouseclickListener, true);
-
- mouseoverListener = new MouseOverTacker();
- target.addEventListener("mouseover", mouseoverListener, true);
+ addEventListeners(doc);
+ }
- mouseoutListener = new MouseOutTacker();
- target.addEventListener("mouseout", mouseoutListener, true);
+ /**
+ * Adds the event listeners to the document.
+ */
+ protected void addEventListeners(Document doc) {
+ NodeEventTarget target = (NodeEventTarget) doc;
+
+ mouseclickListener = new MouseClickTracker();
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "click",
+ mouseclickListener, true, null);
+
+ mouseoverListener = new MouseOverTracker();
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "mouseover",
+ mouseoverListener, true, null);
+
+ mouseoutListener = new MouseOutTracker();
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "mouseout",
+ mouseoutListener, true, null);
domFocusInListener = new DOMFocusInTracker();
- target.addEventListener("DOMFocusIn", domFocusInListener, true);
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "DOMFocusIn",
+ domFocusInListener, true, null);
domFocusOutListener = new DOMFocusOutTracker();
- target.addEventListener("DOMFocusOut", domFocusOutListener, true);
+ target.addEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "DOMFocusOut",
+ domFocusOutListener, true, null);
+ }
+
+ /**
+ * Removes the event listeners from the document.
+ */
+ protected void removeEventListeners(Document doc) {
+ NodeEventTarget target = (NodeEventTarget) doc;
+
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, "click",
+ mouseclickListener, true);
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseover",
+ mouseoverListener, true);
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseout",
+ mouseoutListener, true);
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusIn",
+ domFocusInListener, true);
+ target.removeEventListenerNS
+ (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusOut",
+ domFocusOutListener, true);
}
/**
@@ -106,12 +155,7 @@ public class FocusManager {
*/
public void dispose() {
if (document == null) return;
- EventTarget target = (EventTarget)document;
- target.removeEventListener("click", mouseclickListener, true);
- target.removeEventListener("mouseover", mouseoverListener, true);
- target.removeEventListener("mouseout", mouseoutListener, true);
- target.removeEventListener("DOMFocusIn", domFocusInListener, true);
- target.removeEventListener("DOMFocusOut", domFocusOutListener, true);
+ removeEventListeners(document);
lastFocusEventTarget = null;
document = null;
}
@@ -119,7 +163,7 @@ public class FocusManager {
/**
* The class that is responsible for tracking 'mouseclick' changes.
*/
- protected class MouseClickTacker implements EventListener {
+ protected class MouseClickTracker implements EventListener {
public void handleEvent(Event evt) {
MouseEvent mevt = (MouseEvent)evt;
@@ -133,9 +177,10 @@ public class FocusManager {
protected class DOMFocusInTracker implements EventListener {
public void handleEvent(Event evt) {
+ EventTarget newTarget = evt.getTarget();
if (lastFocusEventTarget != null &&
- lastFocusEventTarget != evt.getTarget()) {
- fireDOMFocusOutEvent(lastFocusEventTarget);
+ lastFocusEventTarget != newTarget) {
+ fireDOMFocusOutEvent(lastFocusEventTarget, newTarget);
}
lastFocusEventTarget = evt.getTarget();
}
@@ -146,6 +191,9 @@ public class FocusManager {
*/
protected class DOMFocusOutTracker implements EventListener {
+ public DOMFocusOutTracker() {
+ }
+
public void handleEvent(Event evt) {
lastFocusEventTarget = null;
}
@@ -155,11 +203,13 @@ public class FocusManager {
* The class that is responsible to update the focus according to
* 'mouseover' event.
*/
- protected class MouseOverTacker implements EventListener {
+ protected class MouseOverTracker implements EventListener {
public void handleEvent(Event evt) {
+ MouseEvent me = (MouseEvent) evt;
EventTarget target = evt.getTarget();
- fireDOMFocusInEvent(target);
+ EventTarget relatedTarget = me.getRelatedTarget();
+ fireDOMFocusInEvent(target, relatedTarget);
}
}
@@ -167,37 +217,53 @@ public class FocusManager {
* The class that is responsible to update the focus according to
* 'mouseout' event.
*/
- protected class MouseOutTacker implements EventListener {
+ protected class MouseOutTracker implements EventListener {
public void handleEvent(Event evt) {
+ MouseEvent me = (MouseEvent) evt;
EventTarget target = evt.getTarget();
- fireDOMFocusOutEvent(target);
+ EventTarget relatedTarget = me.getRelatedTarget();
+ fireDOMFocusOutEvent(target, relatedTarget);
}
}
/**
* Fires a 'DOMFocusIn' event to the specified target.
*
- * @param target the event target
+ * @param target the newly focussed event target
+ * @param relatedTarget the previously focussed event target
*/
- protected void fireDOMFocusInEvent(EventTarget target) {
+ protected void fireDOMFocusInEvent(EventTarget target,
+ EventTarget relatedTarget) {
DocumentEvent docEvt =
(DocumentEvent)((Element)target).getOwnerDocument();
- UIEvent uiEvt = (UIEvent)docEvt.createEvent("UIEvents");
- uiEvt.initUIEvent("DOMFocusIn", true, false, null, 0);
+ DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
+ uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "DOMFocusIn",
+ true, // canBubbleArg
+ false, // cancelableArg
+ null, // viewArg
+ 0); // detailArg
target.dispatchEvent(uiEvt);
}
/**
* Fires a 'DOMFocusOut' event to the specified target.
*
- * @param target the event target
+ * @param target the previously focussed event target
+ * @param relatedTarget the newly focussed event target
*/
- protected void fireDOMFocusOutEvent(EventTarget target) {
+ protected void fireDOMFocusOutEvent(EventTarget target,
+ EventTarget relatedTarget) {
DocumentEvent docEvt =
(DocumentEvent)((Element)target).getOwnerDocument();
- UIEvent uiEvt = (UIEvent)docEvt.createEvent("UIEvents");
- uiEvt.initUIEvent("DOMFocusOut", true, false, null, 0);
+ DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
+ uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "DOMFocusOut",
+ true, // canBubbleArg
+ false, // cancelableArg
+ null, // viewArg
+ 0); // detailArg
target.dispatchEvent(uiEvt);
}
@@ -210,8 +276,13 @@ public class FocusManager {
protected void fireDOMActivateEvent(EventTarget target, int detailArg) {
DocumentEvent docEvt =
(DocumentEvent)((Element)target).getOwnerDocument();
- UIEvent uiEvt = (UIEvent)docEvt.createEvent("UIEvents");
- uiEvt.initUIEvent("DOMActivate", true, true, null, detailArg);
+ DOMUIEvent uiEvt = (DOMUIEvent)docEvt.createEvent("UIEvents");
+ uiEvt.initUIEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
+ "DOMActivate",
+ true, // canBubbleArg
+ true, // cancelableArg
+ null, // viewArg
+ 0); // detailArg
target.dispatchEvent(uiEvt);
}
}
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FontFace.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FontFace.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FontFace.java
index 5ca2c5b..99d9aee 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FontFace.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/FontFace.java
@@ -1,10 +1,11 @@
/*
- Copyright 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
@@ -18,30 +19,27 @@
package org.apache.flex.forks.batik.bridge;
import java.awt.Font;
-import java.awt.GraphicsEnvironment;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
+import org.apache.flex.forks.batik.dom.AbstractNode;
+import org.apache.flex.forks.batik.gvt.font.AWTFontFamily;
+import org.apache.flex.forks.batik.gvt.font.FontFamilyResolver;
+import org.apache.flex.forks.batik.gvt.font.GVTFontFace;
+import org.apache.flex.forks.batik.gvt.font.GVTFontFamily;
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.Node;
-import org.w3c.flex.forks.dom.svg.SVGDocument;
-
-import org.apache.flex.forks.batik.dom.svg.XMLBaseSupport;
-import org.apache.flex.forks.batik.gvt.font.GVTFontFamily;
-import org.apache.flex.forks.batik.gvt.font.GVTFontFace;
-import org.apache.flex.forks.batik.gvt.font.AWTFontFamily;
-import org.apache.flex.forks.batik.gvt.font.FontFamilyResolver;
+import org.w3c.dom.svg.SVGDocument;
/**
* This class represents a <font-face> element or @font-face rule
*
* @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
- * @version $Id: FontFace.java,v 1.9 2005/02/22 09:12:57 cam Exp $
+ * @version $Id: FontFace.java 588550 2007-10-26 07:52:41Z dvholten $
*/
public abstract class FontFace extends GVTFontFace
implements ErrorConstants {
@@ -82,7 +80,7 @@ public abstract class FontFace extends GVTFontFace
public static CSSFontFace createFontFace(String familyName,
FontFace src) {
return new CSSFontFace
- (new LinkedList(src.srcs),
+ (new LinkedList(src.srcs),
familyName, src.unitsPerEm, src.fontWeight,
src.fontStyle, src.fontVariant, src.fontStretch,
src.slope, src.panose1, src.ascent, src.descent,
@@ -90,7 +88,7 @@ public abstract class FontFace extends GVTFontFace
src.underlinePosition, src.underlineThickness,
src.overlinePosition, src.overlineThickness);
}
-
+
/**
* Returns the font associated with this rule or element.
*/
@@ -101,7 +99,7 @@ public abstract class FontFace extends GVTFontFace
return new AWTFontFamily(ff);
}
- Iterator iter = srcs.iterator();
+ Iterator iter = srcs.iterator();
while (iter.hasNext()) {
Object o = iter.next();
if (o instanceof String) {
@@ -120,14 +118,14 @@ public abstract class FontFace extends GVTFontFace
// Security violation notify the user but keep going.
ctx.getUserAgent().displayError(ex);
} catch (BridgeException ex) {
- // If Security violation notify
+ // If Security violation notify
// the user but keep going.
- if (ERR_URI_UNSECURE.equals(ex.getCode()))
+ if (ERR_URI_UNSECURE.equals(ex.getCode()))
ctx.getUserAgent().displayError(ex);
} catch (Exception ex) {
// Do nothing couldn't get Referenced URL.
}
- }
+ }
}
return new AWTFontFamily(this);
@@ -148,7 +146,7 @@ public abstract class FontFace extends GVTFontFace
pDocURL = new ParsedURL(docURL);
// try to load an SVG document
- String baseURI = XMLBaseSupport.getCascadedXMLBase(e);
+ String baseURI = AbstractNode.getBaseURI(e);
purl = new ParsedURL(baseURI, purlStr);
UserAgent userAgent = ctx.getUserAgent();
@@ -161,7 +159,7 @@ public abstract class FontFace extends GVTFontFace
// I'll vote yes just because it is a security exception (other
// exceptions like font not available etc I would skip).
userAgent.displayError(ex);
- return null;
+ return null;
}
if (purl.getRef() != null) {
@@ -178,14 +176,14 @@ public abstract class FontFace extends GVTFontFace
Element fontElt = ref;
if (doc != rdoc) {
fontElt = (Element)doc.importNode(ref, true);
- String base = XMLBaseSupport.getCascadedXMLBase(ref);
+ String base = AbstractNode.getBaseURI(ref);
Element g = doc.createElementNS(SVG_NAMESPACE_URI, SVG_G_TAG);
g.appendChild(fontElt);
- g.setAttributeNS(XMLBaseSupport.XML_NAMESPACE_URI,
+ g.setAttributeNS(XMLConstants.XML_NAMESPACE_URI,
"xml:base", base);
CSSUtilities.computeStyleAndURIs(ref, fontElt, purlStr);
}
-
+
// Search for a font-face element
Element fontFaceElt = null;
for (Node n = fontElt.getFirstChild();
@@ -198,12 +196,13 @@ public abstract class FontFace extends GVTFontFace
break;
}
}
+ // todo : if the above loop fails to find a fontFaceElt, a null is passed to createFontFace()
SVGFontFaceElementBridge fontFaceBridge;
fontFaceBridge = (SVGFontFaceElementBridge)ctx.getBridge
(SVG_NAMESPACE_URI, SVG_FONT_FACE_TAG);
GVTFontFace gff = fontFaceBridge.createFontFace(ctx, fontFaceElt);
-
+
return new SVGFontFamily(gff, fontElt, ctx);
}
@@ -219,7 +218,7 @@ public abstract class FontFace extends GVTFontFace
}
/**
- * Default implementation uses the root element of the document
+ * Default implementation uses the root element of the document
* associated with BridgeContext. This is useful for CSS case.
*/
protected Element getBaseElement(BridgeContext ctx) {
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f690ea2f/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GVTBuilder.java
----------------------------------------------------------------------
diff --git a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GVTBuilder.java b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GVTBuilder.java
index 9345e35..08ef5e5 100644
--- a/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GVTBuilder.java
+++ b/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/GVTBuilder.java
@@ -1,10 +1,11 @@
/*
- Copyright 2000-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
@@ -31,7 +32,7 @@ import org.w3c.dom.Node;
* This class is responsible for creating a GVT tree using an SVG DOM tree.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: GVTBuilder.java,v 1.30 2005/03/27 08:58:30 cam Exp $
+ * @version $Id: GVTBuilder.java 599681 2007-11-30 02:55:48Z cam $
*/
public class GVTBuilder implements SVGConstants {
@@ -57,10 +58,14 @@ public class GVTBuilder implements SVGConstants {
ctx.setGVTBuilder(this);
// build the GVT tree
- RootGraphicsNode rootNode = new RootGraphicsNode();
- Element svgElement = document.getDocumentElement();
- GraphicsNode topNode = null;
+ DocumentBridge dBridge = ctx.getDocumentBridge();
+ RootGraphicsNode rootNode = null;
try {
+ // create the root node
+ rootNode = dBridge.createGraphicsNode(ctx, document);
+ Element svgElement = document.getDocumentElement();
+ GraphicsNode topNode = null;
+
// get the appropriate bridge according to the specified element
Bridge bridge = ctx.getBridge(svgElement);
if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
@@ -76,11 +81,12 @@ public class GVTBuilder implements SVGConstants {
buildComposite(ctx, svgElement, (CompositeGraphicsNode)topNode);
gnBridge.buildGraphicsNode(ctx, svgElement, topNode);
+
+ // finally, build the root node
+ dBridge.buildGraphicsNode(ctx, document, rootNode);
} catch (BridgeException ex) {
// update the exception with the missing parameters
ex.setGraphicsNode(rootNode);
- Element errElement = ex.getElement();
- ex.setLineNumber(ctx.getDocumentLoader().getLineNumber(errElement));
//ex.printStackTrace();
throw ex; // re-throw the udpated exception
}
@@ -90,7 +96,7 @@ public class GVTBuilder implements SVGConstants {
ctx.addUIEventListeners(document);
// register GVT listeners for AWT event support
- BridgeEventSupport.addGVTListener(ctx, document);
+ ctx.addGVTListener(document);
}
// <!> FIXME: TO BE REMOVED
@@ -113,16 +119,20 @@ public class GVTBuilder implements SVGConstants {
// get the appropriate bridge according to the specified element
Bridge bridge = ctx.getBridge(e);
if (bridge instanceof GenericBridge) {
- // If it is a GenericBridge just handle it and return.
+ // If it is a GenericBridge just handle it and any GenericBridge
+ // descendents and return.
((GenericBridge) bridge).handleElement(ctx, e);
+ handleGenericBridges(ctx, e);
return null;
} else if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
+ handleGenericBridges(ctx, e);
return null;
}
// create the associated graphics node
GraphicsNodeBridge gnBridge = (GraphicsNodeBridge)bridge;
// check the display property
if (!gnBridge.getDisplay(e)) {
+ handleGenericBridges(ctx, e);
return null;
}
GraphicsNode gn = gnBridge.createGraphicsNode(ctx, e);
@@ -183,14 +193,18 @@ public class GVTBuilder implements SVGConstants {
// get the appropriate bridge according to the specified element
Bridge bridge = ctx.getBridge(e);
if (bridge instanceof GenericBridge) {
- // If it is a GenericBridge just handle it and return.
+ // If it is a GenericBridge just handle it and any GenericBridge
+ // descendents and return.
((GenericBridge) bridge).handleElement(ctx, e);
+ handleGenericBridges(ctx, e);
return;
} else if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
+ handleGenericBridges(ctx, e);
return;
}
// check the display property
if (!CSSUtilities.convertDisplay(e)) {
+ handleGenericBridges(ctx, e);
return;
}
GraphicsNodeBridge gnBridge = (GraphicsNodeBridge)bridge;
@@ -208,6 +222,8 @@ public class GVTBuilder implements SVGConstants {
handleGenericBridges(ctx, e);
}
gnBridge.buildGraphicsNode(ctx, e, gn);
+ } else {
+ handleGenericBridges(ctx, e);
}
} catch (BridgeException ex) {
// some bridge may decide that the node in error can be
@@ -238,6 +254,7 @@ public class GVTBuilder implements SVGConstants {
if (b instanceof GenericBridge) {
((GenericBridge) b).handleElement(ctx, e2);
}
+ handleGenericBridges(ctx, e2);
}
}
}