Package org.richfaces.resource

Examples of org.richfaces.resource.ResourceKey


        Map<Class<?>, LibraryFunction> parseConfig = ClientServiceConfigParser.parseConfig("csv.xml");
        assertEquals(2, parseConfig.size());
        assertTrue(parseConfig.containsKey(String.class));
        LibraryFunction libraryFunction = parseConfig.get(String.class);
        assertEquals("stringConverter", libraryFunction.getName());
        ResourceKey resource = Iterables.getOnlyElement(libraryFunction.getResources());
        assertEquals("csv.js", resource.getResourceName());
        assertEquals("org.richfaces", resource.getLibraryName());
    }
View Full Code Here


        final List<String> mappingFiles = PropertiesMappingConfiguration.getMappingFiles();
        for (String mappingFile : mappingFiles) {
            if (classpathResourceExistsForLocation(mappingFile)) {
                for (Entry<String, String> entry : PropertiesUtil.loadProperties(mappingFile).entrySet()) {
                    final ResourceKey resourceKey = ResourceKey.create(entry.getKey());
                    final ResourcePath resourceLocation = new ResourcePath(entry.getValue());
                    result.put(resourceKey, new LocationBasedResourceMapping(resourceLocation));
                }
            } else {
                if (!isDefaultStaticResourceMappingLocation(mappingFile)) {
View Full Code Here

    public Set<ResourceKey> getAggregatedResources(ResourcePath resourcePath) {
        FacesContext context = FacesContext.getCurrentInstance();

        Set<ResourceKey> result = Sets.newHashSet();
        for (Entry<ResourceKey, ResourceMapping> entry : mappings.entrySet()) {
            final ResourceKey resourceKey = entry.getKey();
            final ResourceMapping mapping = entry.getValue();

            if (mapping.getResourcePath(context).equals(resourcePath)) {
                result.add(resourceKey);
            }
View Full Code Here

    public void writePackedResource(String packName, String skinName, Resource resource) throws IOException {

        final String requestPath = resource.getRequestPath();
        String extension = getExtension(requestPath);
        String packFileName = packName + "." + extension;
        ResourceKey resourceKey = new ResourceKey(resource.getResourceName(), resource.getLibraryName());

        if (!"js".equals(extension) && !"css".equals(extension)) {
            writeResource(skinName, resource);
            return;
        }
View Full Code Here

        this.resourceFactory = resourceFactory;
    }

    @Override
    public Resource createResource(String resourceName, String libraryName, String contentType) {
        ResourceKey resourceKey = new ResourceKey(resourceName, libraryName);
        Resource result = resourceFactory.createResource(resourceName, libraryName, contentType);

        if (result != null) {
            FacesContext context = FacesContext.getCurrentInstance();
            Object state = ResourceUtils.saveResourceState(context, result);
View Full Code Here

    private void scanLibrary(String libraryName, String resourceNamePrefix, VirtualFile dir) {
        Collection<VirtualFile> children = dir.getChildren();
        for (VirtualFile child : children) {
          String resourceName = resourceNamePrefix + child.getName();
            if (child.isFile()) {
                resources.add(new ResourceKey(resourceName, libraryName));
            } else if (child.isDirectory()) {
                VirtualFile resource = ResourceUtil.getLatestVersion(child, false);
                if (resource != null) {
                    resources.add(new ResourceKey(resourceName, libraryName));
                } else {
                  scanLibrary(libraryName, resourceName + "/", child);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.richfaces.resource.ResourceKey

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.