Search in sources :

Example 6 with LoadMode

use of com.vaadin.flow.shared.ui.LoadMode in project flow by vaadin.

the class MessageHandler method handleDependencies.

private void handleDependencies(JsonObject inputJson) {
    Console.log("Handling dependencies");
    JsMap<LoadMode, JsonArray> dependencies = JsCollections.map();
    for (LoadMode loadMode : LoadMode.values()) {
        if (inputJson.hasKey(loadMode.name())) {
            dependencies.set(loadMode, inputJson.getArray(loadMode.name()));
        }
    }
    if (!dependencies.isEmpty()) {
        registry.getDependencyLoader().loadDependencies(dependencies);
    }
}
Also used : JsonArray(elemental.json.JsonArray) LoadMode(com.vaadin.flow.shared.ui.LoadMode)

Example 7 with LoadMode

use of com.vaadin.flow.shared.ui.LoadMode in project flow by vaadin.

the class DependencyList method handleDuplicateDependency.

private void handleDuplicateDependency(Dependency newDependency, Dependency currentDependency) {
    if (newDependency.getLoadMode() != currentDependency.getLoadMode()) {
        final LoadMode moreEagerLoadMode = LoadMode.values()[Math.min(newDependency.getLoadMode().ordinal(), currentDependency.getLoadMode().ordinal())];
        getLogger().warn("Dependency with url {} was imported with two different loading strategies: {} and {}. The dependency will be loaded as {}.", newDependency.getUrl(), newDependency.getLoadMode(), currentDependency.getLoadMode(), moreEagerLoadMode);
        urlToLoadedDependency.replace(newDependency.getUrl(), new Dependency(newDependency.getType(), newDependency.getUrl(), moreEagerLoadMode));
    }
}
Also used : LoadMode(com.vaadin.flow.shared.ui.LoadMode) Dependency(com.vaadin.flow.shared.ui.Dependency)

Aggregations

LoadMode (com.vaadin.flow.shared.ui.LoadMode)7 JsonArray (elemental.json.JsonArray)6 JsonObject (elemental.json.JsonObject)5 Dependency (com.vaadin.flow.shared.ui.Dependency)3 Component (com.vaadin.flow.component.Component)2 Tag (com.vaadin.flow.component.Tag)2 UI (com.vaadin.flow.component.UI)2 JavaScript (com.vaadin.flow.component.dependency.JavaScript)2 StyleSheet (com.vaadin.flow.component.dependency.StyleSheet)2 JavaScriptInvocation (com.vaadin.flow.component.internal.UIInternals.JavaScriptInvocation)2 Element (com.vaadin.flow.dom.Element)2 ElementFactory (com.vaadin.flow.dom.ElementFactory)2 JsonUtils (com.vaadin.flow.internal.JsonUtils)2 VaadinServletRequest (com.vaadin.flow.server.VaadinServletRequest)2 VaadinSession (com.vaadin.flow.server.VaadinSession)2 ApplicationConstants (com.vaadin.flow.shared.ApplicationConstants)2 Json (elemental.json.Json)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2