fToolbarGroup
Introduction
Version 12.1.0.0 of Arbortext Layout Developer introduced the ability to specify application toolbars using JavaScript via the fApplication methods and properties fToolbar, fToolbarAction and so on. One feature of toolbars missing from this early implementation was the ability to create toolbar groups. This has been added in the 12.1.2.0 release.
Creating, starting and ending toolbar groups
Toolbar groups in ALD can be used in two ways. One way is as a wrapper for toolbar items and the other is a way of calling another toolbar. These two methods are covered in this new implementation. As toolbar groups can act as wrappers, there are two parts to this feature:
• fToolbarGroupStart — represents the start of the toolbar group
• fToolbarGroupEnd — represents the end of the toolbar group
Both objects have their own constructors, but fToolbarGroupStart is where the magic happens.
To create a group, the group must be started. To do this, create an fToolbarGroupStart object:
var myGroupStart = new fToolbarGroupStart();
fToolbarGroupStart inherits fToolbarItem, and can therefore be added to toolbars using fToolbar.addItem(). But, before adding the group start, some properties must be set. fToolbarGroupStart can have the following properties:
• fToolbarGroupStart.type — toolbar groups can have their own border/background. The type property specifies whether it is one of the values specified on the fToolbarGroupStart.EffectType constant:
◦ fToolbarGroupStart.TYPE_NONE
◦ fToolbarGroupStart.TYPE_OUTDENT
◦ fToolbarGroupStart.TYPE_INDENT
◦ fToolbarGroupStart.TYPE_RIDGE
◦ fToolbarGroupStart.TYPE_GROOVE
◦ fToolbarGroupStart.TYPE_COLOR
• fToolbarGroupStart.color — if fToolbarGroupStart.type is fToolbarGroupStart.TYPE_COLOR, then this property sets the colour using one of the interface colour numbers set in scol256.3ad.
• fToolbarGroupStart.direction — sets the stacking direction of the items in the group, as defined by the fToolbarGroupStart.Direction constant:
◦ fToolbarGroupStart.DIRECTION_DEFAULT
◦ fToolbarGroupStart.DIRECTION_HORIZ
◦ fToolbarGroupStart.DIRECTION_VERT
◦ fToolbarGroupStart.DIRECTION_FLIP
• fToolbarGroupStart.fill — a Boolean property to specify whether, if the type is ‘color’ that the colour selected fills the toolbar
• fToolbarGroupStart.gap — the toolbar group gap (similar to that of the toolbar)
• fToolbarGroupStart.margin — the toolbar group margin (similar to that of the toolbar)
• fToolbarGroupStart.show — whether to display icons, text or both, as specified by the fToolbarGroupStart.DisplayType constant:
◦ fToolbarGroupStart.DISPLAY_TEXT — display text only
◦ fToolbarGroupStart.DISPLAY_ICONS — display icons only
◦ fToolbarGroupStart.DISPLAY_TEXT_ICONS — display both text and icons
• fToolbarGroupStart.wrap — a Boolean property to specify whether the items in the toolbar group should wrap
• fToolbarGroupStart.test — a toolbar test which, if it returns a non-zero value, ensures the toolbar group is displayed
• fToolbarGroupStart.toolbar — it is possible to include a link to an already specified toolbar as the group, this property will call a toolbar by name to be displayed
In order to use toolbar groups to call another toolbar, then, something like this will be needed:
//Create group start with a toolbar and add that
var myToolbar = application.getToolbar("mySpecialToolbar");
var myGroup = new fToolbarGroupStart();
myGroup.toolbar = "ale_FrameToolbar";
myGroup.test = "((?+^[window.count]):(?=^[doc.mode],1))";
myToolbar.addItem(myGroup);
//End the group
myToolbar.addItem(new fToolbarGroupEnd());
Alternatively, a simple group can be started which wraps other items
var myGroup = new fToolbarGroupStart();
myGroup.test = "((?+^[window.count]):(?=^[doc.mode],1))";
myToolbar.addItem(myGroup);
myToolbar.addItem(myOtherItem1);
myToolbar.addItem(myOtherItem2);
myToolbar.addItem(myOtherItem3);
myToolbar.addItem(new fToolbarGroupEnd());