public WroModel create() { return new WroModel(); }
public WroModelInspector(final WroModel model) { Validate.notNull(model); for (final Group group : model.getGroups()) { map.put(group.getName(), group); } }
private void processImports(final Document document) { final NodeList importsList = document.getElementsByTagName(TAG_IMPORT); LOG.debug("number of imports: {}", importsList.getLength()); for (int i = 0; i < importsList.getLength(); i++) { final Element element = (Element) importsList.item(i); final String name = element.getTextContent(); LOG.debug("processing import: {}", name); Validate.notNull(locatorFactory, "The Locator cannot be null!"); if (processedImports.contains(name)) { final String message = "Recursive import detected: " + name; LOG.error(message); throw new RecursiveGroupDefinitionException(message); } processedImports.add(name); model.merge(createImportedModel(name)); } }
@Override public WroModel create() { WroModel model = new WroModel(); WebResourceManager service = Framework.getService(WebResourceManager.class); ResourceContextImpl rcontext = new ResourceContextImpl(); List<ResourceBundle> bundles = service.getResourceBundles(); for (ResourceBundle bundle : bundles) { String groupName = bundle.getName(); Group group = new Group(groupName); List<Resource> resources = service.getResources(rcontext, groupName, ResourceType.any.name()); if (resources != null) { for (Resource resource : resources) { ro.isdc.wro.model.resource.Resource wr = toWroResource(groupName, resource); if (wr != null) { group.addResource(wr); } } } model.addGroup(group); } return model; }
if (!isAbstractGroup) { model.addGroup(group);
/** * @param groups * the groups to set */ public final WroModel setGroups(final Collection<Group> groups) { notNull(groups, "groups cannot be null!"); LOG.debug("setGroups: {}", groups); identifyDuplicateGroupNames(groups); this.groups = new HashSet<Group>(groups); return this; }
public Group getGroup(String name) { return model.getGroupByName(name); } }
public WroModel create() { Group dragomeGroup= new Group("dragome"); dragomeGroup.addResource(Resource.create("/dragome-resources/js/hashtable.js", ResourceType.JS)); dragomeGroup.addResource(Resource.create("/dragome-resources/js/deflate.js", ResourceType.JS)); dragomeGroup.addResource(Resource.create("/dragome-resources/js/helpers.js", ResourceType.JS)); dragomeGroup.addResource(Resource.create("/dragome-resources/js/string.js", ResourceType.JS)); dragomeGroup.addResource(Resource.create("/dragome-resources/js/qx-oo-5.0.1.min.js", ResourceType.JS)); dragomeGroup.addResource(Resource.create("/compiled-js/webapp.js", ResourceType.JS)); dragomeGroup.addResource(Resource.create("/dragome-resources/css/dragome.css", ResourceType.CSS)); Group compiledGroup= new Group("compiled"); compiledGroup.addResource(Resource.create("/compiled-js/webapp.js", ResourceType.JS)); WroModel wroModel= new WroModel(); wroModel.addGroup(dragomeGroup); wroModel.addGroup(compiledGroup); return wroModel; } public void destroy()
if (!isAbstractGroup) { model.addGroup(group);
/** * @param groups * the groups to set */ public final WroModel setGroups(final Collection<Group> groups) { notNull(groups, "groups cannot be null!"); LOG.debug("setGroups: {}", groups); identifyDuplicateGroupNames(groups); this.groups = new HashSet<Group>(groups); return this; }
@Override public WroModel create() { WroModel model = new WroModel(); ThemeStylingService ts = Framework.getService(ThemeStylingService.class); WebResourceManager ws = Framework.getService(WebResourceManager.class); ResourceContextImpl rcontext = new ResourceContextImpl(); List<PageDescriptor> pages = ts.getPages(); for (PageDescriptor page : pages) { String groupName = page.getName(); Group group = new Group(groupName); List<String> bundleNames = page.getResourceBundles(); for (String bundleName : bundleNames) { List<Resource> resources = ws.getResources(rcontext, bundleName, ResourceType.any.name()); if (resources != null) { for (Resource resource : resources) { ro.isdc.wro.model.resource.Resource wr = toWroResource(bundleName, resource); if (wr != null) { group.addResource(wr); } } } } model.addGroup(group); } return model; }
public WroModel create() { return new WroModel(); }
if (!isAbstractGroup) { model.addGroup(group);
public WroModelInspector(final WroModel model) { Validate.notNull(model); for (final Group group : model.getGroups()) { map.put(group.getName(), group); } }
private void processImports(final Document document) { final NodeList importsList = document.getElementsByTagName(TAG_IMPORT); LOG.debug("number of imports: {}", importsList.getLength()); for (int i = 0; i < importsList.getLength(); i++) { final Element element = (Element) importsList.item(i); final String name = element.getTextContent(); LOG.debug("processing import: {}", name); notNull(locatorFactory, "The Locator cannot be null!"); if (processedImports.contains(name)) { final String message = "Recursive import detected: " + name; LOG.error(message); throw new RecursiveGroupDefinitionException(message); } processedImports.add(name); model.merge(createImportedModel(name)); } }
/** * @return a {@link BaseWroManagerFactory} which uses an empty model. */ public static BaseWroManagerFactory simpleManagerFactory() { return new BaseWroManagerFactory().setModelFactory(simpleModelFactory(new WroModel())); }
/** * Merge master model with another model. This is useful for supporting model imports. * * @param master master modele where we put imported model * @param importedModel model to import. */ protected void merge(WroModel master, WroModel importedModel) { Validate.notNull(importedModel, "imported model cannot be null!"); LOG.debug("merging importedModel: {}", importedModel); for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) { if (!new WroModelInspector(master).getGroupNames().contains(groupName)) { // si les deux modeles contiennent le meme groupe, on garde celui du master final Group importedGroup = new WroModelInspector(importedModel).getGroupByName(groupName); master.addGroup(importedGroup); } } }
/** * {@inheritDoc} */ public synchronized WroModel transform(final WroModel input) { final WroModel model = input; for (final Group group : model.getGroups()) { final List<Resource> resources = group.getResources(); for (final Resource resource : resources) { processResource(group, resource); } } LOG.debug("Transformed model: {}", model); return model; }
protected void processImports(final Document document) { final NodeList importsList = document.getElementsByTagName(TAG_IMPORT); LOG.debug("number of imports: {}", importsList.getLength()); for (int i = 0; i < importsList.getLength(); i++) { final Element element = (Element) importsList.item(i); final String name = element.getTextContent(); LOG.debug("processing import: {}", name); Validate.notNull(locatorFactory, "The Locator cannot be null!"); if (processedImports.contains(name)) { final String message = "Recursive import detected: " + name; LOG.error(message); throw new RecursiveGroupDefinitionException(message); } processedImports.add(name); model.merge(createImportedModel(name)); } }
/** * @return a {@link BaseWroManagerFactory} which uses an empty model. */ public static BaseWroManagerFactory simpleManagerFactory() { return new BaseWroManagerFactory().setModelFactory(simpleModelFactory(new WroModel())); }