ResourceReference is essentially a reference to an actual resource which is
shared through the Application. A ResourceReference has a name and a scope
(within which the name must be unique). It may also have a locale or style.
The locale and/or style do not need to be set on a resource reference because
those values will automatically be determined based on the context in which
the resource is being used. For example, if a ResourceReference is attached
to an Image component, when the locale for the page switches, the Image
component will notice this and automatically change the locale for the
referenced resource as appropriate. It's for this reason that there are no
constructor overloads taking a Locale or style (these details are essentially
internal and so the framework uses setLocale/setStyle internally so you don't
have to worry about it).
If a component has its own shared resource which should not be added to the
application construction logic in this way, it can lazy-initialize the
resource by overriding the newResource() method. In
this method, the component should supply logic that creates the shared
resource.
Resources may be added to the Application when the Application is constructed using getSharedResources() followed by add(Class, String, Locale, String, Resource) , add(String, Locale, Resource) or add(String, Resource) .
If a component has its own shared resource which should not be added to the application construction logic in this way, it can lazy-initialize the resource by overriding the newResource() method. In this method, the component should supply logic that creates the shared resource.