@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/ui/jquery.ui.dialog.css")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/plugins/ui/jquery.ui.dialog.css");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/jquery/plugins/ui/jquery.ui.button.css")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/plugins/ui/jquery.ui.button.css");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/yui/slider/assets/skins/sam/slider.css")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/yui/slider/assets/skins/sam/slider.css");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/yui/colorpicker/assets/skins/sam/colorpicker.css")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/yui/colorpicker/assets/skins/sam/colorpicker.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/slider/slider-min.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/yui/slider/slider-min.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/yui/colorpicker/colorpicker-min.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/yui/colorpicker/colorpicker-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/ui/jquery-ui.custom.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/jquery/plugins/ui/jquery-ui.custom.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/button/button.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/primefaces/button/button.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
if(!resourceExists(facesContext, "/primefaces/colorpicker/colorpicker.js")) {
resource = (Resource) facesContext.getApplication().createComponent("org.primefaces.component.Resource");
resource.setName("/primefaces/colorpicker/colorpicker.js");
viewroot.addComponentResource(facesContext, resource, "head");
}
}