Class PageResourceProvider

java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jgrapes.webconsole.base.PageResourceProvider
All Implemented Interfaces:
Iterable<org.jgrapes.core.ComponentType>, org.jgrapes.core.Channel, org.jgrapes.core.ComponentType, org.jgrapes.core.Eligible, org.jgrapes.core.Manager
Direct Known Subclasses:
AashAlpineJsProvider, AlpineJsProvider, ChartJsProvider, DatatablesProvider, FontAwesomeProvider, ForkAwesomeProvider, GridstackProvider, JgWcComponentsProvider, JQueryProvider, JQueryUi, JQueryUiTouchPunchProvider, LitProvider, LuxonProvider, MarkdownItProvider, MomentProvider, RcWebcomponentsProvider, VueJsProvider, VueProvider, VuexProvider

public abstract class PageResourceProvider extends org.jgrapes.core.Component
Base class for implementing components that add resources to the <HEAD> section of the web console page.

A derived class must implement a handler for ConsoleReady that generates an AddPageResources event. This will, in turn, result in a PageResourceRequest that must be handled by the derived class’ onResourceRequest(PageResourceRequest, IOSubchannel) method.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.jgrapes.core.Channel

    org.jgrapes.core.Channel.Default
  • Field Summary

    Fields inherited from class org.jgrapes.core.Component

    logger

    Fields inherited from interface org.jgrapes.core.Channel

    BROADCAST, SELF
  • Constructor Summary

    Constructors
    Constructor
    Description
    PageResourceProvider(org.jgrapes.core.Channel channel)
    Creates a new component.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    onResourceRequest(PageResourceRequest event, org.jgrapes.io.IOSubchannel channel)
    A default handler for resource requests.
    protected ResourceBundle
    Provides a resource bundle for localization.

    Methods inherited from class org.jgrapes.core.Component

    channel, component, defaultCriterion, isEligibleFor, setName

    Methods inherited from class org.jgrapes.core.internal.ComponentVertex

    activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.jgrapes.core.Manager

    stream
  • Constructor Details

    • PageResourceProvider

      public PageResourceProvider(org.jgrapes.core.Channel channel)
      Creates a new component.
      Parameters:
      channel - the channel to listen on
  • Method Details

    • resourceBundle

      protected ResourceBundle resourceBundle(Locale locale)
      Provides a resource bundle for localization.

      The default implementation looks up a bundle using the package name plus “l10n” as base name.

      Returns:
      the resource bundle
    • onResourceRequest

      @Handler public final void onResourceRequest(PageResourceRequest event, org.jgrapes.io.IOSubchannel channel)
      A default handler for resource requests.

      Searches for a file with the requested resource URI in the component’s class path and sets its URL as result if found.

      Parameters:
      event - the resource request event
      channel - the channel that the request was received on