Package org.jfree.resourceloader

Examples of org.jfree.resourceloader.ResourceManager


    Log.debug ("---------------------------------------------------------");
    final File defaultStyleURL = new File
            ("/home/src/jfreereport/head/liblayout/resource/pages.css");

    final ResourceManager manager = new ResourceManager();
    manager.registerDefaults();
    final Resource res = manager.createDirectly(defaultStyleURL, StyleSheet.class);
    final StyleSheet s = (StyleSheet) res.getResource();
    Log.debug ("S");
  }
View Full Code Here


  public static void main (final String[] args)
          throws IOException, CSSParserInstantiationException
  {

    final ResourceManager resourceManager= new ResourceManager();
    resourceManager.registerDefaults();

    final Parser parser = CSSParserFactory.getInstance().createCSSParser();
    final StyleSheetHandler handler = new StyleSheetHandler();
    handler.init (resourceManager, null, 0, StyleKeyRegistry.getRegistry(), null);
    parser.setDocumentHandler(handler);
View Full Code Here

        final LayoutProcess layoutProcess = getLayoutProcess();
        final byte[] bytes = styleText.getBytes("UTF-8");
        final ResourceKey baseKey =
                DocumentContextUtility.getBaseResource
                        (layoutProcess.getDocumentContext());
        final ResourceManager manager = layoutProcess.getResourceManager();
        final ResourceKey key = manager.createKey(bytes);
        final Resource resource = manager.create(key, baseKey, StyleRule.class);

        final CSSDeclarationRule rule =
                (CSSDeclarationRule) resource.getResource();
        if (rule != null)
        {
View Full Code Here

                                              final Object value,
                                              final Class[] type)
          throws FunctionEvaluationException
  {
    // ok, this is going to be expensive. Kids, you dont wanna try this at home ...
    final ResourceManager manager = process.getResourceManager();
    final ResourceKey baseKey = DocumentContextUtility.getBaseResource
            (process.getDocumentContext());
    try
    {
      final ResourceKey key;
      if (value instanceof ResourceKey)
      {
        key = (ResourceKey) value;
      }
      else if (baseKey == null)
      {
        key = manager.createKey(value);
      }
      else if (value instanceof String)
      {
        key = manager.deriveKey(baseKey, (String) value);
      }
      else
      {
        throw new FunctionEvaluationException
                ("Failed to create URI: Resource loading failed: Key not derivable");
      }

      final Resource res = manager.create(key, baseKey, type);
      return new CSSResourceValue(res);
    }
    catch (Exception e)
    {
      throw new FunctionEvaluationException
View Full Code Here

  {
    try
    {
      final DocumentContext context = layoutProcess.getDocumentContext();
      final ResourceKey base = DocumentContextUtility.getBaseResource(context);
      final ResourceManager resourceManager =
              layoutProcess.getResourceManager();

      if (base != null)
      {
        try
        {
          return resourceManager.deriveKey(base, uri);
        }
        catch(ResourceKeyCreationException ex)
        {
          // ignore ..
        }
      }
      return resourceManager.createKey(uri);
    }
    catch (Exception e)
    {
      return null;
    }
View Full Code Here

      throw new NullPointerException();
    }

    final StyleSheet parentStyle = getParentStyle();
    final ResourceKey source;
    final ResourceManager resourceManager;
    if (parentStyle == null)
    {
      source = null;
      resourceManager = null;
    }
View Full Code Here

  public ResourceManager getResourceManager()
  {
    if (resourceManager == null)
    {
      resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
    }
    return resourceManager;
  }
View Full Code Here

  protected void loadInitialStyle()
  {
    this.initialStyle = new LayoutStyleImpl();
    try
    {
      final ResourceManager manager = layoutProcess.getResourceManager();
      final Resource resource = manager.createDirectly
              ("res://org/jfree/layouting/initial.css", StyleSheet.class);
      final StyleSheet initialStyleSheet = (StyleSheet) resource.getResource();

      final int rc = initialStyleSheet.getRuleCount();
      for (int i = 0; i < rc; i++)
View Full Code Here

    }
  }

  private CSSPageAreaRule parsePageRule(final PageAreaType areaType, final String atRule)
  {
    final ResourceManager manager = getResourceManager();
    final ResourceKey source = this.source;
    final CSSPageAreaRule areaRule =
        new CSSPageAreaRule(styleSheet, styleRule, areaType);
    final int firstBrace = atRule.indexOf('{');
    final int lastBrace = atRule.indexOf('}');
View Full Code Here

                          final SACMediaList media,
                          final String defaultNamespaceURI)
      throws CSSException
  {
    //  instantiate a new parser and parse the stylesheet.
    final ResourceManager manager = getResourceManager();
    if (manager == null)
    {
      // there is no source set, so we have no resource manager, and thus
      // we do no parsing.
      //
      // This should only be the case if we parse style-values; in that case
      // include-statement are not supported anyway.
      return;
    }
    try
    {
      CSSParserContext.getContext().setDefaultNamespace(defaultNamespaceURI);
      final ResourceKey key;
      if (source == null)
      {
        key = manager.createKey(uri);
      }
      else
      {
        key = manager.deriveKey(source, uri);
      }

      final Resource res = manager.create(key, source, StyleSheet.class);
      if (res == null)
      {
        return;
      }
      final StyleSheet styleSheet = (StyleSheet) res.getResource();
View Full Code Here

TOP

Related Classes of org.jfree.resourceloader.ResourceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.