Class
caplin.menu.control

Control

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

Constructor Summary

Attributes Name and Description
caplin.menu.control.Control(caplin.menu.model.Item any, HTMLElement containerElement)

Method Summary

Attributes Name and Description
void addControl(caplin.menu.control.DefaultItemControl control, String type)

This method is used as an extension point to the MenuControl.

void append(caplin.menu.model.Item any, HTMLElement containerElement)

Appends the provided model into a container element.

void render()

Renders any {@caplin.menu.model.Item} onto the screen.

Constructor Detail

caplin.menu.control.Control(caplin.menu.model.Item any, HTMLElement containerElement)

Parameters
caplin.menu.model.Item any instance of caplin.menu.model.Item.
HTMLElement containerElement Container element.
Throws
caplin.core.Error
If menu is not an instance of caplin.menu.model.Item.
caplin.core.Error
If containerElement is not a HTMLElement.

Method Detail

void addControl(caplin.menu.control.DefaultItemControl control, String type)

This method is used as an extension point to the MenuControl. It will allow you to define your own controls to render custom items. They will be linked by the item's type returned by caplin.menu.model.Item#getType. This controls will need to extend caplin.menu.control.DefaultItemControl.

Parameters
caplin.menu.control.DefaultItemControl control Control class which will render elements of the given type.
String type String representation of the item type the control registered will be in charge of rendering.
Throws
caplin.core.Error
If control is not an instance of caplin.menu.control.DefaultItemControl.

void append(caplin.menu.model.Item any, HTMLElement containerElement)

Appends the provided model into a container element.

Parameters
caplin.menu.model.Item any instance of caplin.menu.model.Item.
HTMLElement containerElement Container element in which the menu will be rendered to.

void render()

Renders any {@caplin.menu.model.Item} onto the screen.