public PdfReader getReader(URI uri) throws IOException { PdfReader result = (PdfReader) _readerCache.get(uri.getPath()); if (result == null) { result = new PdfReader(getSharedContext().getUserAgentCallback().getBinaryResource(uri.toString())); _readerCache.put(uri.getPath(), result); } return result; }
/** * Get the SWT image. Reload it from the UAC if it was disposed. * * @return */ public Image getImage() { if (_image != null && _image.isDisposed()) { SWTFSImage fsimg = (SWTFSImage) _uac.getImageResource(_uri) .getImage(); if (fsimg == null) { _image = null; } else { _image = fsimg._image; } } return _image; }
protected Document loadDocument(final String uri) { XMLResource xmlResource = _sharedContext.getUac().getXMLResource(uri); if (xmlResource == null) { return null; } return xmlResource.getDocument(); }
final Map< URI, CSSResource > cssResources ) { return new UserAgentCallback() { @Override public CSSResource getCSSResource( final String uriAsString ) { final CSSResource cssResource = cssResources.get( uri ) ; if( cssResource == null ) { return defaultAgentCallback.getCSSResource( uriAsString ) ; } else { return cssResource ; return uriAsString ; } else { return defaultAgentCallback.resolveURI( uriAsString ) ;
uri = _uac.resolveURI(refs[i].getUri()); refs[i].setUri(uri); } else { refs[i].setUri(_uac.getBaseURL() + "#inline_style_" + (++inlineStyleCount)); Stylesheet sheet = _stylesheetFactory.parse( new StringReader(refs[i].getContent()), refs[i]);
/** * Sets the new current document, where the new document is located * relative, e.g using a relative URL. * * @param filename * The new document to load */ protected void setDocumentRelative(String filename) { String url = _sharedContext.getUac().resolveURI(filename); if (isAnchorInCurrentDocument(filename)) { String id = getAnchorId(filename); Box box = _sharedContext.getBoxById(id); if (box != null) { Point pt; if (box.getStyle().isInline()) { pt = new Point(0 /* box.getAbsX() */, box.getAbsY()); } else { RectPropertySet margin = box.getMargin(_layout_context); pt = new Point(0 /* box.getAbsX() + (int) margin.left() */, box.getAbsY() + (int) margin.top()); } setOrigin(pt); return; } } Document dom = loadDocument(url); setDocument(dom, url); }
/** * Gets the baseURL attribute of the RenderingContext object * * @return The baseURL value */ public String getBaseURL() { return uac.getBaseURL(); }
/** * @return Returns null if uri could not be loaded */ private Stylesheet parse(StylesheetInfo info) { CSSResource cr = _userAgentCallback.getCSSResource(info.getUri()); // Whether by accident or design, InputStream will never be null // since the null resource stream is wrapped in a BufferedInputStream InputStream is = cr.getResourceInputSource().getByteStream(); try { return parse(new InputStreamReader(is, "UTF-8"), info); } catch (UnsupportedEncodingException e) { // Shouldn't happen throw new RuntimeException(e.getMessage(), e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { // ignore } } } }
/** * Gets the visited attribute of the StandardAttributeResolver object * * @param e PARAM * @return The visited value */ public boolean isVisited(Object e) { return isLink(e) && uac.isVisited(nsh.getLinkUri((Element) e)); }
/** * Sets the baseURL attribute of the RenderingContext object * * @param url The new baseURL value */ public void setBaseURL(String url) { uac.setBaseURL(url); }
uri = _uac.resolveURI(refs[i].getUri()); refs[i].setUri(uri); } else { refs[i].setUri(_uac.getBaseURL() + "#inline_style_" + (++inlineStyleCount)); Stylesheet sheet = _stylesheetFactory.parse( new StringReader(refs[i].getContent()), refs[i]);
/** * Sets the new current document, where the new document * is located relative, e.g using a relative URL. * * @param filename The new document to load */ protected void setDocumentRelative(String filename) { String url = getSharedContext().getUac().resolveURI(filename); if (isAnchorInCurrentDocument(filename)) { String id = getAnchorId(filename); Box box = getSharedContext().getBoxById(id); if (box != null) { Point pt; if (box.getStyle().isInline()) { pt = new Point(box.getAbsX(), box.getAbsY()); } else { RectPropertySet margin = box.getMargin(getLayoutContext()); pt = new Point( box.getAbsX() + (int)margin.left(), box.getAbsY() + (int)margin.top()); } scrollTo(pt); return; } } Document dom = loadDocument(url); setDocument(dom, url); }
/** * Gets the baseURL attribute of the RenderingContext object * * @return The baseURL value */ public String getBaseURL() { return uac.getBaseURL(); }
/** * @return Returns null if uri could not be loaded */ private Stylesheet parse(StylesheetInfo info) { CSSResource cr = _userAgentCallback.getCSSResource(info.getUri()); // Whether by accident or design, InputStream will never be null // since the null resource stream is wrapped in a BufferedInputStream InputStream is = cr.getResourceInputSource().getByteStream(); try { return parse(new InputStreamReader(is, "UTF-8"), info); } catch (UnsupportedEncodingException e) { // Shouldn't happen throw new RuntimeException(e.getMessage(), e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { // ignore } } } }
/** * Gets the visited attribute of the StandardAttributeResolver object * * @param e PARAM * @return The visited value */ public boolean isVisited(Object e) { return isLink(e) && uac.isVisited(nsh.getLinkUri((Element) e)); }
/** * Sets the baseURL attribute of the RenderingContext object * * @param url The new baseURL value */ public void setBaseURL(String url) { uac.setBaseURL(url); }
private FSImage getBackgroundImage(RenderingContext c, CalculatedStyle style) { if (! style.isIdent(CSSName.BACKGROUND_IMAGE, IdentValue.NONE)) { String uri = style.getStringProperty(CSSName.BACKGROUND_IMAGE); try { return c.getUac().getImageResource(uri).getImage(); } catch (Exception ex) { ex.printStackTrace(); Uu.p(ex); } } return null; }
protected Document loadDocument(final String uri) { XMLResource xmlResource = sharedContext.getUac().getXMLResource(uri); return xmlResource.getDocument(); }
public PdfReader getReader(URI uri) throws IOException { PdfReader result = (PdfReader) _readerCache.get(uri); if (result == null) { result = new PdfReader(getSharedContext().getUserAgentCallback().getBinaryResource(uri.toString())); _readerCache.put(uri, result); } return result; }
String ruri = uac.resolveURI(imageSrc); re = lookupImageReplacedElement(elem, ruri, cssWidth, cssHeight); if (re == null) {