caplin.menu.Control
will be in charge of rendering into the screen any
caplin.menu.Model. In order to do so, after constructing this class with the appropriate
parameters, call caplin.menu.Control#render.
This class will be initially used to render caplin.menu.model.Menu but any implementation of
caplin.menu.Model can be provided. See caplin.menu.Control#addGenerator for details
on how to extend the control's functionality.
Attributes | Name and Description |
---|---|
|
caplin.menu.Control(caplin.menu.Model any, HTMLElement containerElement)
|
Attributes | Name and Description |
---|---|
|
void
addGenerator(caplin.menu.Generator generator, String type)
This method is used as an extension point to the |
|
void
append(caplin.menu.Model any, HTMLElement containerElement)
Extracts the DOM representation of the provided model and appends it to a container element. |
|
void
destroy()
Removes all the children nodes appended to the container and calls destroy in each of the registered controls. |
|
void
render()
Renders any caplin.menu.Model onto the screen. |
|
void
setContainerElement(HTMLElement containerElement)
Allows you to set the container element in which the menu will be rendered. |
|
void
setModel(caplin.menu.Model model)
Allows you to set the model which will be rendered. |
►
caplin.menu.Control(caplin.menu.Model any, HTMLElement containerElement)
caplin.menu.Model | any | instance of caplin.menu.Model. |
HTMLElement | containerElement | Container element. |
►
void
addGenerator(caplin.menu.Generator generator, String type)
This method is used as an extension point to the caplin.menu.Control
. It will allow you to define
your own generators to render custom items. They will be linked by the item's type returned by
caplin.menu.Model#getType.
This generators will need to implement caplin.menu.Generator.
caplin.menu.Generator | generator | Generator class which will render elements of the given type. |
String | type | String representation of the item type the generator registered will be in charge of rendering. |
►
void
append(caplin.menu.Model any, HTMLElement containerElement)
Extracts the DOM representation of the provided model and appends it to a container element. This id done by calling each of the model type generators' create method.
caplin.menu.Model | any | instance of caplin.menu.Model. |
HTMLElement | containerElement | Container element in which the menu will be rendered to. |
►
void
destroy()
Removes all the children nodes appended to the container and calls destroy in each of the registered controls.
►
void
render()
Renders any caplin.menu.Model onto the screen.
►
void
setContainerElement(HTMLElement containerElement)
Allows you to set the container element in which the menu will be rendered.
HTMLElement | containerElement | The element in which the menu will be rendered. |
►
void
setModel(caplin.menu.Model model)
Allows you to set the model which will be rendered.
caplin.menu.Model | model | Model to be rendered. |