Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > Blocks > Apply Boxing to a Block > Box Around a Block with Rounded Corners
  
Box Around a Block with Rounded Corners
Refer to the para in sect1[2] in chapter context in the Arbortext-path/samples/ALD/Blocks/Boxing/blockBoxing.xml sample file. The context references the rounded corner boxing property set in the associated stylesheet. The relevant code in that property set is given below.
var rule = new fRule;
rule.sides = fRule.SIDE_BOX + fRule.SIDE_NW + fRule.SIDE_NE + fRule.SIDE_SW
+ fRule.SIDE_SE;
rule.radius = "12pt";
rule.thickness = "2pt";
rule.lineColor = "red";
rule.lineStyle = fRuleLine.LINE_SOLID;
Here you have created a new rule based on the fRule object, and set up the variable rule to hold the rule information. You specify the SIDE_BOX constant from the fRule object and the LINE_SOLID constant from the fRuleLine object to draw a box , drawn in the Solid line style, around the contents of a block. You also reference the SIDE_NW, SIDE_NE, SIDE_SW, and SIDE_SE constants from the fRule object to configure a curved shape for all four corners of the block. The radius property for the rule defines the depth of the curve. You also provide size and color settings for the thickness and lineColor properties of the fRule object.
block.rules.addRule(rule);
Here you call the addRule() method from the fRules object to apply the rule information contained in the rule variable to a block. Note that block information for any context that references this property set must come from its Structure setting in the Breaks property category in the Arbortext Styler UI. If the context is set as Inline the rule will not be applied.
block.paddingTop = block.paddingBottom = block.paddingLeft
= block.paddingRight = "3pt";
With this phrase you specify that the four padding properties for the fBlock object all share the same value, i.e. 3pt. This setting provides some space between the rule and the block’s content.