Caplin Trader 4.8.0

Namespace: caplin/menu

caplin/menu

The menu library provides all the necessary classes to generate a menu along with a PresenterControl and a menu PresentationNode for presenter integration (see live examples). It also provides a MenuModelFixture which allows menu model manipulation within jsTestRunner.

In order to render a menu to the screen an instance of caplin.menu.Model will need to be provided to the caplin.menu.Control. The control will then use an instance of caplin.menu.Generator to render each model type.

The Caplin menu library provides two default caplin.menu.Model implementations, caplin.menu.model.Item, representing a standard item, and caplin.menu.model.Menu, which will provide a simple API to manipulate it. The caplin.menu.Control provides two default generators, caplin.menu.generator.Item and caplin.menu.generator.Menu which will deal with the rendering of the two model types provided. You can create your own caplin.menu.Model implementations along with the correspondent caplin.menu.Generator implementation to render them. This custom generators will then need to be registered on the caplin.menu.Control linked to each of the caplin.menu.Model by its type.

The Caplin menu library provides a caplin.menu.model.MenuFactory which will allow you to generate instances of caplin.menu.Model by providing a JSON like config object.