Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > Blocks > Apply Boxing to a Block > Simple Box Around a Block
  
Simple Box Around a Block
Refer to the para in first sect1 in chapter context in the Arbortext-path/samples/ALD/Blocks/Boxing/blockBoxing.xml sample file. The context references the simple 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;
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 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.