Class
caplin.menu.model

Menu

The class is still an Alpha release. It should only be used for experimental development as substantial changes may occur.
Extends .

Constructor Summary

Attributes Name and Description
caplin.menu.model.Menu(String label, type)

Method Summary

Attributes Name and Description
void add(Variant item)

Allows you to add either a single item or an array of items to the menu.

Object get(Number index)

Returns the item in the given position.

Array getAll()

Returns a copy of the list of all menu items in this menu.

void insertAt(Number index, Object item)

Inserts an item in the given position.

void remove(Number index)

Removes an item from the specified index.

void removeAll()

Removes all the items inside the menu.

Constructor Detail

caplin.menu.model.Menu(String label, type)

Parameters
String label Label to be displayed if the menu is a sub menu item.
type

Method Detail

void add(Variant item)

Allows you to add either a single item or an array of items to the menu. This item(s) must implement the caplin.menu.model.Item class.

Parameters
Variant item The array of items or the single item that needs to be added.
Throws
caplin.core.Error
If item is not a instance of caplin.menu.model.Item.

Object get(Number index)

Returns the item in the given position.

Parameters
Number index The item index.
Throws
caplin.core.Error
If index is outside of the bounds of the current menu list.
Returns
{Object}

Array getAll()

Returns a copy of the list of all menu items in this menu.

Returns
{Array} An array of menu items contained in this menu.

void insertAt(Number index, Object item)

Inserts an item in the given position.

Parameters
Number index The index in which the item will be inserted.
Object item The item to be inserted.
Throws
caplin.core.Error
If item is not a instance of caplin.menu.model.Item.
caplin.core.Error
If index is outside of the bounds of the current menu list.

void remove(Number index)

Removes an item from the specified index.

Parameters
Number index The index from which the item will be removed.
Throws
caplin.core.Error
If index is outside of the bounds of the current menu list.

void removeAll()

Removes all the items inside the menu.