/** * Returns the size of a px CSS unit in millimeters. */ public float getPixelUnitToMillimeter() { return userAgent.getPixelUnitToMillimeter(); }
/** * Handles the given exception. */ protected void handleSecurityException(SecurityException se) { if (userAgent != null) { userAgent.displayError(se); } }
/** * Displays a message in the User Agent interface. */ public void displayMessage(String message) { ua.displayMessage(message); } }
/** * Initializes the given document. */ protected void initializeDocument(Document document) { SVGOMDocument doc = (SVGOMDocument)document; CSSEngine eng = doc.getCSSEngine(); if (eng == null) { SVGDOMImplementation impl; impl = (SVGDOMImplementation)doc.getImplementation(); eng = impl.createCSSEngine(doc, this); eng.setCSSEngineUserAgent(new CSSEngineUserAgentWrapper(userAgent)); doc.setCSSEngine(eng); eng.setMedia(userAgent.getMedia()); String uri = userAgent.getUserStyleSheetURI(); if (uri != null) { try { ParsedURL url = new ParsedURL(uri); eng.setUserAgentStyleSheet (eng.parseStyleSheet(url, "all")); } catch (Exception e) { userAgent.displayError(e); } } eng.setAlternateStyleSheet(userAgent.getAlternateStyleSheet()); } }
userAgent.checkLoadExternalResource(purl, pDocURL); } catch (SecurityException ex) { userAgent.displayError(ex); return null;
/** * Constructs a new <code>DocumentLoader</code> with the specified XML parser. * @param userAgent the user agent to use */ public DocumentLoader(UserAgent userAgent) { this.userAgent = userAgent; documentFactory = new SAXSVGDocumentFactory (userAgent.getXMLParserClassName(), true); documentFactory.setValidating(userAgent.isXMLParserValidating()); }
holder.holdCursor(CursorManager.DEFAULT_CURSOR); userAgent.setSVGCursor(CursorManager.ANCHOR_CURSOR); userAgent.displayMessage(href);
public void run() { userAgent.deselectAll(); } });
/** * This method throws a SecurityException if the resource * found at url and referenced from docURL * should not be loaded. * * This is a convenience method to call checkLoadExternalResource * on the ExternalResourceSecurity strategy returned by * getExternalResourceSecurity. * * @param resourceURL url for the script, as defined in * the resource's xlink:href attribute. If that * attribute was empty, then this parameter should * be null * @param docURL url for the document into which the * resource was found. */ public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { userAgent.checkLoadExternalResource(resourceURL, docURL); }
/** * Returns a bolder font-weight. */ public float getBolderFontWeight(float f) { return userAgent.getBolderFontWeight(f); }
/** * Checks that the script URLs and the document url are * compatible. A SecurityException is thrown if loading * the script is not allowed. */ protected void checkCompatibleScriptURL(String scriptType, ParsedURL scriptPURL){ userAgent.checkLoadScript(scriptType, scriptPURL, docPURL); }
/** * Returns the class name of the XML parser. */ public String getXMLParserClassName() { if (EventQueue.isDispatchThread()) { return userAgent.getXMLParserClassName(); } else { class Query implements Runnable { String result; public void run() { result = userAgent.getXMLParserClassName(); } } Query q = new Query(); invokeAndWait(q); return q.result; } }
/** * Returns true if the XML parser must be in validation mode, false * otherwise. */ public boolean isXMLParserValidating() { if (EventQueue.isDispatchThread()) { return userAgent.isXMLParserValidating(); } else { class Query implements Runnable { boolean result; public void run() { result = userAgent.isXMLParserValidating(); } } Query q = new Query(); invokeAndWait(q); return q.result; } }
/** * Returns this user agent's alternate style-sheet title. */ public String getAlternateStyleSheet() { if (EventQueue.isDispatchThread()) { return userAgent.getAlternateStyleSheet(); } else { class Query implements Runnable { String result; public void run() { result = userAgent.getAlternateStyleSheet(); } } Query q = new Query(); invokeAndWait(q); return q.result; } }
/** * Initializes the given document. */ protected void initializeDocument(Document document) { SVGOMDocument doc = (SVGOMDocument)document; CSSEngine eng = doc.getCSSEngine(); if (eng == null) { SVGDOMImplementation impl; impl = (SVGDOMImplementation)doc.getImplementation(); eng = impl.createCSSEngine(doc, this); eng.setCSSEngineUserAgent(new CSSEngineUserAgentWrapper(userAgent)); doc.setCSSEngine(eng); eng.setMedia(userAgent.getMedia()); String uri = userAgent.getUserStyleSheetURI(); if (uri != null) { try { ParsedURL url = new ParsedURL(uri); eng.setUserAgentStyleSheet (eng.parseStyleSheet(url, "all")); } catch (Exception e) { userAgent.displayError(e); } } eng.setAlternateStyleSheet(userAgent.getAlternateStyleSheet()); } }
BridgeException be = new BridgeException(ctx, paintedElement, ERR_URI_MALFORMED, new Object[] {href}); ctx.getUserAgent().displayError(be); return null; //Don't throw. Continue without the profile ctx.getUserAgent().checkLoadExternalResource(purl, pDocURL); p = ICC_Profile.getInstance(purl.openStream()); } catch (IOException ioEx) { BridgeException be = new BridgeException(ctx, paintedElement, ioEx, ERR_URI_IO, new Object[] {href}); ctx.getUserAgent().displayError(be); return null; //Don't throw. Continue without the profile ERR_URI_UNSECURE, new Object[] {href}); ctx.getUserAgent().displayError(be); return null; //Don't throw. Continue without the profile
/** * Constructs a new <code>DocumentLoader</code> with the specified XML parser. * @param userAgent the user agent to use */ public DocumentLoader(UserAgent userAgent) { this.userAgent = userAgent; documentFactory = new SAXSVGDocumentFactory (userAgent.getXMLParserClassName(), true); documentFactory.setValidating(userAgent.isXMLParserValidating()); }
holder.holdCursor(CursorManager.DEFAULT_CURSOR); userAgent.setSVGCursor(CursorManager.ANCHOR_CURSOR); userAgent.displayMessage(href);
public void run() { userAgent.deselectAll(); } });
/** * This method throws a SecurityException if the resource * found at url and referenced from docURL * should not be loaded. * * This is a convenience method to call checkLoadExternalResource * on the ExternalResourceSecurity strategy returned by * getExternalResourceSecurity. * * @param resourceURL url for the script, as defined in * the resource's xlink:href attribute. If that * attribute was empty, then this parameter should * be null * @param docURL url for the document into which the * resource was found. */ public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL) throws SecurityException { userAgent.checkLoadExternalResource(resourceURL, docURL); }