balaji balaji - 9 months ago 102
CSS Question

What is the significance of currentStyle

Can you tell me in

, the exact use of

I have one line like

int absParent = currentStyle.get("absParent", 3);

May I know what currentStyle will do here.

Answer Source

The currentStyle, an instance of the Style class contains the properties that reflect the design aspect of a cell.

Any change to the properties of a component in design mode, gets saved under /etc/designs/<<your project design>> (in case the cq:design property is available for the page or in any of its parent) or /etc/designs/default (the default design), unlike the properties authored in an ordinary dialog, in which case the values are stored under the same page.

Thus, the currentStyle.get(), functions similar to properties.get() as it extends ValueMap, just that it provides you the values stored in the design instead of the content.

There isn't much information available related to this in the docs. However you can take a look at the Designer to understand it further.