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 you don't typically have to use the 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).
Package resources (resources which can be pulled from the classpath) do not have to be pre-registered. For custom situations though, resources may be added to the Application when the Application is constructed using {@link Application#getSharedResources()} followed by{@link SharedResources#add(Class,String,Locale,String,Resource)}, {@link SharedResources#add(String,Locale,Resource)}or {@link SharedResources#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 {@link #newResource()} method. In this method, the component should supply logic that creates theshared resource. By default the {@link #newResource()} method tries to resolve to a packageresource.
@author Jonathan Locke