Javadoc
If the ResourceDependency component is created under facelets processing, it should receive
an special unique component id. This method check if there is a FaceletCompositionContext
and if that so, set the id. Components added by the effect of ResourceDependency are special,
because they do not have state, but they depends on the view structure, so with PSS,
each time the view is built they are "recalculated", so they work as if they were transient
components that needs to be created at each request, but there are some cases were the
components needs to be saved and restored fully. If a component is created outside facelets
control (render response phase) it is expected to use the default implementation of
createUniqueId(), but in that case, note that this happens after markInitialState() is
called, and the component in this case is saved and restored fully, as expected.
This code cannot be called from facelets component tag handler, because in cases where a
component subtree is created using binding property, facelets lost control over component
creation and delegates it to the user, but since the binding code is executed each time the
view is created, the effect over ResourceDependency persists and the binding code takes into
account in the recalculation step, even if later the node related to the binding property
is dropped and recreated from the state fully.