@Override
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
FacesContext facesContext = getFacesContext();
javax.faces.component.UIViewRoot viewroot = facesContext.getViewRoot();
Resource resource = null;
if(!resourceExists(facesContext, "/jquery/plugins/uploadify/uploadify.css")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/plugins/uploadify/uploadify.css");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/yui/utilities/utilities.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/yui/utilities/utilities.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/yui/cookie/cookie-min.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/yui/cookie/cookie-min.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/jquery/jquery.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/jquery.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/jquery/plugins/uploadify/swfobject.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/plugins/uploadify/swfobject.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/jquery/plugins/uploadify/jquery.uploadify.v2.1.0.min.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/plugins/uploadify/jquery.uploadify.v2.1.0.min.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/primefaces/core/core.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/primefaces/core/core.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/primefaces/uploader/uploader.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/primefaces/uploader/uploader.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
}