use of com.liferay.faces.bridge.component.internal.UIViewRootBridgeImpl in project liferay-faces-bridge-impl by liferay.
the class ApplicationImpl method createComponent.
/**
* This method provides the ability to supply an instance of the bridge API's {@link
* PortletNamingContainerUIViewRoot} class which properly handles namespacing of "id" attributes for portlets.
*
* @see Application#createComponent(String)
*/
@Override
@SuppressWarnings("unchecked")
public UIComponent createComponent(String componentType) throws FacesException {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (componentType.equals(UIViewRoot.COMPONENT_TYPE) && BridgeUtil.isPortletRequest(facesContext)) {
// to cleanup @ViewScoped managed-beans.
if (subscribeToEventsAtRuntime) {
// order to ensure that it only happens once.
synchronized (subscribeToEventsAtRuntime) {
// Need to check again within the synchronization block, just in case.
if (subscribeToEventsAtRuntime) {
BridgeConfig bridgeConfig = RequestMapUtil.getBridgeConfig(facesContext);
List<ConfiguredSystemEventListener> configuredSystemEventListeners = (List<ConfiguredSystemEventListener>) bridgeConfig.getAttributes().get(BridgeConfigAttributeMap.CONFIGURED_SYSTEM_EVENT_LISTENERS);
if (configuredSystemEventListeners != null) {
for (ConfiguredSystemEventListener configuredSystemEventListener : configuredSystemEventListeners) {
if (UIVIEWROOT_FQCN.equals(configuredSystemEventListener.getSourceClass())) {
subscribeToJSF2SystemEvent(configuredSystemEventListener);
}
}
}
}
subscribeToEventsAtRuntime = false;
}
}
return new UIViewRootBridgeImpl();
} else {
return getWrapped().createComponent(componentType);
}
}
Aggregations