use of com.vaadin.flow.component.internal.ComponentMetaData.DependencyInfo in project flow by vaadin.
the class UIInternals method addExternalDependencies.
private void addExternalDependencies(DependencyInfo dependency) {
Page page = ui.getPage();
dependency.getJavaScripts().stream().filter(js -> UrlUtil.isExternal(js.value())).forEach(js -> page.addJavaScript(js.value(), js.loadMode()));
dependency.getJsModules().stream().filter(js -> UrlUtil.isExternal(js.value())).forEach(js -> page.addJsModule(js.value()));
}
use of com.vaadin.flow.component.internal.ComponentMetaData.DependencyInfo in project flow by vaadin.
the class UIInternals method addComponentDependencies.
/**
* Adds the dependencies defined using {@link StyleSheet} or
* {@link JavaScript} on the given Component class.
*
* @param componentClass
* the component class to read annotations from
*/
public void addComponentDependencies(Class<? extends Component> componentClass) {
Page page = ui.getPage();
DependencyInfo dependencies = ComponentUtil.getDependencies(session.getService(), componentClass);
// In npm mode, add external JavaScripts directly to the page.
addExternalDependencies(dependencies);
addFallbackDependencies(dependencies);
dependencies.getStyleSheets().forEach(styleSheet -> page.addStyleSheet(styleSheet.value(), styleSheet.loadMode()));
}
Aggregations