new (require("bajaux/commands/ToggleCommandGroup"))(params)
- Description:
ToggleCommandGroup is a special CommandGroup that behaves like a radio button group.
- Source:
Extends:
Examples
new ToggleCommandGroup({
commands: [
{
module: "mymodule",
lex: "mycommand1",
value: 0
},
{
module: "mymodule",
lex: "mycommand2",
value: 1
},
{
module: "mymodule",
lex: "mycommand3",
value: 2
}
],
onChange: function (value) {
// receives the values specified above.
switch (value) {
case 0:
case 1:
case 2:
}
}
});
Use a flat style for your toggle button group.
var buttonGroup = new CommandButtonGroup();
return buttonGroup.initialize(dom, { toggleGroup: true })
.then(function () {
return buttonGroup.load(toggleCommandGroup);
});
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object |
Properties
|
Extends
Members
off
- Description:
Unregister a function callback handler for the specified event.
- Source:
- Since:
- Niagara 4.12
- Inherited From:
Unregister a function callback handler for the specified event.
on
- Description:
Register a function callback handler for the specified event.
- Source:
- Since:
- Niagara 4.12
- Inherited From:
Register a function callback handler for the specified event.
Methods
add(command) → {module:bajaux/commands/CommandGroup}
- Description:
Add a command to this group. Triggers a
bajaux:changecommandgroupevent. Multiple arguments can be specified to
add many commands at once.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
command |
module:bajaux/commands/Command | The command to add. |
Returns:
Return the CommandGroup instance.
doSort(kids) → {Array|Promise}
- Description:
Does the work of sorting this command group. By default, does nothing.
When overriding this method, be sure to return the sorted array as a
parameter todeferred.resolve.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
kids |
Array | An array of the command group's children - this may |
Returns:
an array containing the sorted children, or
a promise to be resolved with same
- Type
- Array | Promise
filter(options) → {module:bajaux/commands/CommandGroup}
- Description:
Filters the commands in this command group based on the results of
a test function, and returns a new, filtered CommandGroup instance.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | An options object literal Properties
|
Returns:
A filtered command group.
findCommand(id) → {module:bajaux/commands/Command|null}
- Description:
Find a Command in this CommandGroup (or sub CommandGroup) via its id and return it.
- Source:
- Inherited From:
Example
group.findCommand(DeleteCommand); // returns the first instance of DeleteCommand in the group if present.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
Number | function | an id, filter function, or Command constructor. A filter |
Returns:
return the found Command (or null if nothing found).
- Type
- module:bajaux/commands/Command | null
flatten(options) → {Array}
- Description:
Return a listing of the commands (not command groups) contained within
this group. Can optionally recursively visit down through any
sub-CommandGroups contained in this group (depth first) to return all
commands. Can optionally filter commands by flags as well.
- Source:
- Inherited From:
Example
cmdGroup.flatten(); // all child commands
cmdGroup.flatten(Command.flags.MENU); // only children with MENU flag
cmdGroup.flatten({ flags: Command.flags.MENU, recurse: true });
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | An options object. Properties
|
Returns:
An array of Commands.
- Type
- Array
get(index) → {module:bajaux/commands/Command|module:bajaux/commands/CommandGroup|null}
- Description:
Return a Command/CommandGroup based upon the index or
null if nothing can be found.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
index |
Number |
Returns:
getChildren() → {Array}
- Description:
Returns a defensive copy of this group's array of children.
- Source:
- Inherited From:
Returns:
- Type
- Array
getDisplayNameFormat() → {String}
- Description:
Return the format display name of this command group.
- Source:
- Inherited From:
Returns:
- Type
- String
getFlags() → {Number}
- Description:
Returns this group's flags.
- Source:
- Inherited From:
Returns:
- Type
- Number
getIcon() → {String}
- Description:
Return the CommandGroup's icon URI
- Source:
- Since:
- Niagara 4.12
- Inherited From:
Returns:
- Type
- String
getSelected() → {module:bajaux/commands/ToggleCommand}
- Description:
Get the selected command
- Source:
Returns:
The selected ToggleCommand
getSelectedValue() → {any}
- Description:
Get the selected value if available
- Source:
Returns:
If a 'value' parameter is set it will be returned
- Type
- any
hasFlags(flags)
- Description:
Check to see if this group's flags match any of the bits of the
input flags.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
flags |
Number | The flags to check against |
isCommand()
- Description:
Always returns false.
- Source:
- Inherited From:
isEmpty()
- Description:
Return true if this CommandGroup doesn't contain any children.
- Source:
- Inherited From:
Returns:
true if empty.
isLoading() → {boolean}
- Source:
- Inherited From:
Returns:
true if any of the Commands are still loading.
- Type
- boolean
isToggleCommand()
- Description:
Always returns false.
- Source:
- Inherited From:
jq(jqDomopt) → {JQuery}
- Description:
If a jQuery DOM argument is specified, this will set the DOM.
If not specified then no DOM will be set.
This method will always return the jQuery DOM associated with this CommandGroup.
- Source:
- Inherited From:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
jqDom |
JQuery |
<optional> |
If specified, this will set the jQuery DOM. |
Returns:
A jQuery DOM object for firing events on.
- Type
- JQuery
loading() → {Promise}
- Description:
Return promise that will be resolved once all the Commands in this
group have been loaded.
- Source:
- Inherited From:
Returns:
A promise that will be resolved once all of the
child Commands have loaded.
- Type
- Promise
merge(group, paramsopt) → {module:bajaux/commands/CommandGroup|null}
- Description:
Merges an input command group with this one, and returns a new
command group with the merged results.
- Source:
- Inherited From:
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
group |
module:bajaux/commands/CommandGroup | The group to merge with |
|||||||||||
params |
object |
<optional> |
Properties
|
Returns:
the merged group, or
null if the merge could not be completed
- Type
- module:bajaux/commands/CommandGroup | null
remove(command) → {module:bajaux/commands/CommandGroup}
- Description:
Remove a command from this group. Triggers a
bajaux:changecommandgroupevent.
Multiple arguments
can be specified so multiple commands can be removed at once.
- Source:
- Inherited From:
Example
// Passing an id/index (Number)
commandGroup.remove(0); // Removes the 0 index kid from the group
// Passing a command (module:bajaux/commands/Command)
commandGroup.remove(command); // Removes the matching 'command' from the group
// Passing multiple commands (module:bajaux/commands/Command)
commandGroup.remove(command1, command2); // Removes the matching commands from the group
Parameters:
| Name | Type | Description |
|---|---|---|
command |
module:bajaux/commands/Command | Number | The command or index |
Returns:
Return the CommandGroup instance.
removeAll(options)
- Description:
Remove all children of this command group that match the input flag,
optionally emptying out child groups as well. Triggers a
bajaux:changecommandgroupevent.
- Source:
- Inherited From:
Example
cmdGroup.removeAll();
cmdGroup.removeAll(Command.flags.MENU_BAR);
cmdGroup.removeAll({ flags: Command.flags.MENU_BAR, recurse: true });
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | An options object Properties
|
setChildren(children)
- Description:
Sets this group's array of commands/groups wholesale. Triggers a
bajaux:changecommandgroupevent.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
children |
Array |
setDisplayNameFormat(displayName)
- Description:
Set the display name format of the command group. Triggers a
bajaux:changecommandgroupevent.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
displayName |
String | display name - supports baja Format syntax |
setFlags(flags)
- Description:
Sets this group's flags. Triggers a
bajaux:changecommandgroupevent.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
flags |
Number |
setIcon(icon)
- Description:
Sets the icon for this CommandGroup. Triggers a
bajaux:changecommandgroupevent.
- Source:
- Since:
- Niagara 4.12
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
icon |
String | The CommandButton's icon (either a URI or a module:// ORD string) |
size() → {Number}
- Description:
Return the number of children the CommandGroup has
(this covers both Commands and CommandGroups).
- Source:
- Inherited From:
Returns:
- Type
- Number
sort() → {Promise}
- Description:
Sorts this command group. Typically will not be overridden; override
doSortinstead. Triggers abajaux:changecommandgroupevent.
- Source:
- Inherited From:
Returns:
A promise that will be invoked once the CommandGroup
has been sorted.
- Type
- Promise
toDisplayName() → {Promise.<String>}
- Description:
Formats the command's display name.
- Source:
- Inherited From:
Returns:
Promise to be resolved with the display name
- Type
- Promise.<String>
trigger(name)
- Description:
Triggers an event from this CommandGroup.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
visit(func)
- Description:
Visit through all of the Commands and CommandGroups.
The function passed it will be called for every Command and CommandGroup
found (including this CommandGroup).
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
func |
Called for every CommandGroup and Command found. Each |