Package org.jfree.resourceloader

Examples of org.jfree.resourceloader.Resource


      }
      else if ("url".equals(type))
      {
        final CSSResourceValue cssResourceValue =
                FunctionUtilities.loadResource(layoutProcess, strVal);
        final Resource resource = cssResourceValue.getValue();
        return new ResourceContentToken(resource);
      }
      else if ("color".equals(type))
      {
        CSSValue colorValue = ColorUtil.parseColor(strVal);
        if (colorValue == null)
        {
          throw new FunctionEvaluationException();
        }
        return new StaticTextToken (colorValue.getCSSText());
      }
      else
      {
        // auto-mode. We check for URLs, as this is required for images
        final CSSValue cssValue =
                FunctionUtilities.parseValue(layoutProcess, strVal);
        if (cssValue instanceof CSSResourceValue)
        {
          final CSSResourceValue cssResourceValue =
                  (CSSResourceValue) cssValue;
          final Resource resource = cssResourceValue.getValue();
          return new ResourceContentToken(resource);
        }
        else if (cssValue instanceof CSSStringValue)
        {
          final CSSStringValue sval = (CSSStringValue) cssValue;
          return new StaticTextToken (sval.getValue());
        }
        else
        {
          return new StaticTextToken (cssValue.getCSSText());
        }
      }
    }
    else if (value instanceof URL)
    {
      final CSSResourceValue cssResourceValue =
              FunctionUtilities.loadResource(layoutProcess, value);
      final Resource resource = cssResourceValue.getValue();
      return new ResourceContentToken(resource);
    }
    else if (value instanceof Resource)
    {
      return new ResourceContentToken((Resource) value);
    }
    else if (value instanceof ResourceKey)
    {
      final CSSResourceValue cssResourceValue =
              FunctionUtilities.loadResource(layoutProcess, value);
      final Resource resource = cssResourceValue.getValue();
      return new ResourceContentToken(resource);
    }
    else if (value instanceof Date)
    {
      return new StaticTextToken (String.valueOf(value));
View Full Code Here


      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();
      this.styleSheet.addStyleSheet(styleSheet);
    }
    catch (ResourceException e)
    {
      // ignore ..
View Full Code Here

      {
        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

        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)
        {
          copyStyleInformation(node.getLayoutContext(), rule, node);
        }
      }
View Full Code Here

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

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

      final String key = (String) generateDirs.next();
      final String dataLocation = config.getConfigProperty(key);
      try
      {
        final ResourceKey resKey = manager.createKey(dataLocation);
        final Resource res = manager.create(resKey, null, Properties.class);
        final Properties props = (Properties) res.getResource();
        final Iterator vals = props.entrySet().iterator();
        while (vals.hasNext())
        {
          final Map.Entry entry = (Map.Entry) vals.next();
          final String encName = (String) entry.getKey();
View Full Code Here

    if (generated != null)
    {

      try
      {
        final Resource res = manager.create(generated, null, Encoding.class);
        final Object o = res.getResource();
        if (o instanceof EncodingCore)
        {
          return new ExternalEncoding(name, (EncodingCore) o, res);
        }
      }
View Full Code Here

        final ResourceKey baseResource = root.getBaseResource();
        final ResourceManager resourceManager = root.getResourceManager();

        final byte[] bytes = styleText.getBytes("UTF-8");
        final ResourceKey key = resourceManager.createKey(bytes);
        final Resource resource = resourceManager.create
            (key, baseResource, StyleRule.class);

        final CSSDeclarationRule parsedRule =
            (CSSDeclarationRule) resource.getResource();
        mergeDeclarationRule(targetRule, parsedRule);
      }
      catch (Exception e)
      {
        // ignore ..
View Full Code Here

    try
    {
      final ResourceKey key =
          resourceManager.deriveKey(contextKey, "styles.xml");
      final Resource resource =
          resourceManager.create(key, contextKey, OfficeStylesCollection.class);
      final OfficeStylesCollection styles =
          (OfficeStylesCollection) resource.getResource();
      if (styles != null)
      {
        return styles;
      }
    }
View Full Code Here

    final ResourceManager resourceManager = getRootHandler().getResourceManager();
    try
    {
      final ResourceKey key =
          resourceManager.deriveKey(contextKey, "content.xml");
      final Resource resource =
          resourceManager.create(key, contextKey, JFreeReport.class);
      final OfficeDocument report = (OfficeDocument) resource.getResource();
      if (report != null)
      {
        return report;
      }
    }
View Full Code Here

TOP

Related Classes of org.jfree.resourceloader.Resource

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.