Sfoglia il codice sorgente

extends adapter instead of implementing useragent


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194699 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_20_4-doc
Keiron Liddle 22 anni fa
parent
commit
fa70e1de28

+ 2
- 58
src/org/apache/fop/svg/PDFTranscoder.java Vedi File

@@ -38,6 +38,7 @@ import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.BridgeException;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.bridge.UserAgentAdapter;
import org.apache.batik.bridge.ViewBox;

import org.apache.batik.dom.svg.DefaultSVGContext;
@@ -310,7 +311,7 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
/**
* A user agent implementation for <tt>ImageTranscoder</tt>.
*/
protected class ImageTranscoderUserAgent implements UserAgent {
protected class ImageTranscoderUserAgent extends UserAgentAdapter {

/**
* Returns the default size of this user agent (400x400).
@@ -404,68 +405,11 @@ public class PDFTranscoder extends XMLAbstractTranscoder {
return false;
}

/**
* Unsupported operation.
*/
public EventDispatcher getEventDispatcher() {
return null;
}

/**
* Unsupported operation.
*/
public void openLink(SVGAElement elt) {}

/**
* Unsupported operation.
*/
public void setSVGCursor(Cursor cursor) {}

/**
* Unsupported operation.
*/
public void runThread(Thread t) {}

/**
* Unsupported operation.
*/
public AffineTransform getTransform() {
return null;
}

/**
* Unsupported operation.
*/
public Point getClientAreaLocationOnScreen() {
return new Point();
}

/**
* Tells whether the given feature is supported by this
* user agent.
*/
public boolean hasFeature(String s) {
return FEATURES.contains(s);
}

/**
* Tells whether the given extension is supported by this
* user agent.
*/
public boolean supportExtension(String s) {
return false;
}

public void registerExtension(BridgeExtension be) {}

public void handleElement(Element elt, Object data) {}

}

protected final static Set FEATURES = new HashSet();
static {
FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_FEATURE);
FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_LANG_FEATURE);
FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_STATIC_FEATURE);
}
}

+ 8
- 31
src/org/apache/fop/svg/SVGUserAgent.java Vedi File

@@ -31,7 +31,7 @@ import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Dimension;

public class SVGUserAgent implements UserAgent {
public class SVGUserAgent extends UserAgentAdapter {
AffineTransform currentTransform = null;
Logger log;

@@ -68,6 +68,13 @@ public class SVGUserAgent implements UserAgent {
log.info(message);
}

/**
* Shows an alert dialog box.
*/
public void showAlert(String message) {
log.warn(message);
}

/**
* Returns a customized the pixel to mm factor.
*/
@@ -107,20 +114,6 @@ public class SVGUserAgent implements UserAgent {
return false;
}

/**
* Opens a link in a new component.
* @param doc The current document.
* @param uri The document URI.
*/
public void openLink(SVGAElement elt) {
}

public Point getClientAreaLocationOnScreen() {
return new Point(0, 0);
}

public void setSVGCursor(java.awt.Cursor cursor) {}

public AffineTransform getTransform() {
return currentTransform;
}
@@ -129,21 +122,5 @@ public class SVGUserAgent implements UserAgent {
return new Dimension(100, 100);
}

public EventDispatcher getEventDispatcher() {
return null;
}

public boolean supportExtension(String str) {
return false;
}

public boolean hasFeature(String str) {
return false;
}

public void registerExtension(BridgeExtension be) {}

public void handleElement(Element elt, Object data) {}

}


Loading…
Annulla
Salva