Example usage for com.vaadin.server LegacyCommunicationManager registerDependency

List of usage examples for com.vaadin.server LegacyCommunicationManager registerDependency

Introduction

In this page you can find the example usage for com.vaadin.server LegacyCommunicationManager registerDependency.

Prototype

@Deprecated
public String registerDependency(String resourceUri, Class<?> context) 

Source Link

Document

Resolves a dependency URI, registering the URI with this LegacyCommunicationManager if needed and returns a fully qualified URI.

Usage

From source file:com.haulmont.cuba.web.sys.CubaUidlWriter.java

License:Apache License

@SuppressWarnings("deprecation")
@Override/*from  w  w  w .  j  a  v a  2  s .  c  o  m*/
protected void handleAdditionalDependencies(List<Class<? extends ClientConnector>> newConnectorTypes,
        List<String> scriptDependencies, List<String> styleDependencies) {
    LegacyCommunicationManager manager = VaadinSession.getCurrent().getCommunicationManager();

    for (Class<? extends ClientConnector> connector : newConnectorTypes) {
        WebJarResource webJarResource = connector.getAnnotation(WebJarResource.class);
        if (webJarResource == null)
            continue;

        for (String uri : webJarResource.value()) {
            String resourceUri = processResourceUri(uri);
            String resourcePath = getResourceActualPath(resourceUri);

            resourcePath = resourcePath.replace(META_INF_PREFIX, VAADIN_PREFIX);

            if (resourcePath.endsWith(JAVASCRIPT_EXTENSION)) {
                scriptDependencies.add(manager.registerDependency(resourcePath, connector));
            }

            if (resourcePath.endsWith(CSS_EXTENSION)) {
                styleDependencies.add(manager.registerDependency(resourcePath, connector));
            }
        }
    }
}