Package org.jfree.resourceloader

Examples of org.jfree.resourceloader.Resource


      final ResourceKey key = getRootHandler().getSource();
      final ResourceManager manager = getRootHandler().getResourceManager();
      try
      {
        final ResourceKey derivedKey = manager.deriveKey(key, href);
        final Resource resource = manager.create(derivedKey, null,
                StyleSheet.class);
        getRootHandler().getDependencyCollector().add(resource);
        styleSheet = (StyleSheet) resource.getResource();
      }
      catch (ResourceKeyCreationException e)
      {
        throw new ParseException
            ("Unable to derive key for " + key + " and " + href, getLocator());
View Full Code Here


      final ResourceKey baseKey = getRootHandler().getSource();
      final ResourceManager resourceManager = getRootHandler().getResourceManager();
      final ResourceKey rawKey = resourceManager.createKey(bytes);

      final Resource resource = resourceManager.create
              (rawKey, baseKey, StyleSheet.class);
      this.styleSheet = (StyleSheet) resource.getResource();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
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 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

        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

      {
        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

  private StyleSheet parseStyleSheet(final ResourceKey key,
                                     final ResourceKey context)
  {
    try
    {
      final Resource resource = resourceManager.create
          (key, context, StyleSheet.class);
      return (StyleSheet) resource.getResource();
    }
    catch (ResourceException e)
    {
      Log.info("Unable to parse StyleSheet: " + e.getLocalizedMessage());
    }
View Full Code Here

  {
    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++)
      {
        final StyleRule rule = initialStyleSheet.getRule(i);
View Full Code Here

      }
      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))
      {
        final 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

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.