ACE Adding Resources to Meta Class

Table of Contents

Adding Resources to Meta Class

Javascript, CSS and image resources fall into two different categories:

  • Intrinsic resources, which are required for the component to properly function. These need to always be in the page when the component is in use, so we automate that dependency by adding @ResourceDependency annotations to the Meta class, which cause the resources to be loaded into the page whenever the component is in use. This can include Javascript files, as well as CSS files. The image resources would be referenced from the CSS files. This current page describes how to add intrinsic resources.
  • Skin resources, which might only be included in the page when that particular skin is currently being used. Since they're only conditionally used, they are not referenced from the Meta class, and are instead included via the standard skinning mechanism in your application. These would consist of CSS files, and the image files that they reference. For detailed information on how skins are made, review this page.

Directions

1. The intrinsic resources should be placed in the appropriate location

Intrinsic Resources
ace\component\resources\icefaces.ace\[componentname]
ace\component\resources\icefaces.ace\[componentname]\componentname.js
ace\component\resources\icefaces.ace\[componentname]\componentname.css

Using the TabSet component as an example

TabSet Intrinsic Resources
ace\component\resources\icefaces.ace\tabset\tabset.js
ace\component\resources\icefaces.ace\tabset\tabset.css
ace\component\resources\icefaces.ace\tabset\images\*

2. @ResourceDependency annotations, corresponding to the resources, should be added to the Meta class

TabSetMeta Class
@ResourceDependencies({
@ResourceDependency(name="tabset/tabset.js",library="icefaces.ace"),
@ResourceDependency(name="tabset/tabset.css",library="icefaces.ace")
})
public class TabSetMeta extends UIComponentBaseMeta { ... }

3. The build process places the resources in the META-INF directory of the JAR

Built Resources
ace\component\build\exploded\META-INF\resources\icefaces.ace\tabset\tabset.js
ace\component\build\exploded\META-INF\resources\icefaces.ace\tabset\tabset.css
ace\component\build\exploded\META-INF\resources\icefaces.ace\tabset\images\*
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2021 ICEsoft Technologies Canada Corp.